From 00581ac911fe012f31e95af03d3943bea9b93205 Mon Sep 17 00:00:00 2001 From: Pankaj Date: Sun, 25 Aug 2019 09:26:20 +0530 Subject: [PATCH] HBASE-22904 NPE occurs when RS send space quota usage report during HMaster init (#529) * NPE occurs when RS send space quota usage report during HMaster init * Added the debug log Signed-off-by: Sakthi Signed-off-by: stack --- .../hadoop/hbase/master/MasterRpcServices.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java index c8caea76d871..e1c21c6e5036 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java @@ -2227,10 +2227,15 @@ public RegionSpaceUseReportResponse reportRegionSpaceUse(RpcController controlle return RegionSpaceUseReportResponse.newBuilder().build(); } MasterQuotaManager quotaManager = this.master.getMasterQuotaManager(); - final long now = EnvironmentEdgeManager.currentTime(); - for (RegionSpaceUse report : request.getSpaceUseList()) { - quotaManager.addRegionSize(ProtobufUtil.toRegionInfo( - report.getRegionInfo()), report.getRegionSize(), now); + if (quotaManager != null) { + final long now = EnvironmentEdgeManager.currentTime(); + for (RegionSpaceUse report : request.getSpaceUseList()) { + quotaManager.addRegionSize(ProtobufUtil.toRegionInfo(report.getRegionInfo()), + report.getRegionSize(), now); + } + } else { + LOG.debug( + "Received region space usage report but HMaster is not ready to process it, skipping"); } return RegionSpaceUseReportResponse.newBuilder().build(); } catch (Exception e) { @@ -2265,6 +2270,9 @@ public GetSpaceQuotaRegionSizesResponse getSpaceQuotaRegionSizes( .setSize(tableSize.getValue()).build()); } return builder.build(); + } else { + LOG.debug( + "Received space quota region size report but HMaster is not ready to process it, skipping"); } return builder.build(); } catch (Exception e) {