@Test
  public void testTsFileValidationWithFileTimeIndex()
      throws MetadataException, IOException, WriteProcessException {
    registerTimeseriesInMManger(5, 10, true);
    createFiles(10, 10, 5, 1000, 0, 0, 100, 100, false, true);
    createFiles(1, 5, 10, 4500, 500, 500, 0, 100, false, false);
    tsFileManager.addAll(seqResources, true);
    tsFileManager.addAll(unseqResources, false);

    // set the end time of d1 in the first seq file to 1100
    tsFileManager
        .getTsFileList(true)
        .get(0)
        .updateEndTime(
            IDeviceID.Factory.DEFAULT_FACTORY.create(COMPACTION_TEST_SG + PATH_SEPARATOR + "d1"),
            1100L);

    // set the end time of d1 in the second seq file to 1200
    tsFileManager
        .getTsFileList(true)
        .get(1)
        .updateStartTime(
            IDeviceID.Factory.DEFAULT_FACTORY.create(COMPACTION_TEST_SG + PATH_SEPARATOR + "d1"),
            1200L);

    for (int i = 1; i < seqResources.size(); i++) {
      tsFileManager.getTsFileList(true).get(i).degradeTimeIndex();
    }

    // meet overlap files
    Assert.assertFalse(
        TsFileResourceUtils.validateTsFileResourcesHasNoOverlap(
            tsFileManager.getOrCreateSequenceListByTimePartition(0).getArrayList()));

    tsFileManager.getTsFileList(true).get(0).deserialize();
    tsFileManager.getTsFileList(true).get(1).deserialize();
    tsFileManager.getTsFileList(true).get(0).degradeTimeIndex();
    tsFileManager.getTsFileList(true).get(1).degradeTimeIndex();
    Assert.assertTrue(
        TsFileResourceUtils.validateTsFileResourcesHasNoOverlap(
            tsFileManager.getOrCreateSequenceListByTimePartition(0).getArrayList()));

    // seq file 4,5 and 6 are being compacted by inner space compaction
    List<TsFileResource> sourceFiles = new ArrayList<>();
    sourceFiles.add(seqResources.get(4));
    sourceFiles.add(seqResources.get(5));
    sourceFiles.add(seqResources.get(6));
    FastCompactionPerformer performer = new FastCompactionPerformer(false);
    performer.setSourceFiles(sourceFiles);
    InnerSpaceCompactionTask innerSpaceCompactionTask =
        new InnerSpaceCompactionTask(0, tsFileManager, sourceFiles, true, performer, 0);
    Assert.assertTrue(
        TsFileResourceUtils.validateTsFileResourcesHasNoOverlap(
            tsFileManager.getOrCreateSequenceListByTimePartition(0).getArrayList()));
    innerSpaceCompactionTask.start();
    validateSeqFiles(true);
  }
Validate seq files with file time index and device time index under this time partition after
compaction.
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/cross/CrossSpaceCompactionWithFastPerformerValidationTest.java