protected void handleException(Logger logger, Exception e) {
    if (e instanceof CompactionLastTimeCheckFailedException
        || e instanceof CompactionValidationFailedException) {
      logger.error(
          "{}-{} [Compaction] {} task meets error: {}.",
          storageGroupName,
          dataRegionId,
          getCompactionTaskType(),
          e.getMessage());
      List<TsFileResource> unsortedTsFileResources = new ArrayList<>();
      if (e instanceof CompactionLastTimeCheckFailedException) {
        unsortedTsFileResources.addAll(getAllSourceTsFiles());
      } else {
        CompactionValidationFailedException validationException =
            (CompactionValidationFailedException) e;
        List<TsFileResource> overlappedTsFileResource =
            validationException.getOverlappedTsFileResources();
        unsortedTsFileResources =
            overlappedTsFileResource == null ? unsortedTsFileResources : overlappedTsFileResource;
      }
      // these exceptions generally caused by unsorted data, mark all source files as NEED_TO_REPAIR
      for (TsFileResource resource : unsortedTsFileResources) {
        if (resource.getTsFileRepairStatus() != TsFileRepairStatus.CAN_NOT_REPAIR) {
          resource.setTsFileRepairStatus(TsFileRepairStatus.NEED_TO_CHECK);
        }
      }
    } else if (e instanceof InterruptedException
        || Thread.interrupted()
        || e instanceof StopReadTsFileByInterruptException
        || !tsFileManager.isAllowCompaction()) {
      logger.warn(
          "{}-{} [Compaction] {} task interrupted",
          storageGroupName,
          dataRegionId,
          getCompactionTaskType());
      Thread.currentThread().interrupt();
    } else {
      logger.error(
          "{}-{} [Compaction] {} task meets error: {}.",
          storageGroupName,
          dataRegionId,
          getCompactionTaskType(),
          e);
    }
  }
This method will try to set the files to COMPACTION_CANDIDATE. If failed, it should roll back
all status to original value

@return set status successfully or not
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/task/AbstractCompactionTask.java