public static void combineModsInCrossCompaction(
      List<TsFileResource> seqResources,
      List<TsFileResource> unseqResources,
      List<TsFileResource> targetResources)
      throws IOException {
    if (TsFileResource.useSharedModFile) {
      // when using the shared mod file, modifications generated during compaction will be
      // directly written into shared mod file, so there is no need to concern the sources
      return;
    }

    Set<ModEntry> modifications = new HashSet<>();
    // get compaction mods from all source unseq files
    for (TsFileResource unseqFile : unseqResources) {
      modifications.addAll(ModificationFile.readAllCompactionModifications(unseqFile.getTsFile()));
    }

    // write target mods file
    for (int i = 0; i < targetResources.size(); i++) {
      TsFileResource targetResource = targetResources.get(i);
      if (targetResource == null) {
        continue;
      }
      Set<ModEntry> seqModifications =
          new HashSet<>(
              ModificationFile.readAllCompactionModifications(seqResources.get(i).getTsFile()));
      modifications.addAll(seqModifications);
      updateOneTargetMods(targetResource, modifications);
      modifications.removeAll(seqModifications);
    }
  }
Collect all the compaction modification files of source files, and combines them as the
modification file of target file.

@throws IOException if io errors occurred
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/CompactionUtils.java