@Override
  protected Flow executeFromState(MasterProcedureEnv env, MigrateNamespaceTableProcedureState state)
    throws ProcedureSuspendedException, ProcedureYieldException, InterruptedException {
    try {
      switch (state) {
        case MIGRATE_NAMESPACE_TABLE_ADD_FAMILY:
          TableDescriptor metaTableDesc =
            env.getMasterServices().getTableDescriptors().get(TableName.META_TABLE_NAME);
          if (!metaTableDesc.hasColumnFamily(HConstants.NAMESPACE_FAMILY)) {
            TableDescriptor newMetaTableDesc = TableDescriptorBuilder.newBuilder(metaTableDesc)
              .setColumnFamily(
                FSTableDescriptors.getNamespaceFamilyDescForMeta(env.getMasterConfiguration()))
              .build();
            addChildProcedure(new ModifyTableProcedure(env, newMetaTableDesc));
          }
          setNextState(MigrateNamespaceTableProcedureState.MIGRATE_NAMESPACE_TABLE_MIGRATE_DATA);
          return Flow.HAS_MORE_STATE;
        case MIGRATE_NAMESPACE_TABLE_MIGRATE_DATA:
          migrate(env);
          setNextState(MigrateNamespaceTableProcedureState.MIGRATE_NAMESPACE_TABLE_DISABLE_TABLE);
          return Flow.HAS_MORE_STATE;
        case MIGRATE_NAMESPACE_TABLE_DISABLE_TABLE:
          addChildProcedure(new DisableTableProcedure(env, TableName.NAMESPACE_TABLE_NAME, false));
          return Flow.NO_MORE_STATE;
        default:
          throw new UnsupportedOperationException("Unhandled state=" + state);
      }
    } catch (IOException e) {
      if (retryCounter == null) {
        retryCounter = ProcedureUtil.createRetryCounter(env.getMasterConfiguration());
      }
      long backoff = retryCounter.getBackoffTimeAndIncrementAttempts();
      LOG.warn("Failed migrating namespace data, suspend {}secs {}", backoff / 1000, this, e);
      throw suspend(Math.toIntExact(backoff), true);
    }
  }
Migrate the namespace data to meta table's namespace family while upgrading
hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MigrateNamespaceTableProcedure.java