public class PipelinedResultPartition extends BufferWritingResultPartition implements CheckpointedResultPartition, ChannelStateHolder
This result partition implementation is used both in batch and streaming. For streaming, it supports low latency transfers (ensure data is sent within x milliseconds) or unconstrained while for batch it transfers only once a buffer is full. Additionally, for streaming use this typically limits the length of the buffer backlog to not have too much data in flight, while for batch we do not constrain this.
The PipelinedResultPartition cannot reconnect once a consumer disconnects (finished or
errored). Once all consumers have disconnected (released the subpartition, notified via the call
onConsumedSubpartition(int)) then the partition as a whole is disposed and all buffers
are freed.
AvailabilityProvider.AvailabilityHelpersubpartitionsbufferCompressor, bufferPool, LOG, numBuffersOut, numBytesOut, numSubpartitions, partitionId, partitionManager, partitionType, resultPartitionBytesAVAILABLE| Constructor and Description |
|---|
PipelinedResultPartition(String owningTaskName,
int partitionIndex,
ResultPartitionID partitionId,
ResultPartitionType partitionType,
ResultSubpartition[] subpartitions,
int numTargetKeyGroups,
ResultPartitionManager partitionManager,
BufferCompressor bufferCompressor,
org.apache.flink.util.function.SupplierWithException<BufferPool,IOException> bufferPoolFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
addRecovered(int subpartitionIndex,
BufferConsumer bufferConsumer) |
void |
close()
Closes the partition writer which releases the allocated resource, for example the buffer
pool.
|
void |
finishReadRecoveredState(boolean notifyAndBlockOnCompletion) |
void |
flush(int targetSubpartition)
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.
|
ResultSubpartitionInfo |
getCheckpointedSubpartitionInfo(int subpartitionIndex)
Gets the checkpointed subpartition info with the given subpartitionIndex.
|
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.
|
BufferBuilder |
requestBufferBuilderBlocking() |
void |
setChannelStateWriter(ChannelStateWriter channelStateWriter)
Injects the
ChannelStateWriter. |
String |
toString() |
abortCheckpoint, addToSubpartition, alignedBarrierTimeout, broadcastEvent, broadcastRecord, createSubpartitionView, emitRecord, finish, flushAllSubpartitions, flushSubpartition, getAllPartitions, getHardBackPressuredTimeMsPerSecond, getNumberOfQueuedBuffers, getNumberOfQueuedBuffers, getSizeOfQueuedBuffersUnsafe, releaseInternal, setMetricGroup, setupInternalcanBeCompressed, checkInProduceState, createSubpartitionView, fail, getAvailableFuture, getBufferPool, getFailureCause, getNumberOfSubpartitions, getNumTargetKeyGroups, getOwningTaskName, getPartitionId, getPartitionIndex, getPartitionManager, getPartitionType, getResultPartitionBytes, isFinished, isNumberOfPartitionConsumerUndefined, isNumberOfPartitionConsumerUndefined, isReleased, release, release, setMaxOverdraftBuffersPerGate, setupclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitand, isApproximatelyAvailable, isAvailable, orpublic PipelinedResultPartition(String owningTaskName, int partitionIndex, ResultPartitionID partitionId, ResultPartitionType partitionType, ResultSubpartition[] subpartitions, int numTargetKeyGroups, ResultPartitionManager partitionManager, @Nullable BufferCompressor bufferCompressor, org.apache.flink.util.function.SupplierWithException<BufferPool,IOException> bufferPoolFactory)
public void setChannelStateWriter(ChannelStateWriter channelStateWriter)
ChannelStateHolderChannelStateWriter. Must only be called once.setChannelStateWriter in interface ChannelStateHolderpublic ResultSubpartitionInfo getCheckpointedSubpartitionInfo(int subpartitionIndex)
CheckpointedResultPartitiongetCheckpointedSubpartitionInfo in interface CheckpointedResultPartitionpublic void flushAll()
ResultPartitionWriterflushAll in interface ResultPartitionWriterpublic void flush(int targetSubpartition)
ResultPartitionWriterflush in interface ResultPartitionWriterpublic 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<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 String toString()
toString in class ResultPartitionpublic void finishReadRecoveredState(boolean notifyAndBlockOnCompletion)
throws IOException
finishReadRecoveredState in interface CheckpointedResultPartitionIOExceptionpublic BufferBuilder requestBufferBuilderBlocking() throws IOException, RuntimeException, InterruptedException
requestBufferBuilderBlocking in interface CheckpointedResultPartitionIOExceptionRuntimeExceptionInterruptedExceptionpublic void addRecovered(int subpartitionIndex,
BufferConsumer bufferConsumer)
throws IOException
addRecovered in interface CheckpointedResultPartitionIOExceptionpublic void close()
ResultPartitionWriterclose in interface AutoCloseableclose in interface ResultPartitionWriterclose in class BufferWritingResultPartitionCopyright © 2014–2025 The Apache Software Foundation. All rights reserved.