public TSStatus adjustMaxRegionGroupCount(final AdjustMaxRegionGroupNumPlan plan) {
    final TSStatus result = new TSStatus();
    databaseReadWriteLock.writeLock().lock();
    try {
      for (final Map.Entry<String, Pair<Integer, Integer>> entry :
          plan.getMaxRegionGroupNumMap().entrySet()) {
        final TDatabaseSchema databaseSchema =
            (PathUtils.isTableModelDatabase(entry.getKey()) ? tableModelMTree : treeModelMTree)
                .getDatabaseNodeByDatabasePath(getQualifiedDatabasePartialPath(entry.getKey()))
                .getAsMNode()
                .getDatabaseSchema();
        databaseSchema.setMaxSchemaRegionGroupNum(entry.getValue().getLeft());
        databaseSchema.setMaxDataRegionGroupNum(entry.getValue().getRight());
      }
      result.setCode(TSStatusCode.SUCCESS_STATUS.getStatusCode());
    } catch (final MetadataException e) {
      LOGGER.info(
          "Database inconsistency detected when adjusting max region group count, message: {}, will be corrected by the following adjusting plans",
          e.getMessage());
      result.setCode(e.getErrorCode()).setMessage(e.getMessage());
    } finally {
      databaseReadWriteLock.writeLock().unlock();
    }
    return result;
  }
Adjust the maximum RegionGroup count of each Database.

@param plan AdjustMaxRegionGroupCountPlan
@return {@link TSStatusCode#SUCCESS_STATUS}
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java