private boolean deleteFile(TsFileIdentifier tsFileIdentifier) {
    boolean success = true;
    // delete tsfile
    File tsFile = tsFileIdentifier.getFileFromDataDirs();
    if (!checkAndDeleteFile(tsFile)) {
      success = false;
    }

    // delete resource file
    File resourceFile =
        getFileFromDataDirs(tsFileIdentifier.getFilePath() + TsFileResource.RESOURCE_SUFFIX);
    if (!checkAndDeleteFile(resourceFile)) {
      success = false;
    }

    // delete mods file
    File exclusiveModFile =
        getFileFromDataDirs(
            ModificationFile.getExclusiveMods(new File(tsFileIdentifier.getFilePath())).getPath());
    if (!checkAndDeleteFile(exclusiveModFile)) {
      success = false;
    }

    // delete compaction mods file
    File compactionModFile =
        getFileFromDataDirs(
            ModificationFile.getCompactionMods(new File(tsFileIdentifier.getFilePath())).getPath());
    if (!checkAndDeleteFile(compactionModFile)) {
      success = false;
    }

    File oldModFile =
        getFileFromDataDirs(
            ModificationFileV1.getNormalMods(new File(tsFileIdentifier.getFilePath())).getPath());
    if (!checkAndDeleteFile(oldModFile)) {
      success = false;
    }

    File oldCompactionModFile =
        getFileFromDataDirs(
            ModificationFileV1.getCompactionMods(new File(tsFileIdentifier.getFilePath()))
                .getPath());
    if (!checkAndDeleteFile(oldCompactionModFile)) {
      success = false;
    }

    return success;
  }
Delete tsfile and its corresponding files, including resource file, mods file and compaction
mods file. Return true if the file is not existed or if the file is existed and has been
deleted correctly. Otherwise, return false.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/recover/CompactionRecoverTask.java