Index: src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java =================================================================== --- src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java (revision 1353046) +++ src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java (working copy) @@ -117,7 +117,7 @@ int tableRegionIndex = ensureTableRegionNotOnSameServerAsMeta(admin, hri); // Turn off balancer so it doesn't cut in and mess up our placements. - this.admin.balanceSwitch(false); + this.admin.setBalancerRunning(false, true); // Turn off the meta scanner so it don't remove parent on us. cluster.getMaster().setCatalogJanitorEnabled(false); try { @@ -168,7 +168,7 @@ } finally { // Set this flag back. SplitRegionHandler.TEST_SKIP = false; - admin.balanceSwitch(true); + admin.setBalancerRunning(true, false); cluster.getMaster().setCatalogJanitorEnabled(true); } } @@ -187,7 +187,7 @@ int tableRegionIndex = ensureTableRegionNotOnSameServerAsMeta(admin, hri); // Turn off balancer so it doesn't cut in and mess up our placements. - this.admin.balanceSwitch(false); + this.admin.setBalancerRunning(false, true); // Turn off the meta scanner so it don't remove parent on us. cluster.getMaster().setCatalogJanitorEnabled(false); try { @@ -220,7 +220,7 @@ assertTrue(daughters.size() >= 2); // OK, so split happened after we cleared the blocking node. } finally { - admin.balanceSwitch(true); + admin.setBalancerRunning(true, false); cluster.getMaster().setCatalogJanitorEnabled(true); } } @@ -246,7 +246,7 @@ int tableRegionIndex = ensureTableRegionNotOnSameServerAsMeta(admin, hri); // Turn off balancer so it doesn't cut in and mess up our placements. - this.admin.balanceSwitch(false); + this.admin.setBalancerRunning(false, true); // Turn off the meta scanner so it don't remove parent on us. cluster.getMaster().setCatalogJanitorEnabled(false); try { @@ -278,7 +278,7 @@ assertTrue(daughters.contains(r)); } } finally { - admin.balanceSwitch(true); + admin.setBalancerRunning(true, false); cluster.getMaster().setCatalogJanitorEnabled(true); } } @@ -303,7 +303,7 @@ int tableRegionIndex = ensureTableRegionNotOnSameServerAsMeta(admin, hri); // Turn off balancer so it doesn't cut in and mess up our placements. - this.admin.balanceSwitch(false); + this.admin.setBalancerRunning(false, true); // Turn off the meta scanner so it don't remove parent on us. cluster.getMaster().setCatalogJanitorEnabled(false); try { @@ -353,7 +353,7 @@ assertTrue(daughters.contains(r)); } } finally { - admin.balanceSwitch(true); + admin.setBalancerRunning(true, false); cluster.getMaster().setCatalogJanitorEnabled(true); } } @@ -384,7 +384,7 @@ // Turn off the meta scanner so it don't remove parent on us. cluster.getMaster().setCatalogJanitorEnabled(false); // Turn off balancer so it doesn't cut in and mess up our placements. - this.admin.balanceSwitch(false); + this.admin.setBalancerRunning(false, true); try { // Add a bit of load up into the table so splittable. @@ -430,7 +430,7 @@ } finally { // Set this flag back. SplitRegionHandler.TEST_SKIP = false; - admin.balanceSwitch(true); + admin.setBalancerRunning(true, false); cluster.getMaster().setCatalogJanitorEnabled(true); } } @@ -464,7 +464,7 @@ int tableRegionIndex = ensureTableRegionNotOnSameServerAsMeta(admin, hri); // Turn off balancer so it doesn't cut in and mess up our placements. - this.admin.balanceSwitch(false); + this.admin.setBalancerRunning(false, true); // Turn off the meta scanner so it don't remove parent on us. cluster.getMaster().setCatalogJanitorEnabled(false); try { @@ -511,7 +511,7 @@ } finally { // Set this flag back. SplitRegionHandler.TEST_SKIP = false; - this.admin.balanceSwitch(true); + this.admin.setBalancerRunning(true, false); cluster.getMaster().setCatalogJanitorEnabled(true); } } Index: src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java (revision 1353046) +++ src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java (working copy) @@ -384,12 +384,12 @@ offlineHdfsIntegrityRepair(); // turn the balancer off - boolean oldBalancer = admin.balanceSwitch(false); + boolean oldBalancer = admin.setBalancerRunning(false, true); try { onlineConsistencyRepair(); } finally { - admin.balanceSwitch(oldBalancer); + admin.setBalancerRunning(oldBalancer, false); } // Print table summary Index: src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (revision 1353046) +++ src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (working copy) @@ -1364,13 +1364,29 @@ * Turn the load balancer on or off. * @param b If true, enable balancer. If false, disable balancer. * @return Previous balancer value + * @deprecated use setBalancerRunning(boolean, boolean) instead */ + @Deprecated public boolean balanceSwitch(final boolean b) throws MasterNotRunningException, ZooKeeperConnectionException { return getMaster().balanceSwitch(b); } /** + * Turn the load balancer on or off. + * @param on If true, enable balancer. If false, disable balancer. + * @param synchronous If true, it waits until current balance() call, if outstanding, to return. + * @return Previous balancer value + */ + public boolean setBalancerRunning(final boolean on, final boolean synchronous) + throws MasterNotRunningException, ZooKeeperConnectionException { + if (synchronous == false) { + return balanceSwitch(on); + } + return getMaster().synchronousBalanceSwitch(on); + } + + /** * Invoke the balancer. Will run the balancer and if regions to move, it will * go ahead and do the reassignments. Can NOT run for various reasons. Check * logs. Index: src/main/ruby/hbase/admin.rb =================================================================== --- src/main/ruby/hbase/admin.rb (revision 1353046) +++ src/main/ruby/hbase/admin.rb (working copy) @@ -88,7 +88,8 @@ # Enable/disable balancer # Returns previous balancer switch setting. def balance_switch(enableDisable) - @admin.balanceSwitch(java.lang.Boolean::valueOf(enableDisable)) + @admin.setBalancerRunning( + java.lang.Boolean::valueOf(enableDisable), java.lang.Boolean::valueOf(false)) end #----------------------------------------------------------------------------------------------