public void processMTreeLoadSnapshot(
      final File snapshotDir,
      final String snapshotFileName,
      final SerDeFunction<InputStream> function)
      throws IOException {
    final File snapshotFile = new File(snapshotDir, snapshotFileName);
    if (!snapshotFile.exists() || !snapshotFile.isFile()) {
      LOGGER.error(
          "Failed to load snapshot,snapshot file [{}] is not exist.",
          snapshotFile.getAbsolutePath());
      return;
    }
    databaseReadWriteLock.writeLock().lock();
    try (final FileInputStream fileInputStream = new FileInputStream(snapshotFile);
        final BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream)) {
      // Load snapshot of MTree
      function.apply(bufferedInputStream);
    } finally {
      databaseReadWriteLock.writeLock().unlock();
    }
  }
Only leader use this interface. Get the maxRegionGroupNum of specified Database.

@param database DatabaseName
@param consensusGroupType SchemaRegion or DataRegion
@return maxSchemaRegionGroupNum or maxDataRegionGroupNum
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java