@Override
  public synchronized boolean createSnapshot(final File snapshotDir) {
    if (!initialized) {
      logger.warn(
          "Failed to create snapshot of schemaRegion {}, because the schemaRegion has not been initialized.",
          schemaRegionId);
      return false;
    }
    logger.info("Start create snapshot of schemaRegion {}", schemaRegionId);
    boolean isSuccess;
    boolean currentResult;
    final long startTime = System.currentTimeMillis();

    long snapshotStartTime = System.currentTimeMillis();
    isSuccess = mTree.createSnapshot(snapshotDir);
    logger.info(
        "MTree snapshot creation of schemaRegion {} costs {}ms. Status: {}",
        schemaRegionId,
        System.currentTimeMillis() - snapshotStartTime,
        isSuccess);

    snapshotStartTime = System.currentTimeMillis();
    currentResult = tagManager.createSnapshot(snapshotDir);
    isSuccess = isSuccess && currentResult;
    logger.info(
        "Tag snapshot creation of schemaRegion {} costs {}ms. Status: {}",
        schemaRegionId,
        System.currentTimeMillis() - snapshotStartTime,
        currentResult);

    snapshotStartTime = System.currentTimeMillis();
    currentResult = deviceAttributeStore.createSnapshot(snapshotDir);
    isSuccess = isSuccess && currentResult;
    logger.info(
        "Device attribute snapshot creation of schemaRegion {} costs {}ms. Status: {}",
        schemaRegionId,
        System.currentTimeMillis() - snapshotStartTime,
        currentResult);

    snapshotStartTime = System.currentTimeMillis();
    currentResult = deviceAttributeCacheUpdater.createSnapshot(snapshotDir);
    isSuccess = isSuccess && currentResult;
    logger.info(
        "Device attribute remote updater snapshot creation of schemaRegion {} costs {}ms. Status: {}",
        schemaRegionId,
        System.currentTimeMillis() - snapshotStartTime,
        currentResult);

    logger.info(
        "Snapshot creation of schemaRegion {} costs {}ms.",
        schemaRegionId,
        System.currentTimeMillis() - startTime);

    if (isSuccess) {
      logger.info("Successfully create snapshot of schemaRegion {}", schemaRegionId);
    }

    return isSuccess;
  }
function for clearing metadata components of one schema region
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java