HBASE-1737 Regions unbalanced when adding new node (recommit)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@807846 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Gray 2009-08-25 22:44:15 +00:00
parent 6599d13108
commit fcc84c258f
2 changed files with 15 additions and 8 deletions

View File

@ -5,6 +5,7 @@ Release 0.21.0 - Unreleased
BUG FIXES BUG FIXES
HBASE-1791 Timeout in IndexRecordWriter (Bradford Stephens via Andrew HBASE-1791 Timeout in IndexRecordWriter (Bradford Stephens via Andrew
Purtell) Purtell)
HBASE-1737 Regions unbalanced when adding new node (recommit)
IMPROVEMENTS IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable HBASE-1760 Cleanup TODOs in HTable

View File

@ -1349,19 +1349,24 @@ 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,
returnMsgs); returnMsgs);
} }
@ -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;
} }