public String increaseSnapshotReference(String snapshotPath) throws IOException {
    lock.lock();
    try {
      // If the snapshot root is already a copied snapshot, just increase and return it
      if (increaseReferenceIfExists(snapshotPath)) {
        return snapshotPath;
      }

      // Else, check if there is a related copy in pipe dir. if so, increase and return it
      final String copiedFilePath = getCopiedSnapshotPathInPipeDir(snapshotPath);
      if (increaseReferenceIfExists(copiedFilePath)) {
        return copiedFilePath;
      }

      // Otherwise, copy the snapshot to pipe dir
      RetryUtils.retryOnException(
          () -> {
            FileUtils.copyFile(new File(snapshotPath), new File(copiedFilePath));
            return null;
          });
      copiedSnapshotPath2ReferenceCountMap.put(copiedFilePath, new AtomicLong(1));
      return copiedFilePath;
    } finally {
      lock.unlock();
    }
  }
Given a snapshot path, copy it to pipe dir, maintain a reference count for the copied snapshot,
and return the copied snapshot root path.

<p>If the given file is already a copied snapshot, increase its reference count and return it.

<p>Otherwise, copy the snapshot to pipe dir, increase its reference count and return it.

@throws IOException when copy file failed
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/resource/snapshot/PipeSnapshotResourceManager.java