HBASE-3278 AssertionError in LoadBalancer

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1042912 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-12-07 05:26:39 +00:00
parent 6c2f79d066
commit 21a5df7b4f
3 changed files with 5 additions and 2 deletions

View File

@ -746,6 +746,7 @@ Release 0.90.0 - Unreleased
HBASE-3309 " Not running balancer because dead regionserver processing" is a lie HBASE-3309 " Not running balancer because dead regionserver processing" is a lie
HBASE-3314 [shell] 'move' is broken HBASE-3314 [shell] 'move' is broken
HBASE-3315 Add debug output for when balancer makes bad balance HBASE-3315 Add debug output for when balancer makes bad balance
HBASE-3278 AssertionError in LoadBalancer
IMPROVEMENTS IMPROVEMENTS

View File

@ -259,12 +259,13 @@ public class LoadBalancer {
for(Map.Entry<HServerInfo, List<HRegionInfo>> server : for(Map.Entry<HServerInfo, List<HRegionInfo>> server :
serversByLoad.entrySet()) { serversByLoad.entrySet()) {
int regionCount = server.getKey().getLoad().getNumberOfRegions(); int regionCount = server.getKey().getLoad().getNumberOfRegions();
if (regionCount >= min) break;
BalanceInfo balanceInfo = serverBalanceInfo.get(server.getKey()); BalanceInfo balanceInfo = serverBalanceInfo.get(server.getKey());
if(balanceInfo != null) { if(balanceInfo != null) {
regionCount += balanceInfo.getNumRegionsAdded(); regionCount += balanceInfo.getNumRegionsAdded();
} }
if(regionCount >= min) { if(regionCount >= min) {
break; continue;
} }
int numToTake = min - regionCount; int numToTake = min - regionCount;
int numTaken = 0; int numTaken = 0;

View File

@ -110,7 +110,8 @@ public class TestLoadBalancer {
new int [] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 123 }, new int [] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 123 },
new int [] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 155 }, new int [] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 155 },
new int [] { 0, 0, 144, 1, 1, 1, 1, 1123, 133, 138, 12, 1444 }, new int [] { 0, 0, 144, 1, 1, 1, 1, 1123, 133, 138, 12, 1444 },
new int [] { 0, 0, 144, 1, 0, 4, 1, 1123, 133, 138, 12, 1444 } new int [] { 0, 0, 144, 1, 0, 4, 1, 1123, 133, 138, 12, 1444 },
new int [] { 1538, 1392, 1561, 1557, 1535, 1553, 1385, 1542, 1619 }
}; };
int [][] regionsAndServersMocks = new int [][] { int [][] regionsAndServersMocks = new int [][] {