HBASE-21055 NullPointerException when balanceOverall() but server balance info is null

Signed-off-by: huzheng <openinx@gmail.com>
This commit is contained in:
haxiaolin 2018-08-15 11:15:46 +08:00 committed by huzheng
parent b972b9a2d9
commit 34a88fca76
1 changed files with 3 additions and 0 deletions

View File

@ -479,6 +479,9 @@ public class SimpleLoadBalancer extends BaseLoadBalancer {
for (int i = 0; i < serverLoadList.size(); i++) { for (int i = 0; i < serverLoadList.size(); i++) {
ServerAndLoad serverload = serverLoadList.get(i); ServerAndLoad serverload = serverLoadList.get(i);
BalanceInfo balanceInfo = serverBalanceInfo.get(serverload.getServerName()); BalanceInfo balanceInfo = serverBalanceInfo.get(serverload.getServerName());
if (balanceInfo == null) {
continue;
}
setLoad(serverLoadList, i, balanceInfo.getNumRegionsAdded()); setLoad(serverLoadList, i, balanceInfo.getNumRegionsAdded());
if (balanceInfo.getHriList().size() + balanceInfo.getNumRegionsAdded() == max) { if (balanceInfo.getHriList().size() + balanceInfo.getNumRegionsAdded() == max) {
RegionInfo hriToPlan; RegionInfo hriToPlan;