Class CheckpointedInputGate
java.lang.Object
org.apache.flink.streaming.runtime.io.checkpointing.CheckpointedInputGate
- All Implemented Interfaces:
Closeable,AutoCloseable,AvailabilityProvider,PullingAsyncDataInput<BufferOrEvent>
@Internal
public class CheckpointedInputGate
extends Object
implements PullingAsyncDataInput<BufferOrEvent>, Closeable
The
CheckpointedInputGate uses CheckpointBarrierHandler to handle incoming CheckpointBarrier from the InputGate.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
AvailabilityProvider.AvailabilityHelperNested classes/interfaces inherited from interface org.apache.flink.runtime.io.PullingAsyncDataInput
PullingAsyncDataInput.EndOfDataStatus -
Field Summary
Fields inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
AVAILABLE -
Constructor Summary
ConstructorsConstructorDescriptionCheckpointedInputGate(InputGate inputGate, CheckpointBarrierHandler barrierHandler, org.apache.flink.api.common.operators.MailboxExecutor mailboxExecutor) Creates a new checkpoint stream aligner.CheckpointedInputGate(InputGate inputGate, CheckpointBarrierHandler barrierHandler, org.apache.flink.api.common.operators.MailboxExecutor mailboxExecutor, UpstreamRecoveryTracker upstreamRecoveryTracker) -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidclose()Cleans up all internally held resources.getAllBarriersReceivedFuture(long checkpointId) getChannel(int channelIndex) intTells if we consumed all available data.booleanpollNext()Poll the next element.voidtoString()Methods 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
-
CheckpointedInputGate
public CheckpointedInputGate(InputGate inputGate, CheckpointBarrierHandler barrierHandler, org.apache.flink.api.common.operators.MailboxExecutor mailboxExecutor) Creates a new checkpoint stream aligner.The aligner will allow only alignments that buffer up to the given number of bytes. When that number is exceeded, it will stop the alignment and notify the task that the checkpoint has been cancelled.
- Parameters:
inputGate- The input gate to draw the buffers and events from.barrierHandler- Handler that controls which channels are blocked.
-
CheckpointedInputGate
public CheckpointedInputGate(InputGate inputGate, CheckpointBarrierHandler barrierHandler, org.apache.flink.api.common.operators.MailboxExecutor mailboxExecutor, UpstreamRecoveryTracker upstreamRecoveryTracker)
-
-
Method Details
-
getAvailableFuture
- Specified by:
getAvailableFuturein interfaceAvailabilityProvider- Returns:
- a future that is completed if the respective provider is available.
-
pollNext
Description copied from interface:PullingAsyncDataInputPoll the next element. This method should be non blocking.- Specified by:
pollNextin interfacePullingAsyncDataInput<BufferOrEvent>- Returns:
Optional.empty()will be returned if there is no data to return or ifPullingAsyncDataInput.isFinished()returns true. OtherwiseOptional.of(element).- Throws:
IOExceptionInterruptedException
-
getAllBarriersReceivedFuture
-
isFinished
public boolean isFinished()- Specified by:
isFinishedin interfacePullingAsyncDataInput<BufferOrEvent>- Returns:
- true if is finished and for example end of input was reached, false otherwise.
-
hasReceivedEndOfData
Description copied from interface:PullingAsyncDataInputTells if we consumed all available data.Moreover it tells us the reason why there is no more data incoming. If any of the upstream subtasks finished because of the stop-with-savepoint --no-drain, we should not drain the input. See also
StopMode.- Specified by:
hasReceivedEndOfDatain interfacePullingAsyncDataInput<BufferOrEvent>
-
resumeGateConsumption
- Throws:
IOException
-
close
Cleans up all internally held resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- Thrown if the cleanup of I/O resources failed.
-
getNumberOfInputChannels
public int getNumberOfInputChannels()- Returns:
- number of underlying input channels.
-
toString
-
getChannel
-
getChannelInfos
-
allChannelsRecovered
public boolean allChannelsRecovered()
-