Interface ChannelStateWriter
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
ChannelStateWriter.NoOpChannelStateWriter,ChannelStateWriterImpl
Writes channel state during checkpoint/savepoint.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classChannel state write result.static classNo-op implementation ofChannelStateWriter. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ChannelStateWriterstatic final intSequence 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 final intSignifies that buffer sequence number is unknown (e.g. if passing sequence numbers is not implemented). -
Method Summary
Modifier and TypeMethodDescriptionvoidAborts 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.getAndRemoveWriteResult(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 Details
-
SEQUENCE_NUMBER_RESTORED
static final int SEQUENCE_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).- See Also:
-
SEQUENCE_NUMBER_UNKNOWN
static final int SEQUENCE_NUMBER_UNKNOWNSignifies that buffer sequence number is unknown (e.g. if passing sequence numbers is not implemented).- See Also:
-
NO_OP
-
-
Method Details
-
start
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:
-
addOutputData
void addOutputData(long checkpointId, ResultSubpartitionInfo info, int startSeqNum, Buffer... data) throws IllegalArgumentException Add 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:
-
addOutputDataFuture
void addOutputDataFuture(long checkpointId, ResultSubpartitionInfo info, int startSeqNum, CompletableFuture<List<Buffer>> data) throws IllegalArgumentException Add 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
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.
-