HBASE-21338 Warn if balancer is an ill-fit for cluster size

Signed-off-by: Michael Stack <stack@apache.org>
This commit is contained in:
xcang 2018-10-22 16:29:08 -07:00 committed by Michael Stack
parent 3b68e5393e
commit 807736fcf1
No known key found for this signature in database
GPG Key ID: 9816C7FC8ACC93D2
1 changed files with 13 additions and 5 deletions

View File

@ -374,9 +374,6 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
for (int i = 0; i < this.curFunctionCosts.length; i++) {
curFunctionCosts[i] = tempFunctionCosts[i];
}
LOG.info("start StochasticLoadBalancer.balancer, initCost=" + currentCost + ", functionCost="
+ functionCost());
double initCost = currentCost;
double newCost = currentCost;
@ -385,9 +382,20 @@ public class StochasticLoadBalancer extends BaseLoadBalancer {
computedMaxSteps = Math.max(this.maxSteps,
((long)cluster.numRegions * (long)this.stepsPerRegion * (long)cluster.numServers));
} else {
computedMaxSteps = Math.min(this.maxSteps,
((long)cluster.numRegions * (long)this.stepsPerRegion * (long)cluster.numServers));
long calculatedMaxSteps = (long)cluster.numRegions * (long)this.stepsPerRegion *
(long)cluster.numServers;
computedMaxSteps = Math.min(this.maxSteps, calculatedMaxSteps);
if (calculatedMaxSteps > maxSteps) {
LOG.warn("calculatedMaxSteps:{} for loadbalancer's stochastic walk is larger than "
+ "maxSteps:{}. Hence load balancing may not work well. Setting parameter "
+ "\"hbase.master.balancer.stochastic.runMaxSteps\" to true can overcome this issue."
+ "(This config change does not require service restart)", calculatedMaxSteps,
maxRunningTime);
}
}
LOG.info("start StochasticLoadBalancer.balancer, initCost=" + currentCost + ", functionCost="
+ functionCost() + " computedMaxSteps: " + computedMaxSteps);
// Perform a stochastic walk to see if we can get a good fit.
long step;