@Internal public class CheckpointBarrierTracker extends CheckpointBarrierHandler
CheckpointBarrierTracker
keeps track of what checkpoint barriers have been received from
which input channels. Once it has observed all checkpoint barriers for a checkpoint ID,
it notifies its listener of a completed checkpoint.
Unlike the CheckpointBarrierAligner
, the BarrierTracker does not block the input
channels that have sent barriers, so it cannot be used to gain "exactly-once" processing
guarantees. It can, however, be used to gain "at least once" processing guarantees.
NOTE: This implementation strictly assumes that newer checkpoints have higher checkpoint IDs.
Constructor and Description |
---|
CheckpointBarrierTracker(int totalNumberOfInputChannels) |
CheckpointBarrierTracker(int totalNumberOfInputChannels,
AbstractInvokable toNotifyOnCheckpoint) |
Modifier and Type | Method and Description |
---|---|
void |
checkpointSizeLimitExceeded(long maxBufferedBytes) |
long |
getAlignmentDurationNanos() |
long |
getLatestCheckpointId() |
boolean |
isBlocked(int channelIndex)
Checks whether the channel with the given index is blocked.
|
boolean |
processBarrier(CheckpointBarrier receivedBarrier,
int channelIndex,
long bufferedBytes) |
boolean |
processCancellationBarrier(CancelCheckpointMarker cancelBarrier) |
boolean |
processEndOfPartition() |
void |
releaseBlocksAndResetBarriers() |
notifyAbort, notifyAbortOnCancellationBarrier, notifyCheckpoint
public CheckpointBarrierTracker(int totalNumberOfInputChannels)
public CheckpointBarrierTracker(int totalNumberOfInputChannels, @Nullable AbstractInvokable toNotifyOnCheckpoint)
public void releaseBlocksAndResetBarriers()
releaseBlocksAndResetBarriers
in class CheckpointBarrierHandler
public boolean isBlocked(int channelIndex)
CheckpointBarrierHandler
isBlocked
in class CheckpointBarrierHandler
channelIndex
- The channel index to check.public boolean processBarrier(CheckpointBarrier receivedBarrier, int channelIndex, long bufferedBytes) throws Exception
processBarrier
in class CheckpointBarrierHandler
Exception
public boolean processCancellationBarrier(CancelCheckpointMarker cancelBarrier) throws Exception
processCancellationBarrier
in class CheckpointBarrierHandler
Exception
public boolean processEndOfPartition() throws Exception
processEndOfPartition
in class CheckpointBarrierHandler
Exception
public long getLatestCheckpointId()
getLatestCheckpointId
in class CheckpointBarrierHandler
public long getAlignmentDurationNanos()
getAlignmentDurationNanos
in class CheckpointBarrierHandler
public void checkpointSizeLimitExceeded(long maxBufferedBytes) throws Exception
checkpointSizeLimitExceeded
in class CheckpointBarrierHandler
Exception
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.