private String getCopiedSnapshotPathInPipeDir(String snapshotPath) throws IOException {
    File parentFile = new File(snapshotPath);
    // Recursively find the parent path until meets the pipe snapshot dir
    while (!pipeCopiedSnapshotDirs.contains(parentFile.getName())) {
      if (parentFile.getParentFile() == null) {
        LOGGER.warn("Cannot find correct target snapshot path in pipe dir for {}", snapshotPath);
        throw new IOException(
            "Cannot find correct target snapshot path in pipe dir for " + snapshotPath);
      }
      parentFile = parentFile.getParentFile();
    }
    // Insert the pipe snapshot dir name into "consensus" and group id to identify the different
    // snapshots. A typical ratis snapshot path may be like
    // data/confignode/consensus/47474747-4747-4747-4747-000000000000/sm/2_58/system/users/root.profile
    // Then the copied pipe snapshot path is like
    // data/confignode/consensus/pipe_snapshot/47474747-4747-4747-4747-000000000000/sm/2_58/system/users/root.profile
    return parentFile.getPath()
        + File.separator
        + PIPE_SNAPSHOT_DIR_NAME
        + snapshotPath.replace(parentFile.getPath(), "");
  }
Find the target path of snapshot in pipe dir, by recursively getting parent dir until target
dir is found. On ConfigNode, the copied snapshot will be in "consensus/pipe_snapshot", while on
DataNode they will be in "consensus/pipe_snapshot", "data/pipe_snapshot",
"system/pipe_snapshot".

@param snapshotPath Original snapshot path
@return Target snapshot path in pipe dir
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/resource/snapshot/PipeSnapshotResourceManager.java