public class TieredResultPartition extends ResultPartition
TieredResultPartition appends records and events to the tiered storage, which supports
the upstream dynamically switches storage tier for writing shuffle data, and the downstream will
read data from the relevant tier.AvailabilityProvider.AvailabilityHelperbufferCompressor, bufferPool, LOG, numBuffersOut, numBytesOut, numSubpartitions, partitionManager, partitionType, resultPartitionBytesAVAILABLE| Constructor and Description |
|---|
TieredResultPartition(String owningTaskName,
int partitionIndex,
ResultPartitionID partitionId,
ResultPartitionType partitionType,
int numSubpartitions,
int numTargetKeyGroups,
ResultPartitionManager partitionManager,
BufferCompressor bufferCompressor,
org.apache.flink.util.function.SupplierWithException<BufferPool,IOException> bufferPoolFactory,
TieredStorageProducerClient tieredStorageProducerClient,
TieredStorageResourceRegistry tieredStorageResourceRegistry,
TieredStorageNettyServiceImpl nettyService,
List<TieredStorageMemorySpec> tieredStorageMemorySpecs,
TieredStorageMemoryManager storageMemoryManager) |
| Modifier and Type | Method and Description |
|---|---|
void |
abortCheckpoint(long checkpointId,
CheckpointException cause)
Abort the checkpoint.
|
void |
alignedBarrierTimeout(long checkpointId)
Timeout the aligned barrier to unaligned barrier.
|
void |
broadcastEvent(AbstractEvent event,
boolean isPriorityEvent)
Writes the given
AbstractEvent to all subpartitions. |
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.
|
protected ResultSubpartitionView |
createSubpartitionView(int subpartitionId,
BufferAvailabilityListener availabilityListener)
Returns a reader for the subpartition with the given index.
|
void |
emitRecord(ByteBuffer record,
int consumerId)
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<Void> |
getAllDataProcessedFuture()
Gets the future indicating whether all the records has been processed by the downstream
tasks.
|
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.
|
long |
getSizeOfQueuedBuffersUnsafe()
Returns the total size in bytes of queued buffers of all subpartitions.
|
void |
notifyEndOfData(StopMode mode)
Notifies the downstream tasks that this
ResultPartitionWriter have emitted all the
user records. |
void |
onSubpartitionAllDataProcessed(int subpartition)
The subpartition notifies that the corresponding downstream task have processed all the user
records.
|
protected void |
releaseInternal()
Releases all produced data including both those stored in memory and persisted on disk.
|
void |
setMetricGroup(TaskIOMetricGroup metrics)
Sets the metric group for the
ResultPartitionWriter. |
protected void |
setupInternal()
Do the subclass's own setup operation.
|
canBeCompressed, checkInProduceState, createSubpartitionView, fail, getBufferPool, getFailureCause, getNumberOfSubpartitions, getNumTargetKeyGroups, getOwningTaskName, getPartitionId, getPartitionIndex, getPartitionManager, getPartitionType, getResultPartitionBytes, isFinished, isNumberOfPartitionConsumerUndefined, isNumberOfPartitionConsumerUndefined, isReleased, release, release, setMaxOverdraftBuffersPerGate, setup, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitand, isApproximatelyAvailable, isAvailable, orpublic TieredResultPartition(String owningTaskName, int partitionIndex, ResultPartitionID partitionId, ResultPartitionType partitionType, int numSubpartitions, int numTargetKeyGroups, ResultPartitionManager partitionManager, @Nullable BufferCompressor bufferCompressor, org.apache.flink.util.function.SupplierWithException<BufferPool,IOException> bufferPoolFactory, TieredStorageProducerClient tieredStorageProducerClient, TieredStorageResourceRegistry tieredStorageResourceRegistry, TieredStorageNettyServiceImpl nettyService, List<TieredStorageMemorySpec> tieredStorageMemorySpecs, TieredStorageMemoryManager storageMemoryManager)
protected void setupInternal()
throws IOException
ResultPartitionsetupInternal in class ResultPartitionIOExceptionpublic void setMetricGroup(TaskIOMetricGroup metrics)
ResultPartitionWriterResultPartitionWriter.setMetricGroup in interface ResultPartitionWritersetMetricGroup in class ResultPartitionpublic void emitRecord(ByteBuffer record, int consumerId) throws IOException
ResultPartitionWriterIOExceptionpublic void broadcastRecord(ByteBuffer record) throws IOException
ResultPartitionWriterIOExceptionpublic void broadcastEvent(AbstractEvent event, boolean isPriorityEvent) throws IOException
ResultPartitionWriterAbstractEvent to all subpartitions.IOExceptionprotected ResultSubpartitionView createSubpartitionView(int subpartitionId, BufferAvailabilityListener availabilityListener) throws IOException
ResultPartitionGiven that the function to merge outputs from multiple subpartition views is supported
uniformly in UnionResultSubpartitionView, subclasses of ResultPartition only
needs to take care of creating subpartition view for a single subpartition.
createSubpartitionView in class 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 in interface ResultPartitionWriterfinish in class ResultPartitionIOExceptionpublic void close()
ResultPartitionWriterclose in interface AutoCloseableclose in interface ResultPartitionWriterclose in class ResultPartitionprotected void releaseInternal()
ResultPartitionreleaseInternal in class ResultPartitionpublic void notifyEndOfData(StopMode mode) throws IOException
ResultPartitionWriterResultPartitionWriter have emitted all the
user records.notifyEndOfData in interface ResultPartitionWriternotifyEndOfData in class ResultPartitionmode - tells if we should flush all records or not (it is false in case of
stop-with-savepoint (--no-drain))IOExceptionpublic CompletableFuture<?> getAvailableFuture()
getAvailableFuture in interface AvailabilityProvidergetAvailableFuture in class ResultPartitionpublic void alignedBarrierTimeout(long checkpointId)
throws IOException
ResultPartitionWriterIOExceptionpublic void abortCheckpoint(long checkpointId,
CheckpointException cause)
ResultPartitionWriterpublic void flushAll()
ResultPartitionWriterpublic void flush(int subpartitionIndex)
ResultPartitionWriterpublic CompletableFuture<Void> getAllDataProcessedFuture()
ResultPartitionWritergetAllDataProcessedFuture in interface ResultPartitionWritergetAllDataProcessedFuture in class ResultPartitionpublic void onSubpartitionAllDataProcessed(int subpartition)
ResultPartitiononSubpartitionAllDataProcessed in class ResultPartitionsubpartition - The index of the subpartition sending the notification.EndOfDatapublic int getNumberOfQueuedBuffers()
ResultPartitiongetNumberOfQueuedBuffers in class ResultPartitionpublic long getSizeOfQueuedBuffersUnsafe()
ResultPartitiongetSizeOfQueuedBuffersUnsafe in class ResultPartitionpublic int getNumberOfQueuedBuffers(int targetSubpartition)
ResultPartitiongetNumberOfQueuedBuffers in class ResultPartitionCopyright © 2014–2025 The Apache Software Foundation. All rights reserved.