private boolean increaseReferenceIfExists(final File file) {
    final PipeTsFileResource resource =
        hardlinkOrCopiedFileToPipeTsFileResourceMap.get(file.getPath());
    if (resource != null) {
      resource.increaseAndGetReference();
      return true;
    }
    return false;
  }
Given a file, create a hardlink or copy it to pipe dir, maintain a reference count for the
hardlink or copied file, and return the hardlink or copied file.

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

<p>If the given file is a tsfile, create a hardlink in pipe dir, increase the reference count
of the hardlink and return it.

<p>Otherwise, copy the file (.mod or .resource) to pipe dir, increase the reference count of
the copied file and return it.

@param file tsfile, resource file or mod file. can be original file or hardlink/copy of
    original file
@param isTsFile {@code true} to create hardlink, {@code false} to copy file
@param tsFileResource the TsFileResource of original TsFile. Ignored if {@param isTsFile} is
    {@code false}.
@return the hardlink or copied file
@throws IOException when create hardlink or copy file failed
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/tsfile/PipeTsFileResourceManager.java