nyl3532016 commented on a change in pull request #2450: URL: https://github.com/apache/hbase/pull/2450#discussion_r494240499
########## File path: hbase-server/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java ########## @@ -203,8 +203,11 @@ public void setMasterServices(MasterServices masterServices) { regionList.forEach(r -> currentAssignmentMap.put(r, regions.get(r))); Map<ServerName, List<RegionInfo>> pairResult = this.internalBalancer.retainAssignment(currentAssignmentMap, pair.getSecond()); - pairResult.forEach((server, rs) -> - assignments.computeIfAbsent(server, s -> Lists.newArrayList()).addAll(rs)); + if (pairResult == null || pairResult.isEmpty()) { Review comment: the BaseLoadBalancer.retainAssignment may return null when online server is empty(for some situation), then will add these regions to `pendingAssignQueue` to retry assign. actually, the RSGroupBasedLoadBalancer.retainAssignment will do `generateGroupAssignments` first, so when invoke `internalBalancer.retainAssignment` the server list can't be empty, at least has `BOGUS_SERVER_NAME`,so here can not return null ########## File path: hbase-server/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupBasedLoadBalancer.java ########## @@ -203,8 +203,11 @@ public void setMasterServices(MasterServices masterServices) { regionList.forEach(r -> currentAssignmentMap.put(r, regions.get(r))); Map<ServerName, List<RegionInfo>> pairResult = this.internalBalancer.retainAssignment(currentAssignmentMap, pair.getSecond()); - pairResult.forEach((server, rs) -> - assignments.computeIfAbsent(server, s -> Lists.newArrayList()).addAll(rs)); + if (pairResult == null || pairResult.isEmpty()) { Review comment: @cuibo01 do you meet this NPE in production environment? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org