@SuppressWarnings("squid:S2445")
  protected void flushNonAlignedChunkToFileWriter(
      CompactionTsFileWriter targetWriter, Chunk chunk, ChunkMetadata chunkMetadata, int subTaskId)
      throws IOException {
    synchronized (targetWriter) {
      // seal last chunk to file writer
      targetWriter.writeChunk(chunkWriters[subTaskId]);
      chunkPointNumArray[subTaskId] = 0;
      targetWriter.writeChunk(chunk, chunkMetadata);
    }
  }
Update startTime and endTime of the current device in each target resources, and check whether
to flush chunk metadatas or not.

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