private int compareFileProgressIndex(Path file1, Path file2) {
    Pattern pattern = Pattern.compile(DELETION_FILE_NAME_PATTERN);
    String fileName1 = file1.getFileName().toString();
    String fileName2 = file2.getFileName().toString();
    Matcher matcher1 = pattern.matcher(fileName1);
    Matcher matcher2 = pattern.matcher(fileName2);
    // Definitely match. Because upper caller has filtered fileNames.
    if (matcher1.matches() && matcher2.matches()) {
      int fileRebootTimes1 = Integer.parseInt(matcher1.group(REBOOT_TIME));
      long fileMemTableFlushOrderId1 = Long.parseLong(matcher1.group(MEM_TABLE_FLUSH_ORDER));

      int fileRebootTimes2 = Integer.parseInt(matcher2.group(REBOOT_TIME));
      long fileMemTableFlushOrderId2 = Long.parseLong(matcher2.group(MEM_TABLE_FLUSH_ORDER));

      int rebootCompareRes = Integer.compare(fileRebootTimes1, fileRebootTimes2);
      return rebootCompareRes == 0
          ? Long.compare(fileMemTableFlushOrderId1, fileMemTableFlushOrderId2)
          : rebootCompareRes;
    }
    return 0;
  }
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