@NotThreadSafe public class SortMergeResultPartition extends ResultPartition
SortMergeResultPartition appends records and events to SortBuffer and after the
SortBuffer is full, all data in the SortBuffer will be copied and spilled to a
PartitionedFile in subpartition index order sequentially. Large records that can not be
appended to an empty SortBuffer will be spilled to the result PartitionedFile
separately.AvailabilityProvider.AvailabilityHelperbufferCompressor, bufferPool, LOG, numBuffersOut, numBytesOut, numSubpartitions, partitionId, partitionManager, partitionTypeAVAILABLE| 构造器和说明 |
|---|
SortMergeResultPartition(String owningTaskName,
int partitionIndex,
ResultPartitionID partitionId,
ResultPartitionType partitionType,
int numSubpartitions,
int numTargetKeyGroups,
BatchShuffleReadBufferPool readBufferPool,
Executor readIOExecutor,
ResultPartitionManager partitionManager,
String resultFileBasePath,
BufferCompressor bufferCompressor,
org.apache.flink.util.function.SupplierWithException<BufferPool,IOException> bufferPoolFactory) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
broadcastEvent(AbstractEvent event,
boolean isPriorityEvent)
Writes the given
AbstractEvent to all channels. |
void |
broadcastRecord(ByteBuffer record)
Writes the given serialized record to all subpartitions.
|
void |
close()
Closes the partition writer which releases the allocated resource, for example the buffer
pool.
|
ResultSubpartitionView |
createSubpartitionView(int subpartitionIndex,
BufferAvailabilityListener availabilityListener)
Returns a reader for the subpartition with the given index.
|
void |
emitRecord(ByteBuffer record,
int targetSubpartition)
Writes the given serialized record to the target subpartition.
|
void |
finish()
Finishes the result partition.
|
void |
flush(int subpartitionIndex)
Manually trigger the consumption of data from the given subpartitions.
|
void |
flushAll()
Manually trigger the consumption of data from all subpartitions.
|
CompletableFuture<?> |
getAvailableFuture() |
int |
getNumberOfQueuedBuffers()
Returns the total number of queued buffers of all subpartitions.
|
int |
getNumberOfQueuedBuffers(int targetSubpartition)
Returns the number of queued buffers of the given target subpartition.
|
void |
notifyEndOfData()
Notifies the downstream tasks that this
ResultPartitionWriter have emitted all the
user records. |
protected void |
releaseInternal()
Releases all produced data including both those stored in memory and persisted on disk.
|
void |
setup()
Registers a buffer pool with this result partition.
|
canBeCompressed, checkInProduceState, fail, getAllDataProcessedFuture, getBufferPool, getFailureCause, getNumberOfSubpartitions, getNumTargetKeyGroups, getOwningTaskName, getPartitionId, getPartitionIndex, getPartitionManager, getPartitionType, isFinished, isReleased, onSubpartitionAllDataProcessed, release, release, setMetricGroup, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitand, isApproximatelyAvailable, isAvailable, orpublic SortMergeResultPartition(String owningTaskName, int partitionIndex, ResultPartitionID partitionId, ResultPartitionType partitionType, int numSubpartitions, int numTargetKeyGroups, BatchShuffleReadBufferPool readBufferPool, Executor readIOExecutor, ResultPartitionManager partitionManager, String resultFileBasePath, @Nullable BufferCompressor bufferCompressor, org.apache.flink.util.function.SupplierWithException<BufferPool,IOException> bufferPoolFactory)
public void setup()
throws IOException
ResultPartitionThere is one pool for each result partition, which is shared by all its sub partitions.
The pool is registered with the partition *after* it as been constructed in order to
conform to the life-cycle of task registrations in the TaskExecutor.
setup 在接口中 ResultPartitionWritersetup 在类中 ResultPartitionIOExceptionprotected void releaseInternal()
ResultPartitionreleaseInternal 在类中 ResultPartitionpublic void emitRecord(ByteBuffer record, int targetSubpartition) throws IOException
ResultPartitionWriterIOExceptionpublic void broadcastRecord(ByteBuffer record) throws IOException
ResultPartitionWriterIOExceptionpublic void broadcastEvent(AbstractEvent event, boolean isPriorityEvent) throws IOException
ResultPartitionWriterAbstractEvent to all channels.IOExceptionpublic void notifyEndOfData()
throws IOException
ResultPartitionWriterResultPartitionWriter have emitted all the
user records.notifyEndOfData 在接口中 ResultPartitionWriternotifyEndOfData 在类中 ResultPartitionIOExceptionpublic void finish()
throws IOException
ResultPartitionAfter this operation, it is not possible to add further data to the result partition.
For BLOCKING results, this will trigger the deployment of consuming tasks.
finish 在接口中 ResultPartitionWriterfinish 在类中 ResultPartitionIOExceptionpublic void close()
ResultPartitionWriterclose 在接口中 AutoCloseableclose 在接口中 ResultPartitionWriterclose 在类中 ResultPartitionpublic ResultSubpartitionView createSubpartitionView(int subpartitionIndex, BufferAvailabilityListener availabilityListener) throws IOException
ResultPartitionWriterIOExceptionpublic void flushAll()
ResultPartitionWriterpublic void flush(int subpartitionIndex)
ResultPartitionWriterpublic CompletableFuture<?> getAvailableFuture()
getAvailableFuture 在接口中 AvailabilityProvidergetAvailableFuture 在类中 ResultPartitionpublic int getNumberOfQueuedBuffers()
ResultPartitiongetNumberOfQueuedBuffers 在类中 ResultPartitionpublic int getNumberOfQueuedBuffers(int targetSubpartition)
ResultPartitiongetNumberOfQueuedBuffers 在类中 ResultPartitionCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.