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.AvailabilityHelper
subpartitions
bufferCompressor, bufferPool, LOG, numBuffersOut, numBytesOut, numSubpartitions, partitionId, partitionManager, partitionType, resultPartitionBytes
AVAILABLE
Constructor and Description |
---|
PipelinedResultPartition(String owningTaskName,
int partitionIndex,
ResultPartitionID partitionId,
ResultPartitionType partitionType,
ResultSubpartition[] subpartitions,
int numTargetKeyGroups,
ResultPartitionManager partitionManager,
BufferCompressor bufferCompressor,
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, setupInternal
canBeCompressed, checkInProduceState, fail, getAvailableFuture, getBufferPool, getFailureCause, getNumberOfSubpartitions, getNumTargetKeyGroups, getOwningTaskName, getPartitionId, getPartitionIndex, getPartitionManager, getPartitionType, isFinished, isReleased, release, release, setMaxOverdraftBuffersPerGate, setup
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
and, isApproximatelyAvailable, isAvailable, or
public PipelinedResultPartition(String owningTaskName, int partitionIndex, ResultPartitionID partitionId, ResultPartitionType partitionType, ResultSubpartition[] subpartitions, int numTargetKeyGroups, ResultPartitionManager partitionManager, @Nullable BufferCompressor bufferCompressor, SupplierWithException<BufferPool,IOException> bufferPoolFactory)
public void setChannelStateWriter(ChannelStateWriter channelStateWriter)
ChannelStateHolder
ChannelStateWriter
. Must only be called once.setChannelStateWriter
in interface ChannelStateHolder
public ResultSubpartitionInfo getCheckpointedSubpartitionInfo(int subpartitionIndex)
CheckpointedResultPartition
getCheckpointedSubpartitionInfo
in interface CheckpointedResultPartition
public void flushAll()
ResultPartitionWriter
flushAll
in interface ResultPartitionWriter
public void flush(int targetSubpartition)
ResultPartitionWriter
flush
in interface ResultPartitionWriter
public void notifyEndOfData(StopMode mode) throws IOException
ResultPartitionWriter
ResultPartitionWriter
have emitted all the
user records.notifyEndOfData
in interface ResultPartitionWriter
notifyEndOfData
in class ResultPartition
mode
- tells if we should flush all records or not (it is false in case of
stop-with-savepoint (--no-drain))IOException
public CompletableFuture<Void> getAllDataProcessedFuture()
ResultPartitionWriter
getAllDataProcessedFuture
in interface ResultPartitionWriter
getAllDataProcessedFuture
in class ResultPartition
public void onSubpartitionAllDataProcessed(int subpartition)
ResultPartition
onSubpartitionAllDataProcessed
in class ResultPartition
subpartition
- The index of the subpartition sending the notification.EndOfData
public String toString()
toString
in class ResultPartition
public void finishReadRecoveredState(boolean notifyAndBlockOnCompletion) throws IOException
finishReadRecoveredState
in interface CheckpointedResultPartition
IOException
public BufferBuilder requestBufferBuilderBlocking() throws IOException, RuntimeException, InterruptedException
requestBufferBuilderBlocking
in interface CheckpointedResultPartition
IOException
RuntimeException
InterruptedException
public void addRecovered(int subpartitionIndex, BufferConsumer bufferConsumer) throws IOException
addRecovered
in interface CheckpointedResultPartition
IOException
public void close()
ResultPartitionWriter
close
in interface AutoCloseable
close
in interface ResultPartitionWriter
close
in class BufferWritingResultPartition
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.