@Override
  protected Optional<TableDescriptor> modify(MasterProcedureEnv env, TableDescriptor current)
    throws IOException {
    if (current.getRegionServerGroup().isPresent()) {
      // usually this means user has set the rs group using the new code which will set the group
      // directly on table descriptor, skip.
      LOG.debug("Skip migrating {} since it is already in group {}", current.getTableName(),
        current.getRegionServerGroup().get());
      return Optional.empty();
    }
    RSGroupInfo group =
      env.getMasterServices().getRSGroupInfoManager().getRSGroupForTable(current.getTableName());
    if (group == null) {
      LOG.debug("RSGroup for table {} is empty when migrating, usually this should not happen"
        + " unless we have removed the RSGroup, ignore...", current.getTableName());
      return Optional.empty();
    }
    return Optional
      .of(TableDescriptorBuilder.newBuilder(current).setRegionServerGroup(group.getName()).build());
  }
Procedure for migrating rs group information to table descriptor.
hbase-server/src/main/java/org/apache/hadoop/hbase/rsgroup/MigrateRSGroupProcedure.java