HBASE-19088 move_tables_rsgroup will throw an exception when the table is disabled
Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
parent
46408e021d
commit
dc127df077
|
@ -406,6 +406,10 @@ public class RSGroupAdminServer implements RSGroupAdmin {
|
||||||
// action is required.
|
// action is required.
|
||||||
if (targetGroup != null) {
|
if (targetGroup != null) {
|
||||||
for (TableName table: tables) {
|
for (TableName table: tables) {
|
||||||
|
if (master.getAssignmentManager().isTableDisabled(table)) {
|
||||||
|
LOG.debug("Skipping move regions because the table" + table + " is disabled.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
for (RegionInfo region :
|
for (RegionInfo region :
|
||||||
master.getAssignmentManager().getRegionStates().getRegionsOfTable(table)) {
|
master.getAssignmentManager().getRegionStates().getRegionsOfTable(table)) {
|
||||||
LOG.info("Moving region " + region.getShortNameToLog() +
|
LOG.info("Moving region " + region.getShortNameToLog() +
|
||||||
|
|
|
@ -708,6 +708,39 @@ public abstract class TestRSGroupsBase {
|
||||||
assertTrue(newGroupTables.contains(tableNameB));
|
assertTrue(newGroupTables.contains(tableNameB));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDisabledTableMove() throws Exception {
|
||||||
|
final byte[] familyNameBytes = Bytes.toBytes("f");
|
||||||
|
String newGroupName = getGroupName(name.getMethodName());
|
||||||
|
final RSGroupInfo newGroup = addGroup(newGroupName, 2);
|
||||||
|
|
||||||
|
TEST_UTIL.createMultiRegionTable(tableName, familyNameBytes, 5);
|
||||||
|
TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() {
|
||||||
|
@Override
|
||||||
|
public boolean evaluate() throws Exception {
|
||||||
|
List<String> regions = getTableRegionMap().get(tableName);
|
||||||
|
if (regions == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return getTableRegionMap().get(tableName).size() >= 5;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
RSGroupInfo tableGrp = rsGroupAdmin.getRSGroupInfoOfTable(tableName);
|
||||||
|
assertTrue(tableGrp.getName().equals(RSGroupInfo.DEFAULT_GROUP));
|
||||||
|
|
||||||
|
//test disable table
|
||||||
|
admin.disableTable(tableName);
|
||||||
|
|
||||||
|
//change table's group
|
||||||
|
LOG.info("Moving table "+ tableName + " to " + newGroup.getName());
|
||||||
|
rsGroupAdmin.moveTables(Sets.newHashSet(tableName), newGroup.getName());
|
||||||
|
|
||||||
|
//verify group change
|
||||||
|
Assert.assertEquals(newGroup.getName(),
|
||||||
|
rsGroupAdmin.getRSGroupInfoOfTable(tableName).getName());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMoveServersAndTables() throws Exception {
|
public void testMoveServersAndTables() throws Exception {
|
||||||
LOG.info("testMoveServersAndTables");
|
LOG.info("testMoveServersAndTables");
|
||||||
|
|
Loading…
Reference in New Issue