private static File getHardlinkInPipeWALDir(final File file) throws IOException {
    try {
      return new File(getPipeWALDirPath(file), getRelativeFilePath(file));
    } catch (final Exception e) {
      throw new IOException(
          String.format(
              "failed to get hardlink in pipe dir " + "for file %s, it is not a wal",
              file.getPath()),
          e);
    }
  }
given a file, create a hardlink, maintain a reference count for the hardlink, and return the
hardlink.

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

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

@param file wal file. can be original file or the hardlink of original file
@return the hardlink
@throws IOException when create hardlink failed
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/wal/hardlink/PipeWALHardlinkResourceManager.java