HBASE-19440 Not able to enable balancer with RSGroups once disabled

Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
Abhishek Singh Chouhan 2017-12-06 19:43:30 +05:30 committed by Andrew Purtell
parent 6c2d51132f
commit 2cab98f6be
2 changed files with 12 additions and 1 deletions

View File

@ -684,7 +684,7 @@ public class RSGroupAdminEndpoint extends RSGroupAdminService
@Override
public boolean preBalanceSwitch(ObserverContext<MasterCoprocessorEnvironment> ctx,
boolean newValue) throws IOException {
return false;
return newValue;
}
@Override

View File

@ -54,6 +54,7 @@ import java.io.IOException;
import java.util.Iterator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@ -278,6 +279,16 @@ public class TestRSGroups extends TestRSGroupsBase {
});
}
@Test
public void testRSGroupBalancerSwitch() throws IOException {
//Balancer is initially off in the test, set to true and check
assertFalse(admin.setBalancerRunning(true, true));
assertTrue(admin.isBalancerEnabled());
//Set balancer off and check if it actually turned off
assertTrue(admin.setBalancerRunning(false,true));
assertFalse(admin.isBalancerEnabled());
}
@Test
public void testCloneSnapshot() throws Exception {
final TableName tableName = TableName.valueOf(tablePrefix+"_testCloneSnapshot");