public static boolean clearSnapshotOfDataRegion(DataRegion dataRegion) {
    String[] dataDirs = IoTDBDescriptor.getInstance().getConfig().getDataDirs();
    boolean allSuccess = true;
    for (String dataDir : dataDirs) {
      StringBuilder pathBuilder = new StringBuilder(dataDir);
      pathBuilder.append(File.separator).append(IoTDBConstant.SNAPSHOT_FOLDER_NAME);
      pathBuilder.append(File.separator).append(dataRegion.getDatabaseName());
      pathBuilder.append(IoTDBConstant.FILE_NAME_SEPARATOR).append(dataRegion.getDataRegionId());
      try {
        String path = pathBuilder.toString();
        if (new File(path).exists()) {
          FileUtils.recursivelyDeleteFolder(path);
        }
      } catch (IOException e) {
        allSuccess = false;
        LOGGER.warn(
            "Clear snapshot dir fail, you should manually delete this dir before do region migration again: {}",
            pathBuilder,
            e);
      }
    }
    return allSuccess;
  }
SnapshotTaker takes data snapshot for a DataRegion in one time. It does so by creating hard link
for files or copying them. SnapshotTaker supports two different ways of snapshot: Full Snapshot
and Incremental Snapshot. The former takes a snapshot for all files in an empty directory, and
the latter takes a snapshot based on the snapshot that took before.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/snapshot/SnapshotTaker.java