public void addOrUpdateNamespace(NamespaceDescriptor ns) throws IOException {
    checkMigrationDone();
    insertNamespaceToMeta(masterServices.getConnection(), ns);
    cache.put(ns.getName(), ns);
  }
check whether a namespace has already existed.
hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableNamespaceManager.java