HBASE-10620 LoadBalancer.needsBalance() should check for co-located region replicas as well (Addendum patch to fix return value from balance() call)

git-svn-id: https://svn.apache.org/repos/asf/hbase/branches/hbase-10070@1576975 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Enis Soztutar 2014-03-12 22:45:06 +00:00
parent d723115058
commit fa68470fe6
1 changed files with 3 additions and 3 deletions

View File

@ -954,7 +954,6 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
} }
// Do this call outside of synchronized block. // Do this call outside of synchronized block.
int maximumBalanceTime = getBalancerCutoffTime(); int maximumBalanceTime = getBalancerCutoffTime();
boolean balancerRan;
synchronized (this.balancer) { synchronized (this.balancer) {
// If balance not true, don't run balancer. // If balance not true, don't run balancer.
if (!this.loadBalancerTracker.isBalancerOn()) return false; if (!this.loadBalancerTracker.isBalancerOn()) return false;
@ -998,7 +997,6 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
long cutoffTime = System.currentTimeMillis() + maximumBalanceTime; long cutoffTime = System.currentTimeMillis() + maximumBalanceTime;
int rpCount = 0; // number of RegionPlans balanced so far int rpCount = 0; // number of RegionPlans balanced so far
long totalRegPlanExecTime = 0; long totalRegPlanExecTime = 0;
balancerRan = plans.size() != 0;
if (plans != null && !plans.isEmpty()) { if (plans != null && !plans.isEmpty()) {
for (RegionPlan plan: plans) { for (RegionPlan plan: plans) {
LOG.info("balance " + plan); LOG.info("balance " + plan);
@ -1026,7 +1024,9 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
} }
} }
} }
return balancerRan; // If LoadBalancer did not generate any plans, it means the cluster is already balanced.
// Return true indicating a success.
return true;
} }
/** /**