public static void insertNamespaceToMeta(Connection conn, NamespaceDescriptor ns)
    throws IOException {
    byte[] row = Bytes.toBytes(ns.getName());
    Put put = new Put(row, true).addColumn(HConstants.NAMESPACE_FAMILY,
      HConstants.NAMESPACE_COL_DESC_QUALIFIER,
      ProtobufUtil.toProtoNamespaceDescriptor(ns).toByteArray());
    try (Table table = conn.getTable(TableName.META_TABLE_NAME)) {
      table.put(put);
    }
  }
check whether a namespace has already existed.
hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableNamespaceManager.java