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:
parent
4f7de9e27e
commit
e242d84b97
|
@ -1661,12 +1661,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 (maxBalancingTime == -1) {
|
|
||||||
// if max balancing time isn't set, defaulting it to period time
|
// if max balancing time isn't set, defaulting it to period time
|
||||||
maxBalancingTime = getConfiguration().getInt(HConstants.HBASE_BALANCER_PERIOD,
|
int maxBalancingTime = getConfiguration().getInt(HConstants.HBASE_BALANCER_MAX_BALANCING,
|
||||||
HConstants.DEFAULT_HBASE_BALANCER_PERIOD);
|
getConfiguration()
|
||||||
}
|
.getInt(HConstants.HBASE_BALANCER_PERIOD, HConstants.DEFAULT_HBASE_BALANCER_PERIOD));
|
||||||
return maxBalancingTime;
|
return maxBalancingTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1833,11 +1831,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++;
|
||||||
|
|
||||||
|
if (this.maxBlancingTime > 0) {
|
||||||
balanceThrottling(balanceStartTime + rpCount * balanceInterval, maxRegionsInTransition,
|
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="
|
||||||
|
|
Loading…
Reference in New Issue