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 BufferManagerbufferManagerprotected ChannelStateWriterchannelStateWriterprotected intnetworkBuffersPerChannel-
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 voidacknowledgeAllRecordsProcessed()When receivedEndOfDatafrom one channel, it need to acknowledge after this event get processed.voidcheckpointStarted(CheckpointBarrier barrier)Called by task thread when checkpointing is started (e.g., any input channel received barrier).voidcheckpointStopped(long checkpointId)Called by task thread on cancel/complete to clean-up temporary data.voidfinishReadRecoveredState()Optional<InputChannel.BufferAndAvailability>getNextBuffer()Returns the next buffer from the consumed subpartitions orOptional.empty()if there is no data to return.protected intgetNumberOfQueuedBuffers()voidonRecoveredStateBuffer(Buffer buffer)protected intpeekNextBufferSubpartitionIdInternal()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.BufferrequestBufferBlocking()voidresumeConsumption()After sending aCheckpointBarrierof exactly-once mode, the upstream will be blocked and become unavailable.voidsetChannelStateWriter(ChannelStateWriter channelStateWriter)Injects theChannelStateWriter.InputChanneltoInputChannel()protected abstract InputChanneltoInputChannelInternal()-
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:ChannelStateHolderInjects theChannelStateWriter. Must only be called once.- Specified by:
setChannelStateWriterin interfaceChannelStateHolder
-
toInputChannel
public final InputChannel toInputChannel() throws IOException
- Throws:
IOException
-
checkpointStopped
public void checkpointStopped(long checkpointId)
Description copied from class:InputChannelCalled by task thread on cancel/complete to clean-up temporary data.- Overrides:
checkpointStoppedin 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 IOExceptionDescription copied from class:InputChannelReturns 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:
peekNextBufferSubpartitionIdInternalin classInputChannel- Throws:
IOException
-
getNextBuffer
public Optional<InputChannel.BufferAndAvailability> getNextBuffer() throws IOException
Description copied from class:InputChannelReturns the next buffer from the consumed subpartitions orOptional.empty()if there is no data to return.- Specified by:
getNextBufferin classInputChannel- Throws:
IOException
-
resumeConsumption
public void resumeConsumption()
Description copied from class:InputChannelAfter sending aCheckpointBarrierof 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:
resumeConsumptionin classInputChannel
-
acknowledgeAllRecordsProcessed
public void acknowledgeAllRecordsProcessed() throws IOExceptionDescription copied from class:InputChannelWhen receivedEndOfDatafrom one channel, it need to acknowledge after this event get processed.- Specified by:
acknowledgeAllRecordsProcessedin classInputChannel- Throws:
IOException
-
getNumberOfQueuedBuffers
@VisibleForTesting protected int getNumberOfQueuedBuffers()
-
requestBufferBlocking
public Buffer requestBufferBlocking() throws InterruptedException, IOException
- Throws:
InterruptedExceptionIOException
-
checkpointStarted
public void checkpointStarted(CheckpointBarrier barrier) throws CheckpointException
Description copied from class:InputChannelCalled by task thread when checkpointing is started (e.g., any input channel received barrier).- Overrides:
checkpointStartedin classInputChannel- Throws:
CheckpointException
-
-