public DatabaseSchemaResp getMatchedDatabaseSchemas(final GetDatabasePlan plan) {
    final DatabaseSchemaResp result = new DatabaseSchemaResp();
    databaseReadWriteLock.readLock().lock();
    try {
      final Map<String, TDatabaseSchema> schemaMap = new HashMap<>();
      final PartialPath patternPath = new PartialPath(plan.getDatabasePattern());
      final ConfigMTree mTree = plan.isTableModel() ? tableModelMTree : treeModelMTree;
      final List<PartialPath> matchedPaths =
          mTree.getMatchedDatabases(patternPath, plan.getScope(), false);
      for (final PartialPath path : matchedPaths) {
        final TDatabaseSchema schema =
            mTree.getDatabaseNodeByDatabasePath(path).getAsMNode().getDatabaseSchema();
        schemaMap.put(schema.getName(), schema);
      }
      result.setSchemaMap(schemaMap);
      result.setStatus(new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()));
    } catch (final MetadataException e) {
      LOGGER.error(ERROR_NAME, e);
      result.setStatus(
          new TSStatus(TSStatusCode.DATABASE_NOT_EXIST.getStatusCode())
              .setMessage(ERROR_NAME + ": " + e.getMessage()));
    } finally {
      databaseReadWriteLock.readLock().unlock();
    }
    return result;
  }
@return All DatabaseSchemas that matches to the specified Database pattern
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java