@Override
  public void loadSnapshot(final File latestSnapshotRootDir) {
    clear();

    logger.info("Start loading snapshot of schemaRegion {}", schemaRegionId);
    final long startTime = System.currentTimeMillis();

    try {
      usingMLog = false;

      isRecovering = true;

      long snapshotStartTime = System.currentTimeMillis();
      deviceAttributeStore = new DeviceAttributeStore(regionStatistics);
      deviceAttributeStore.loadFromSnapshot(latestSnapshotRootDir);
      logger.info(
          "Device attribute snapshot loading of schemaRegion {} costs {}ms.",
          schemaRegionId,
          System.currentTimeMillis() - snapshotStartTime);

      snapshotStartTime = System.currentTimeMillis();
      deviceAttributeCacheUpdater =
          new DeviceAttributeCacheUpdater(regionStatistics, databaseFullPath);
      deviceAttributeCacheUpdater.loadFromSnapshot(latestSnapshotRootDir);
      logger.info(
          "Device attribute remote updater snapshot loading of schemaRegion {} costs {}ms.",
          schemaRegionId,
          System.currentTimeMillis() - snapshotStartTime);

      snapshotStartTime = System.currentTimeMillis();
      tagManager =
          TagManager.loadFromSnapshot(latestSnapshotRootDir, schemaRegionDirPath, regionStatistics);
      logger.info(
          "Tag snapshot loading of schemaRegion {} costs {}ms.",
          schemaRegionId,
          System.currentTimeMillis() - snapshotStartTime);

      snapshotStartTime = System.currentTimeMillis();
      mTree =
          MTreeBelowSGMemoryImpl.loadFromSnapshot(
              latestSnapshotRootDir,
              databaseFullPath,
              regionStatistics,
              metric,
              measurementMNode -> {
                if (measurementMNode.isLogicalView()) {
                  regionStatistics.addView(1L);
                } else {
                  regionStatistics.addMeasurement(1L);
                }
                if (measurementMNode.getOffset() == -1) {
                  return;
                }
                try {
                  tagManager.recoverIndex(measurementMNode.getOffset(), measurementMNode);
                } catch (final IOException e) {
                  logger.error(
                      "Failed to recover tagIndex for {} in schemaRegion {}.",
                      databaseFullPath + PATH_SEPARATOR + measurementMNode.getFullPath(),
                      schemaRegionId);
                }
              },
              deviceMNode -> {
                regionStatistics.addDevice();
                if (deviceMNode.getSchemaTemplateIdWithState() >= 0) {
                  regionStatistics.activateTemplate(deviceMNode.getSchemaTemplateId());
                }
              },
              (tableDeviceMode, tableName) -> {
                regionStatistics.addTableDevice(tableName);
                regionStatistics.addTableAttributeMemory(
                    tableName,
                    deviceAttributeStore
                        .getAttributes(
                            ((TableDeviceInfo<?>) tableDeviceMode.getDeviceInfo())
                                .getAttributePointer())
                        .values()
                        .stream()
                        .map(UpdateDetailContainer::sizeOf)
                        .reduce(0L, Long::sum));
              },
              tagManager::readTags,
              tagManager::readAttributes);
      logger.info(
          "MTree snapshot loading of schemaRegion {} costs {}ms.",
          schemaRegionId,
          System.currentTimeMillis() - snapshotStartTime);

      isRecovering = false;
      initialized = true;

      logger.info(
          "Snapshot loading of schemaRegion {} costs {}ms.",
          schemaRegionId,
          System.currentTimeMillis() - startTime);
      logger.info("Successfully load snapshot of schemaRegion {}", schemaRegionId);
    } catch (final Exception e) {
      logger.error(
          "Failed to load snapshot for schemaRegion {}  due to {}. Use empty schemaRegion",
          schemaRegionId,
          e.getMessage(),
          e);
      try {
        initialized = false;
        isRecovering = true;
        init();
      } catch (final Exception exception) {
        logger.error(
            "Error occurred during initializing schemaRegion {}", schemaRegionId, exception);
      }
    }
  }
function for clearing metadata components of one schema region
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/impl/SchemaRegionMemoryImpl.java