@Override
  protected Flow executeFromState(MasterProcedureEnv env, InitMetaState state)
    throws ProcedureSuspendedException, ProcedureYieldException, InterruptedException {
    LOG.debug("Execute {}", this);
    try {
      switch (state) {
        case INIT_META_WRITE_FS_LAYOUT:
          Configuration conf = env.getMasterConfiguration();
          Path rootDir = CommonFSUtils.getRootDir(conf);
          TableDescriptor td = writeFsLayout(rootDir, conf);
          env.getMasterServices().getTableDescriptors().update(td, true);
          setNextState(InitMetaState.INIT_META_ASSIGN_META);
          return Flow.HAS_MORE_STATE;
        case INIT_META_ASSIGN_META:
          LOG.info("Going to assign meta");
          addChildProcedure(env.getAssignmentManager()
            .createAssignProcedures(Arrays.asList(RegionInfoBuilder.FIRST_META_REGIONINFO)));
          setNextState(InitMetaState.INIT_META_CREATE_NAMESPACES);
          return Flow.HAS_MORE_STATE;
        case INIT_META_CREATE_NAMESPACES:
          LOG.info("Going to create {} and {} namespaces", DEFAULT_NAMESPACE, SYSTEM_NAMESPACE);
          createDirectory(env, DEFAULT_NAMESPACE);
          createDirectory(env, SYSTEM_NAMESPACE);
          // here the TableNamespaceManager has not been initialized yet, so we have to insert the
          // record directly into meta table, later the TableNamespaceManager will load these two
          // namespaces when starting.
          insertNamespaceToMeta(env.getMasterServices().getConnection(), DEFAULT_NAMESPACE);
          insertNamespaceToMeta(env.getMasterServices().getConnection(), SYSTEM_NAMESPACE);

          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 to init meta, suspend {}secs", backoff, e);
      setTimeout(Math.toIntExact(backoff));
      setState(ProcedureProtos.ProcedureState.WAITING_TIMEOUT);
      skipPersistence();
      throw new ProcedureSuspendedException();
    }
  }
This procedure is used to initialize meta table for a new hbase deploy. It will just schedule an
{@link TransitRegionStateProcedure} to assign meta.
hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/InitMetaProcedure.java