Class SegmentPartitionFileWriter
java.lang.Object
org.apache.flink.runtime.io.network.partition.hybrid.tiered.file.SegmentPartitionFileWriter
- All Implemented Interfaces:
PartitionFileWriter
The implementation of
PartitionFileWriter with segment file mode. In this mode, each
segment of one subpartition is written to an independent file.
After finishing writing a segment, a segment-finish file is written to ensure the downstream reads only when the entire segment file is written, avoiding partial data reads. The downstream can determine if the current segment is complete by checking for the existence of the segment-finish file.
To minimize the number of files, each subpartition keeps only a single segment-finish file. For instance, if segment-finish file 5 exists, it indicates that segments 1 to 5 have all been finished.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.flink.runtime.io.network.partition.hybrid.tiered.file.PartitionFileWriter
PartitionFileWriter.SegmentBufferContext, PartitionFileWriter.SubpartitionBufferContext -
Method Summary
Modifier and TypeMethodDescriptionvoidrelease()Release all the resources of thePartitionFileWriter.write(TieredStoragePartitionId partitionId, List<PartitionFileWriter.SubpartitionBufferContext> buffersToWrite) Write the buffers to the partition file.
-
Method Details
-
write
public CompletableFuture<Void> write(TieredStoragePartitionId partitionId, List<PartitionFileWriter.SubpartitionBufferContext> buffersToWrite) Description copied from interface:PartitionFileWriterWrite the buffers to the partition file. The written buffers may belong to multiple subpartitions, but these buffers will be consecutive in the file.- Specified by:
writein interfacePartitionFileWriter- Parameters:
partitionId- the partition idbuffersToWrite- the buffers to be written to the partition file- Returns:
- the completable future indicating whether the writing file process has finished. If
the
CompletableFutureis completed, the written process is completed.
-
release
public void release()Description copied from interface:PartitionFileWriterRelease all the resources of thePartitionFileWriter.- Specified by:
releasein interfacePartitionFileWriter
-