@@ -1661,12 +1661,10 @@ InetAddress getRemoteInetAddress(final int port,
16611661 * @return Maximum time we should run balancer for
16621662 */
16631663 private int getMaxBalancingTime () {
1664- int maxBalancingTime = getConfiguration ().getInt (HConstants .HBASE_BALANCER_MAX_BALANCING , -1 );
1665- if (maxBalancingTime == -1 ) {
1666- // if max balancing time isn't set, defaulting it to period time
1667- maxBalancingTime = getConfiguration ().getInt (HConstants .HBASE_BALANCER_PERIOD ,
1668- HConstants .DEFAULT_HBASE_BALANCER_PERIOD );
1669- }
1664+ // if max balancing time isn't set, defaulting it to period time
1665+ int maxBalancingTime = getConfiguration ().getInt (HConstants .HBASE_BALANCER_MAX_BALANCING ,
1666+ getConfiguration ()
1667+ .getInt (HConstants .HBASE_BALANCER_PERIOD , HConstants .DEFAULT_HBASE_BALANCER_PERIOD ));
16701668 return maxBalancingTime ;
16711669 }
16721670
@@ -1833,11 +1831,14 @@ public List<RegionPlan> executeRegionPlansWithThrottling(List<RegionPlan> plans)
18331831 //rpCount records balance plans processed, does not care if a plan succeeds
18341832 rpCount ++;
18351833
1836- balanceThrottling (balanceStartTime + rpCount * balanceInterval , maxRegionsInTransition ,
1834+ if (this .maxBlancingTime > 0 ) {
1835+ balanceThrottling (balanceStartTime + rpCount * balanceInterval , maxRegionsInTransition ,
18371836 cutoffTime );
1837+ }
18381838
18391839 // if performing next balance exceeds cutoff time, exit the loop
1840- if (rpCount < plans .size () && System .currentTimeMillis () > cutoffTime ) {
1840+ if (this .maxBlancingTime > 0 && rpCount < plans .size ()
1841+ && System .currentTimeMillis () > cutoffTime ) {
18411842 // TODO: After balance, there should not be a cutoff time (keeping it as
18421843 // a security net for now)
18431844 LOG .debug ("No more balancing till next balance run; maxBalanceTime="
0 commit comments