private static boolean checkIsTargetFilesComplete(
      List<TsFileResource> targetResources,
      List<TsFileResource> lostSourceResources,
      String fullStorageGroupName)
      throws IOException {
    for (TsFileResource targetResource : targetResources) {
      if (targetResource.isDeleted()) {
        // target resource is empty after compaction, then delete it
        targetResource.remove();
        continue;
      } else {
        // set target resources to CLOSED, so that they can be selected to compact
        targetResource.setStatus(TsFileResourceStatus.NORMAL);
      }
      if (!TsFileUtils.isTsFileComplete(targetResource.getTsFile())) {
        LOGGER.error(
            "{} [Compaction][ExceptionHandler] target file {} is not complete, "
                + "and some source files {} is lost, do nothing.",
            fullStorageGroupName,
            targetResource,
            lostSourceResources);
        return false;
      }
    }
    return true;
  }
Some source files are lost, check if all target files are complete. If all target files are
complete, delete the remaining source files and compaction mods files. If some target files are
not complete, print some error logs.

@throws IOException if the io operations on file fails
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/exception/CompactionExceptionHandler.java