private boolean prepareDelete(final MasterProcedureEnv env) throws IOException {
    if (getTableNamespaceManager(env).doesNamespaceExist(namespaceName) == false) {
      setFailure("master-delete-namespace", new NamespaceNotFoundException(namespaceName));
      return false;
    }
    if (NamespaceDescriptor.RESERVED_NAMESPACES.contains(namespaceName)) {
      setFailure("master-delete-namespace",
        new ConstraintException("Reserved namespace " + namespaceName + " cannot be removed."));
      return false;
    }

    int tableCount = 0;
    try {
      tableCount = env.getMasterServices().listTableDescriptorsByNamespace(namespaceName).size();
    } catch (FileNotFoundException fnfe) {
      setFailure("master-delete-namespace", new NamespaceNotFoundException(namespaceName));
      return false;
    }
    if (tableCount > 0) {
      setFailure("master-delete-namespace",
        new ConstraintException("Only empty namespaces can be removed. Namespace " + namespaceName
          + " has " + tableCount + " tables"));
      return false;
    }

    // This is used for rollback
    nsDescriptor = getTableNamespaceManager(env).get(namespaceName);
    return true;
  }
Action before any real action of deleting namespace.
@param env MasterProcedureEnv
hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DeleteNamespaceProcedure.java