Class RecoveredInputChannel
- java.lang.Object
-
- org.apache.flink.runtime.io.network.partition.consumer.InputChannel
-
- org.apache.flink.runtime.io.network.partition.consumer.RecoveredInputChannel
-
- All Implemented Interfaces:
ChannelStateHolder
- Direct Known Subclasses:
LocalRecoveredInputChannel
,RemoteRecoveredInputChannel
public abstract class RecoveredInputChannel extends InputChannel implements ChannelStateHolder
An input channel reads recovered state from previous unaligned checkpoint snapshots.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.runtime.io.network.partition.consumer.InputChannel
InputChannel.BufferAndAvailability
-
-
Field Summary
Fields Modifier and Type Field Description protected BufferManager
bufferManager
protected ChannelStateWriter
channelStateWriter
protected int
networkBuffersPerChannel
-
Fields inherited from class org.apache.flink.runtime.io.network.partition.consumer.InputChannel
channelInfo, consumedSubpartitionIndexSet, currentBackoff, initialBackoff, inputGate, maxBackoff, numBuffersIn, numBytesIn, partitionId
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
acknowledgeAllRecordsProcessed()
When receivedEndOfData
from one channel, it need to acknowledge after this event get processed.void
checkpointStarted(CheckpointBarrier barrier)
Called by task thread when checkpointing is started (e.g., any input channel received barrier).void
checkpointStopped(long checkpointId)
Called by task thread on cancel/complete to clean-up temporary data.void
finishReadRecoveredState()
Optional<InputChannel.BufferAndAvailability>
getNextBuffer()
Returns the next buffer from the consumed subpartitions orOptional.empty()
if there is no data to return.protected int
getNumberOfQueuedBuffers()
void
onRecoveredStateBuffer(Buffer buffer)
protected int
peekNextBufferSubpartitionIdInternal()
Returns the index of the subpartition where the next buffer locates, or -1 if there is no buffer available and the subpartition to be consumed is not determined.Buffer
requestBufferBlocking()
void
resumeConsumption()
After sending aCheckpointBarrier
of exactly-once mode, the upstream will be blocked and become unavailable.void
setChannelStateWriter(ChannelStateWriter channelStateWriter)
Injects theChannelStateWriter
.InputChannel
toInputChannel()
protected abstract InputChannel
toInputChannelInternal()
-
Methods inherited from class org.apache.flink.runtime.io.network.partition.consumer.InputChannel
checkError, convertToPriorityEvent, getChannelIndex, getChannelInfo, getConsumedSubpartitionIndexSet, getCurrentBackoff, getPartitionId, increaseBackoff, notifyBufferAvailable, notifyChannelNonEmpty, notifyPriorityEvent, notifyRequiredSegmentId, peekNextBufferSubpartitionId, setError, unsynchronizedGetNumberOfQueuedBuffers, unsynchronizedGetSizeOfQueuedBuffers
-
-
-
-
Field Detail
-
bufferManager
protected final BufferManager bufferManager
-
channelStateWriter
protected ChannelStateWriter channelStateWriter
-
networkBuffersPerChannel
protected final int networkBuffersPerChannel
-
-
Method Detail
-
setChannelStateWriter
public void setChannelStateWriter(ChannelStateWriter channelStateWriter)
Description copied from interface:ChannelStateHolder
Injects theChannelStateWriter
. Must only be called once.- Specified by:
setChannelStateWriter
in interfaceChannelStateHolder
-
toInputChannel
public final InputChannel toInputChannel() throws IOException
- Throws:
IOException
-
checkpointStopped
public void checkpointStopped(long checkpointId)
Description copied from class:InputChannel
Called by task thread on cancel/complete to clean-up temporary data.- Overrides:
checkpointStopped
in classInputChannel
-
toInputChannelInternal
protected abstract InputChannel toInputChannelInternal() throws IOException
- Throws:
IOException
-
onRecoveredStateBuffer
public void onRecoveredStateBuffer(Buffer buffer)
-
finishReadRecoveredState
public void finishReadRecoveredState() throws IOException
- Throws:
IOException
-
peekNextBufferSubpartitionIdInternal
protected int peekNextBufferSubpartitionIdInternal() throws IOException
Description copied from class:InputChannel
Returns the index of the subpartition where the next buffer locates, or -1 if there is no buffer available and the subpartition to be consumed is not determined.- Specified by:
peekNextBufferSubpartitionIdInternal
in classInputChannel
- Throws:
IOException
-
getNextBuffer
public Optional<InputChannel.BufferAndAvailability> getNextBuffer() throws IOException
Description copied from class:InputChannel
Returns the next buffer from the consumed subpartitions orOptional.empty()
if there is no data to return.- Specified by:
getNextBuffer
in classInputChannel
- Throws:
IOException
-
resumeConsumption
public void resumeConsumption()
Description copied from class:InputChannel
After sending aCheckpointBarrier
of exactly-once mode, the upstream will be blocked and become unavailable. This method tries to unblock the corresponding upstream and resume data consumption.- Specified by:
resumeConsumption
in classInputChannel
-
acknowledgeAllRecordsProcessed
public void acknowledgeAllRecordsProcessed() throws IOException
Description copied from class:InputChannel
When receivedEndOfData
from one channel, it need to acknowledge after this event get processed.- Specified by:
acknowledgeAllRecordsProcessed
in classInputChannel
- Throws:
IOException
-
getNumberOfQueuedBuffers
@VisibleForTesting protected int getNumberOfQueuedBuffers()
-
requestBufferBlocking
public Buffer requestBufferBlocking() throws InterruptedException, IOException
- Throws:
InterruptedException
IOException
-
checkpointStarted
public void checkpointStarted(CheckpointBarrier barrier) throws CheckpointException
Description copied from class:InputChannel
Called by task thread when checkpointing is started (e.g., any input channel received barrier).- Overrides:
checkpointStarted
in classInputChannel
- Throws:
CheckpointException
-
-