Skip to content

Commit

Permalink
HBASE-23651 Region balance throttling can be disabled (#991)
Browse files Browse the repository at this point in the history
Signed-off-by: Viraj Jasani <vjasani@apache.org>
Signed-off-by: Anoop Sam John <anoopsamjohn@apache.org>
  • Loading branch information
binlijin committed Jan 8, 2020
1 parent 4f7de9e commit e242d84
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1661,12 +1661,10 @@ InetAddress getRemoteInetAddress(final int port,
* @return Maximum time we should run balancer for
*/
private int getMaxBalancingTime() {
int maxBalancingTime = getConfiguration().getInt(HConstants.HBASE_BALANCER_MAX_BALANCING, -1);
if (maxBalancingTime == -1) {
// if max balancing time isn't set, defaulting it to period time
maxBalancingTime = getConfiguration().getInt(HConstants.HBASE_BALANCER_PERIOD,
HConstants.DEFAULT_HBASE_BALANCER_PERIOD);
}
// if max balancing time isn't set, defaulting it to period time
int maxBalancingTime = getConfiguration().getInt(HConstants.HBASE_BALANCER_MAX_BALANCING,
getConfiguration()
.getInt(HConstants.HBASE_BALANCER_PERIOD, HConstants.DEFAULT_HBASE_BALANCER_PERIOD));
return maxBalancingTime;
}

Expand Down Expand Up @@ -1833,11 +1831,14 @@ public List<RegionPlan> executeRegionPlansWithThrottling(List<RegionPlan> plans)
//rpCount records balance plans processed, does not care if a plan succeeds
rpCount++;

balanceThrottling(balanceStartTime + rpCount * balanceInterval, maxRegionsInTransition,
if (this.maxBlancingTime > 0) {
balanceThrottling(balanceStartTime + rpCount * balanceInterval, maxRegionsInTransition,
cutoffTime);
}

// 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
// a security net for now)
LOG.debug("No more balancing till next balance run; maxBalanceTime="
Expand Down

0 comments on commit e242d84

Please sign in to comment.