Class PipelinedResultPartition
java.lang.Object
org.apache.flink.runtime.io.network.partition.ResultPartition
org.apache.flink.runtime.io.network.partition.BufferWritingResultPartition
org.apache.flink.runtime.io.network.partition.PipelinedResultPartition
- All Implemented Interfaces:
AutoCloseable,AvailabilityProvider,ResultPartitionWriter,ChannelStateHolder,CheckpointedResultPartition
public class PipelinedResultPartition
extends BufferWritingResultPartition
implements CheckpointedResultPartition, ChannelStateHolder
A result output of a task, pipelined (streamed) to the receivers.
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.
Specifics of the PipelinedResultPartition
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
AvailabilityProvider.AvailabilityHelper -
Field Summary
Fields inherited from class org.apache.flink.runtime.io.network.partition.BufferWritingResultPartition
subpartitionsFields inherited from class org.apache.flink.runtime.io.network.partition.ResultPartition
bufferCompressor, bufferPool, LOG, numBuffersOut, numBytesOut, numSubpartitions, partitionId, partitionManager, partitionType, resultPartitionBytesFields inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
AVAILABLE -
Constructor Summary
ConstructorsConstructorDescriptionPipelinedResultPartition(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) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRecovered(int subpartitionIndex, BufferConsumer bufferConsumer) voidclose()Closes the partition writer which releases the allocated resource, for example the buffer pool.voidfinishReadRecoveredState(boolean notifyAndBlockOnCompletion) voidflush(int targetSubpartition) Manually trigger the consumption of data from the given subpartitions.voidflushAll()Manually trigger the consumption of data from all subpartitions.Gets the future indicating whether all the records has been processed by the downstream tasks.getCheckpointedSubpartitionInfo(int subpartitionIndex) Gets the checkpointed subpartition info with the given subpartitionIndex.voidnotifyEndOfData(StopMode mode) Notifies the downstream tasks that thisResultPartitionWriterhave emitted all the user records.voidonSubpartitionAllDataProcessed(int subpartition) The subpartition notifies that the corresponding downstream task have processed all the user records.voidsetChannelStateWriter(ChannelStateWriter channelStateWriter) Injects theChannelStateWriter.toString()Methods inherited from class org.apache.flink.runtime.io.network.partition.BufferWritingResultPartition
abortCheckpoint, addToSubpartition, alignedBarrierTimeout, broadcastEvent, broadcastRecord, createSubpartitionView, emitRecord, finish, flushAllSubpartitions, flushSubpartition, getAllPartitions, getHardBackPressuredTimeMsPerSecond, getNumberOfQueuedBuffers, getNumberOfQueuedBuffers, getSizeOfQueuedBuffersUnsafe, releaseInternal, setMetricGroup, setupInternalMethods inherited from class org.apache.flink.runtime.io.network.partition.ResultPartition
canBeCompressed, checkInProduceState, createSubpartitionView, fail, getAvailableFuture, getBufferPool, getFailureCause, getNumberOfSubpartitions, getNumTargetKeyGroups, getOwningTaskName, getPartitionId, getPartitionIndex, getPartitionManager, getPartitionType, getResultPartitionBytes, isFinished, isNumberOfPartitionConsumerUndefined, isNumberOfPartitionConsumerUndefined, isReleased, release, release, setMaxOverdraftBuffersPerGate, setupMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
isApproximatelyAvailable, isAvailable
-
Constructor Details
-
PipelinedResultPartition
public 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)
-
-
Method Details
-
setChannelStateWriter
Description copied from interface:ChannelStateHolderInjects theChannelStateWriter. Must only be called once.- Specified by:
setChannelStateWriterin interfaceChannelStateHolder
-
getCheckpointedSubpartitionInfo
Description copied from interface:CheckpointedResultPartitionGets the checkpointed subpartition info with the given subpartitionIndex.- Specified by:
getCheckpointedSubpartitionInfoin interfaceCheckpointedResultPartition
-
flushAll
public void flushAll()Description copied from interface:ResultPartitionWriterManually trigger the consumption of data from all subpartitions.- Specified by:
flushAllin interfaceResultPartitionWriter
-
flush
public void flush(int targetSubpartition) Description copied from interface:ResultPartitionWriterManually trigger the consumption of data from the given subpartitions.- Specified by:
flushin interfaceResultPartitionWriter
-
notifyEndOfData
Description copied from interface:ResultPartitionWriterNotifies the downstream tasks that thisResultPartitionWriterhave emitted all the user records.- Specified by:
notifyEndOfDatain interfaceResultPartitionWriter- Overrides:
notifyEndOfDatain classResultPartition- Parameters:
mode- tells if we should flush all records or not (it is false in case of stop-with-savepoint (--no-drain))- Throws:
IOException
-
getAllDataProcessedFuture
Description copied from interface:ResultPartitionWriterGets the future indicating whether all the records has been processed by the downstream tasks.- Specified by:
getAllDataProcessedFuturein interfaceResultPartitionWriter- Overrides:
getAllDataProcessedFuturein classResultPartition
-
onSubpartitionAllDataProcessed
public void onSubpartitionAllDataProcessed(int subpartition) Description copied from class:ResultPartitionThe subpartition notifies that the corresponding downstream task have processed all the user records.- Overrides:
onSubpartitionAllDataProcessedin classResultPartition- Parameters:
subpartition- The index of the subpartition sending the notification.- See Also:
-
toString
- Overrides:
toStringin classResultPartition
-
finishReadRecoveredState
- Specified by:
finishReadRecoveredStatein interfaceCheckpointedResultPartition- Throws:
IOException
-
requestBufferBuilderBlocking
public BufferBuilder requestBufferBuilderBlocking() throws IOException, RuntimeException, InterruptedException- Specified by:
requestBufferBuilderBlockingin interfaceCheckpointedResultPartition- Throws:
IOExceptionRuntimeExceptionInterruptedException
-
addRecovered
- Specified by:
addRecoveredin interfaceCheckpointedResultPartition- Throws:
IOException
-
close
public void close()Description copied from interface:ResultPartitionWriterCloses the partition writer which releases the allocated resource, for example the buffer pool.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceResultPartitionWriter- Overrides:
closein classBufferWritingResultPartition
-