HBASE-1737 Regions unbalanced when adding new node

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@800585 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Gray 2009-08-03 21:49:10 +00:00
parent 2f98fe4625
commit 9246691f44
2 changed files with 15 additions and 8 deletions

View File

@ -312,6 +312,7 @@ Release 0.20.0 - Unreleased
HBASE-1727 HTD and HCD versions need update HBASE-1727 HTD and HCD versions need update
HBASE-1604 HBaseClient.getConnection() may return a broken connection HBASE-1604 HBaseClient.getConnection() may return a broken connection
without throwing an exception (Eugene Kirpichov via Stack) without throwing an exception (Eugene Kirpichov via Stack)
HBASE-1737 Regions unbalanced when adding new node
IMPROVEMENTS IMPROVEMENTS
HBASE-1089 Add count of regions on filesystem to master UI; add percentage HBASE-1089 Add count of regions on filesystem to master UI; add percentage

View File

@ -1349,17 +1349,22 @@ class RegionManager implements HConstants {
double avg = master.serverManager.getAverageLoad(); double avg = master.serverManager.getAverageLoad();
// nothing to balance if server load not more then average load // nothing to balance if server load not more then average load
if (servLoad.getLoad() <= Math.ceil(avg) || avg <= 2.0) return; if(servLoad.getLoad() <= Math.ceil(avg) || avg <= 2.0) {
return;
}
// check if server is overloaded // check if current server is overloaded
int numRegionsToClose = balanceFromOverloaded(servLoad, avg); int numRegionsToClose = balanceFromOverloaded(servLoad, avg);
// check if we can unload server by low loaded servers // check if we can unload server by low loaded servers
if (numRegionsToClose <= 0) if(numRegionsToClose <= 0) {
balanceToLowloaded(info.getServerName(), servLoad, avg); numRegionsToClose = balanceToLowloaded(info.getServerName(), servLoad,
avg);
}
if (maxRegToClose > 0) if(maxRegToClose > 0) {
numRegionsToClose = Math.min(numRegionsToClose, maxRegToClose); numRegionsToClose = Math.min(numRegionsToClose, maxRegToClose);
}
if(numRegionsToClose > 0) { if(numRegionsToClose > 0) {
unassignSomeRegions(info, numRegionsToClose, mostLoadedRegions, unassignSomeRegions(info, numRegionsToClose, mostLoadedRegions,
@ -1416,7 +1421,8 @@ class RegionManager implements HConstants {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Server " + srvName + " will be unloaded for " + LOG.debug("Server " + srvName + " will be unloaded for " +
"balance. Server load: " + numSrvRegs + " avg: " + "balance. Server load: " + numSrvRegs + " avg: " +
avgLoad + ", regions can be moved: " + numMoveToLowLoaded); avgLoad + ", regions can be moved: " + numMoveToLowLoaded +
". Regions to close: " + numRegionsToClose);
} }
return numRegionsToClose; return numRegionsToClose;
} }