HBASE-24591 get_table_rsgroup ignored the existence of rsgroup config for namespace (#1925)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
XinSun 2020-06-21 17:54:39 +08:00 committed by GitHub
parent f22c7a6583
commit dfaba965c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 7 deletions

View File

@ -2982,13 +2982,9 @@ public class MasterRpcServices extends RSRpcServices implements
if (td == null) {
resp = GetRSGroupInfoOfTableResponse.getDefaultInstance();
} else {
RSGroupInfo rsGroupInfo = null;
if (td.getRegionServerGroup().isPresent()) {
rsGroupInfo = master.getRSGroupInfoManager().getRSGroup(td.getRegionServerGroup().get());
}
if (rsGroupInfo == null) {
rsGroupInfo = master.getRSGroupInfoManager().getRSGroup(RSGroupInfo.DEFAULT_GROUP);
}
RSGroupInfo rsGroupInfo =
RSGroupUtil.getRSGroupInfo(master, master.getRSGroupInfoManager(), tableName)
.orElse(master.getRSGroupInfoManager().getRSGroup(RSGroupInfo.DEFAULT_GROUP));
resp = GetRSGroupInfoOfTableResponse.newBuilder()
.setRSGroupInfo(ProtobufUtil.toProtoGroupInfo(rsGroupInfo)).build();
}

View File

@ -179,6 +179,28 @@ public class TestRSGroupsAdmin1 extends TestRSGroupsBase {
}
}
@Test
public void testNamespaceConstraint2() throws Exception {
String nsName = TABLE_PREFIX + name.getMethodName();
String groupName = TABLE_PREFIX + name.getMethodName();
TableName tableName = TableName.valueOf(nsName, name.getMethodName());
addGroup(groupName, 1);
ADMIN.createNamespace(NamespaceDescriptor.create(nsName)
.addConfiguration(RSGroupInfo.NAMESPACE_DESC_PROP_GROUP, groupName).build());
TEST_UTIL.createTable(tableName, "C");
TEST_UTIL.waitTableAvailable(tableName);
RSGroupInfo rsGroup = ADMIN.getRSGroup(tableName);
assertEquals(groupName, rsGroup.getName());
TEST_UTIL.deleteTable(tableName);
ADMIN.deleteNamespace(nsName);
ADMIN.moveServersToRSGroup(rsGroup.getServers(), RSGroupInfo.DEFAULT_GROUP);
ADMIN.removeRSGroup(groupName);
}
@Test
public void testFailRemoveGroup() throws IOException, InterruptedException {
int initNumGroups = ADMIN.listRSGroups().size();