From 92fdc8dd51156d1b21424f227fa19105a50b425b Mon Sep 17 00:00:00 2001 From: haxiaolin Date: Wed, 15 Aug 2018 11:15:46 +0800 Subject: [PATCH] HBASE-21055 NullPointerException when balanceOverall() but server balance info is null Signed-off-by: huzheng --- .../hadoop/hbase/master/balancer/SimpleLoadBalancer.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java index b0d3f19ad18..89de13bb78d 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java @@ -479,6 +479,9 @@ public class SimpleLoadBalancer extends BaseLoadBalancer { for (int i = 0; i < serverLoadList.size(); i++) { ServerAndLoad serverload = serverLoadList.get(i); BalanceInfo balanceInfo = serverBalanceInfo.get(serverload.getServerName()); + if (balanceInfo == null) { + continue; + } setLoad(serverLoadList, i, balanceInfo.getNumRegionsAdded()); if (balanceInfo.getHriList().size() + balanceInfo.getNumRegionsAdded() == max) { RegionInfo hriToPlan;