public static void writeTsFile(
      Set<String> fullPaths,
      List<List<Long>> chunkPagePointsNum,
      long startTime,
      TsFileResource newTsFileResource,
      TSEncoding encoding,
      CompressionType compressionType)
      throws IOException, IllegalPathException {
    // disable auto page seal and seal page manually
    int prevMaxNumberOfPointsInPage =
        TSFileDescriptor.getInstance().getConfig().getMaxNumberOfPointsInPage();
    TSFileDescriptor.getInstance().getConfig().setMaxNumberOfPointsInPage(Integer.MAX_VALUE);

    if (!newTsFileResource.getTsFile().getParentFile().exists()) {
      newTsFileResource.getTsFile().getParentFile().mkdirs();
    }
    RestorableTsFileIOWriter writer = new RestorableTsFileIOWriter(newTsFileResource.getTsFile());
    Map<IDeviceID, List<String>> deviceMeasurementMap = new HashMap<>();
    for (String fullPath : fullPaths) {
      PartialPath partialPath = new PartialPath(fullPath);
      List<String> sensors =
          deviceMeasurementMap.computeIfAbsent(
              partialPath.getIDeviceID(), (s) -> new ArrayList<>());
      sensors.add(partialPath.getMeasurement());
    }
    for (Entry<IDeviceID, List<String>> deviceMeasurementEntry : deviceMeasurementMap.entrySet()) {
      IDeviceID device = deviceMeasurementEntry.getKey();
      writer.startChunkGroup(device);
      for (String sensor : deviceMeasurementEntry.getValue()) {
        long currTime = startTime;
        for (List<Long> chunk : chunkPagePointsNum) {
          ChunkWriterImpl chunkWriter =
              new ChunkWriterImpl(
                  new MeasurementSchema(sensor, TSDataType.INT64, encoding, compressionType), true);
          for (Long page : chunk) {
            for (long i = 0; i < page; i++) {
              chunkWriter.write(currTime, random.nextLong());
              newTsFileResource.updateStartTime(device, currTime);
              newTsFileResource.updateEndTime(device, currTime);
              currTime++;
            }
            chunkWriter.sealCurrentPage();
          }
          chunkWriter.writeToFileWriter(writer);
        }
      }
      writer.endChunkGroup();
    }
    newTsFileResource.serialize();
    writer.endFile();
    newTsFileResource.close();

    TSFileDescriptor.getInstance()
        .getConfig()
        .setMaxNumberOfPointsInPage(prevMaxNumberOfPointsInPage);
  }
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