@Test
  public void testInnerRecoverWithIncompleteTargetFileUsingFileInfo() throws Exception {
    List<TsFileResource> sourceFiles = getSourceFiles();
    TsFileResource targetResource =
        TsFileNameGenerator.getInnerCompactionTargetFileResource(sourceFiles, true);
    SimpleCompactionLogger compactionLogger = new SimpleCompactionLogger(new File(logFilePath));
    compactionLogger.logSourceFiles(sourceFiles);
    compactionLogger.logTargetFile(targetResource);
    compactionLogger.close();
    performer.setSourceFiles(sourceFiles);
    performer.setTargetFiles(Collections.singletonList(targetResource));
    performer.setSummary(new FastCompactionTaskSummary());
    performer.perform();
    CompactionUtils.moveTargetFile(
        Collections.singletonList(targetResource),
        CompactionTaskType.INNER_SEQ,
        COMPACTION_TEST_SG);
    FileOutputStream targetStream = new FileOutputStream(targetResource.getTsFile(), true);
    FileChannel channel = targetStream.getChannel();
    channel.truncate(targetResource.getTsFile().length() - 100);
    channel.close();
    InnerSpaceCompactionTask recoverTask =
        new InnerSpaceCompactionTask(COMPACTION_TEST_SG, "0", tsFileManager, new File(logFilePath));
    recoverTask.recover();
    // all the source file should be deleted
    for (TsFileResource resource : sourceFiles) {
      Assert.assertTrue(resource.getTsFile().exists());
    }
    Assert.assertFalse(targetResource.getTsFile().exists());
  }
Test a compaction task in not finished. The compaction log use file info to record files.

@throws Exception
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/recover/SizeTieredCompactionRecoverTest.java