@TestOnly
  public void recoverForTest() {
    try (Stream<Path> pathStream = Files.walk(Paths.get(storageDir.getPath()), 1)) {
      Path[] deletionPaths =
          pathStream
              .filter(Files::isRegularFile)
              .filter(path -> path.getFileName().toString().matches(DELETION_FILE_NAME_PATTERN))
              .toArray(Path[]::new);

      for (Path path : deletionPaths) {
        try (DeletionReader deletionReader =
            new DeletionReader(path.toFile(), dataRegionId, this::removeDeletionResource)) {
          deletionReader
              .readAllDeletions()
              .forEach(
                  deletion ->
                      deleteNode2ResourcesMap.computeIfAbsent(
                          deletion.getDeleteDataNode(), key -> deletion));
        }
      }
    } catch (IOException e) {
      LOGGER.error("Failed to recover DeletionResourceManager", e);
    }
  }
This is a hook function, which will be automatically invoked when deletionResource's reference
count returns to 0.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/deletion/DeletionResourceManager.java