public TSStatus createDatabase(final DatabaseSchemaPlan plan) {
    final TSStatus result = new TSStatus();
    databaseReadWriteLock.writeLock().lock();
    try {
      // Set Database
      final TDatabaseSchema databaseSchema = plan.getSchema();
      final PartialPath partialPathName = getQualifiedDatabasePartialPath(databaseSchema.getName());

      final ConfigMTree mTree = databaseSchema.isIsTableModel() ? tableModelMTree : treeModelMTree;
      mTree.setStorageGroup(partialPathName);

      // Set DatabaseSchema
      mTree
          .getDatabaseNodeByDatabasePath(partialPathName)
          .getAsMNode()
          .setDatabaseSchema(databaseSchema);

      result.setCode(TSStatusCode.SUCCESS_STATUS.getStatusCode());
    } catch (final MetadataException e) {
      LOGGER.error(ERROR_NAME, e);
      result.setCode(e.getErrorCode()).setMessage(e.getMessage());
    } finally {
      databaseReadWriteLock.writeLock().unlock();
    }
    return result;
  }
Cache DatabaseSchema.

@param plan {@link DatabaseSchemaPlan}
@return {@link TSStatusCode#SUCCESS_STATUS} if the Database is set successfully.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java