HBASE-23651 Region balance throttling can be disabled (#991)

Signed-off-by: Viraj Jasani <vjasani@apache.org>
Signed-off-by: Anoop Sam John <anoopsamjohn@apache.org>
This commit is contained in:
binlijin 2020-01-08 19:01:22 +08:00 committed by GitHub
parent 5a7c9443e9
commit 66d1258aa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 8 deletions

View File

@ -1688,12 +1688,10 @@ public class HMaster extends HRegionServer implements MasterServices {
* @return Maximum time we should run balancer for * @return Maximum time we should run balancer for
*/ */
private int getMaxBalancingTime() { private int getMaxBalancingTime() {
int maxBalancingTime = getConfiguration().getInt(HConstants.HBASE_BALANCER_MAX_BALANCING, -1); // if max balancing time isn't set, defaulting it to period time
if (maxBalancingTime == -1) { int maxBalancingTime = getConfiguration().getInt(HConstants.HBASE_BALANCER_MAX_BALANCING,
// if max balancing time isn't set, defaulting it to period time getConfiguration()
maxBalancingTime = getConfiguration().getInt(HConstants.HBASE_BALANCER_PERIOD, .getInt(HConstants.HBASE_BALANCER_PERIOD, HConstants.DEFAULT_HBASE_BALANCER_PERIOD));
HConstants.DEFAULT_HBASE_BALANCER_PERIOD);
}
return maxBalancingTime; return maxBalancingTime;
} }
@ -1860,11 +1858,14 @@ public class HMaster extends HRegionServer implements MasterServices {
//rpCount records balance plans processed, does not care if a plan succeeds //rpCount records balance plans processed, does not care if a plan succeeds
rpCount++; rpCount++;
balanceThrottling(balanceStartTime + rpCount * balanceInterval, maxRegionsInTransition, if (this.maxBlancingTime > 0) {
balanceThrottling(balanceStartTime + rpCount * balanceInterval, maxRegionsInTransition,
cutoffTime); cutoffTime);
}
// if performing next balance exceeds cutoff time, exit the loop // if performing next balance exceeds cutoff time, exit the loop
if (rpCount < plans.size() && System.currentTimeMillis() > cutoffTime) { if (this.maxBlancingTime > 0 && rpCount < plans.size()
&& System.currentTimeMillis() > cutoffTime) {
// TODO: After balance, there should not be a cutoff time (keeping it as // TODO: After balance, there should not be a cutoff time (keeping it as
// a security net for now) // a security net for now)
LOG.debug("No more balancing till next balance run; maxBalanceTime=" LOG.debug("No more balancing till next balance run; maxBalanceTime="