public static void generateMods(
      Map<String, Pair<Long, Long>> toDeleteTimeseriesAndTime,
      TsFileResource targetTsFileResource,
      boolean isCompactionMods)
      throws IllegalPathException, IOException {
    ModificationFile modificationFile;
    if (isCompactionMods) {
      modificationFile = targetTsFileResource.getCompactionModFile();
    } else {
      modificationFile = targetTsFileResource.getModFileForWrite();
    }
    for (Entry<String, Pair<Long, Long>> toDeleteTimeseriesAndTimeEntry :
        toDeleteTimeseriesAndTime.entrySet()) {
      String fullPath = toDeleteTimeseriesAndTimeEntry.getKey();
      Pair<Long, Long> startTimeEndTime = toDeleteTimeseriesAndTimeEntry.getValue();
      ModEntry deletion =
          new TreeDeletionEntry(
              new MeasurementPath(fullPath), startTimeEndTime.left, startTimeEndTime.right);
      modificationFile.write(deletion);
    }
    modificationFile.close();
  }
Generate mods files according to toDeleteTimeseriesAndTime for corresponding
targetTsFileResource

@param toDeleteTimeseriesAndTime The timeseries and time to be deleted, Map(fullPath,
    (startTime, endTime))
@param targetTsFileResource The tsfile to be deleted
@param isCompactionMods Generate *.compaction. or generate .compaction.mods
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/compaction/utils/CompactionFileGeneratorUtils.java