Apache9 commented on a change in pull request #1550:
URL: https://github.com/apache/hbase/pull/1550#discussion_r414399827
##########
File path:
hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminEndpoint.java
##########
@@ -535,17 +476,22 @@ public void preCreateTableAction(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
final TableDescriptor desc,
final RegionInfo[] regions) throws IOException {
- if (!desc.getTableName().isSystemTable() &&
!rsgroupHasServersOnline(desc)) {
- throw new HBaseIOException("No online servers in the rsgroup, which
table " +
- desc.getTableName().getNameAsString() + " belongs to");
+ if (desc.getTableName().isSystemTable()) {
+ return;
+ }
+ RSGroupInfo rsGroupInfo =
groupInfoManager.determineRSGroupInfoForTable(desc.getTableName());
+ if (rsGroupInfo == null) {
+ throw new ConstraintException("Default RSGroup for this table " +
desc.getTableName()
+ + " does not exist.");
+ }
+ if (!RSGroupUtil.rsGroupHasOnlineServer(master, rsGroupInfo)) {
+ throw new HBaseIOException("No online servers in the rsgroup " +
rsGroupInfo.getName()
+ + " which table " + desc.getTableName().getNameAsString() + " belongs
to");
+ }
+ synchronized (groupInfoManager) {
+ groupInfoManager.moveTables(
+ Collections.singleton(desc.getTableName()), rsGroupInfo.getName());
}
- }
-
- // Assign table to default RSGroup.
- @Override
- public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment>
ctx,
Review comment:
Got it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]