Skip to content

Commit c47f9e6

Browse files
committed
HBASE-23651 Region balance throttling can be disabled (apache#991)
Signed-off-by: Viraj Jasani <[email protected]> Signed-off-by: Anoop Sam John <[email protected]>
1 parent 6d22b7c commit c47f9e6

File tree

1 file changed

+9
-8
lines changed
  • hbase-server/src/main/java/org/apache/hadoop/hbase/master

1 file changed

+9
-8
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,12 +1585,10 @@ InetAddress getRemoteInetAddress(final int port,
15851585
* @return Maximum time we should run balancer for
15861586
*/
15871587
private int getMaxBalancingTime() {
1588-
int maxBalancingTime = getConfiguration().getInt(HConstants.HBASE_BALANCER_MAX_BALANCING, -1);
1589-
if (maxBalancingTime == -1) {
1590-
// if max balancing time isn't set, defaulting it to period time
1591-
maxBalancingTime = getConfiguration().getInt(HConstants.HBASE_BALANCER_PERIOD,
1592-
HConstants.DEFAULT_HBASE_BALANCER_PERIOD);
1593-
}
1588+
// if max balancing time isn't set, defaulting it to period time
1589+
int maxBalancingTime = getConfiguration().getInt(HConstants.HBASE_BALANCER_MAX_BALANCING,
1590+
getConfiguration()
1591+
.getInt(HConstants.HBASE_BALANCER_PERIOD, HConstants.DEFAULT_HBASE_BALANCER_PERIOD));
15941592
return maxBalancingTime;
15951593
}
15961594

@@ -1757,11 +1755,14 @@ public List<RegionPlan> executeRegionPlansWithThrottling(List<RegionPlan> plans)
17571755
//rpCount records balance plans processed, does not care if a plan succeeds
17581756
rpCount++;
17591757

1760-
balanceThrottling(balanceStartTime + rpCount * balanceInterval, maxRegionsInTransition,
1758+
if (this.maxBlancingTime > 0) {
1759+
balanceThrottling(balanceStartTime + rpCount * balanceInterval, maxRegionsInTransition,
17611760
cutoffTime);
1761+
}
17621762

17631763
// if performing next balance exceeds cutoff time, exit the loop
1764-
if (rpCount < plans.size() && System.currentTimeMillis() > cutoffTime) {
1764+
if (this.maxBlancingTime > 0 && rpCount < plans.size()
1765+
&& System.currentTimeMillis() > cutoffTime) {
17651766
// TODO: After balance, there should not be a cutoff time (keeping it as
17661767
// a security net for now)
17671768
LOG.debug("No more balancing till next balance run; maxBalanceTime="

0 commit comments

Comments
 (0)