Interface ChannelStateWriter
-
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
ChannelStateWriter.NoOpChannelStateWriter,ChannelStateWriterImpl
@Internal public interface ChannelStateWriter extends Closeable
Writes channel state during checkpoint/savepoint.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classChannelStateWriter.ChannelStateWriteResultChannel state write result.static classChannelStateWriter.NoOpChannelStateWriterNo-op implementation ofChannelStateWriter.
-
Field Summary
Fields Modifier and Type Field Description static ChannelStateWriterNO_OPstatic intSEQUENCE_NUMBER_RESTOREDSequence number for the buffers that were saved during the previous execution attempt; then restored; and now are to be saved again (as opposed to the buffers received from the upstream or from the operator).static intSEQUENCE_NUMBER_UNKNOWNSignifies that buffer sequence number is unknown (e.g. if passing sequence numbers is not implemented).
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidabort(long checkpointId, Throwable cause, boolean cleanup)Aborts the checkpoint and fails pending result for this checkpoint.voidaddInputData(long checkpointId, InputChannelInfo info, int startSeqNum, org.apache.flink.util.CloseableIterator<Buffer> data)Add in-flight buffers from theInputChannel.voidaddOutputData(long checkpointId, ResultSubpartitionInfo info, int startSeqNum, Buffer... data)Add in-flight buffers from theResultSubpartition.voidaddOutputDataFuture(long checkpointId, ResultSubpartitionInfo info, int startSeqNum, CompletableFuture<List<Buffer>> data)Add in-flight bufferFuture from theResultSubpartition.voidfinishInput(long checkpointId)Finalize write of channel state data for the given checkpoint id.voidfinishOutput(long checkpointId)Finalize write of channel state data for the given checkpoint id.ChannelStateWriter.ChannelStateWriteResultgetAndRemoveWriteResult(long checkpointId)Must be called afterstart(long, CheckpointOptions)once.voidstart(long checkpointId, CheckpointOptions checkpointOptions)Initiate write of channel state for the given checkpoint id.
-
-
-
Field Detail
-
SEQUENCE_NUMBER_RESTORED
static final int SEQUENCE_NUMBER_RESTORED
Sequence number for the buffers that were saved during the previous execution attempt; then restored; and now are to be saved again (as opposed to the buffers received from the upstream or from the operator).- See Also:
- Constant Field Values
-
SEQUENCE_NUMBER_UNKNOWN
static final int SEQUENCE_NUMBER_UNKNOWN
Signifies that buffer sequence number is unknown (e.g. if passing sequence numbers is not implemented).- See Also:
- Constant Field Values
-
NO_OP
static final ChannelStateWriter NO_OP
-
-
Method Detail
-
start
void start(long checkpointId, CheckpointOptions checkpointOptions)Initiate write of channel state for the given checkpoint id.
-
addInputData
void addInputData(long checkpointId, InputChannelInfo info, int startSeqNum, org.apache.flink.util.CloseableIterator<Buffer> data)Add in-flight buffers from theInputChannel. Must be called afterstart(long,CheckpointOptions)and beforefinishInput(long). Buffers are recycled after they are written or exception occurs.- Parameters:
startSeqNum- sequence number of the 1st passed buffer. It is intended to use for incremental snapshots. If no data is passed it is ignored.data- zero or more data buffers ordered by their sequence numbers- See Also:
SEQUENCE_NUMBER_RESTORED,SEQUENCE_NUMBER_UNKNOWN
-
addOutputData
void addOutputData(long checkpointId, ResultSubpartitionInfo info, int startSeqNum, Buffer... data) throws IllegalArgumentExceptionAdd in-flight buffers from theResultSubpartition. Must be called afterstart(long, org.apache.flink.runtime.checkpoint.CheckpointOptions)and beforefinishOutput(long). Buffers are recycled after they are written or exception occurs.- Parameters:
startSeqNum- sequence number of the 1st passed buffer. It is intended to use for incremental snapshots. If no data is passed it is ignored.data- zero or more data buffers ordered by their sequence numbers- Throws:
IllegalArgumentException- if one or more passed buffersisn't a buffer- See Also:
SEQUENCE_NUMBER_RESTORED,SEQUENCE_NUMBER_UNKNOWN
-
addOutputDataFuture
void addOutputDataFuture(long checkpointId, ResultSubpartitionInfo info, int startSeqNum, CompletableFuture<List<Buffer>> data) throws IllegalArgumentExceptionAdd in-flight bufferFuture from theResultSubpartition. Must be called afterstart(long, org.apache.flink.runtime.checkpoint.CheckpointOptions)and beforefinishOutput(long). Buffers are recycled after they are written or exception occurs.The method will be called when the unaligned checkpoint is enabled and received an aligned barrier.
- Throws:
IllegalArgumentException
-
finishInput
void finishInput(long checkpointId)
Finalize write of channel state data for the given checkpoint id. Must be called afterstart(long, CheckpointOptions)and all of the input data of the given checkpoint added. When bothfinishInput(long)andfinishOutput(long)were called the results can be (eventually) obtained usinggetAndRemoveWriteResult(long)
-
finishOutput
void finishOutput(long checkpointId)
Finalize write of channel state data for the given checkpoint id. Must be called afterstart(long, CheckpointOptions)and all of the output data of the given checkpoint added. When bothfinishInput(long)andfinishOutput(long)were called the results can be (eventually) obtained usinggetAndRemoveWriteResult(long)
-
abort
void abort(long checkpointId, Throwable cause, boolean cleanup)Aborts the checkpoint and fails pending result for this checkpoint.- Parameters:
cleanup- true ifgetAndRemoveWriteResult(long)is not supposed to be called afterwards.
-
getAndRemoveWriteResult
ChannelStateWriter.ChannelStateWriteResult getAndRemoveWriteResult(long checkpointId) throws IllegalArgumentException
Must be called afterstart(long, CheckpointOptions)once.- Throws:
IllegalArgumentException- if the passed checkpointId is not known.
-
-