@Internal @ThreadSafe public class ChannelStateWriterImpl extends Object implements ChannelStateWriter
ChannelStateWriter
implemented using CheckpointStateOutputStreams
. Internally, it has by default
Thread-safety: this class is thread-safe when used with a thread-safe executor
(e.g. default ChannelStateWriteRequestExecutorImpl
.
ChannelStateWriter.ChannelStateWriteResult, ChannelStateWriter.NoOpChannelStateWriter
NO_OP, SEQUENCE_NUMBER_RESTORED, SEQUENCE_NUMBER_UNKNOWN
Constructor and Description |
---|
ChannelStateWriterImpl(JobVertexID jobVertexID,
String taskName,
int subtaskIndex,
CheckpointStorage checkpointStorage,
ChannelStateWriteRequestExecutorFactory channelStateExecutorFactory,
int maxSubtasksPerChannelStateFile)
|
Modifier and Type | Method and Description |
---|---|
void |
abort(long checkpointId,
Throwable cause,
boolean cleanup)
Aborts the checkpoint and fails pending result for this checkpoint.
|
void |
addInputData(long checkpointId,
InputChannelInfo info,
int startSeqNum,
CloseableIterator<Buffer> iterator)
Add in-flight buffers from the
InputChannel . |
void |
addOutputData(long checkpointId,
ResultSubpartitionInfo info,
int startSeqNum,
Buffer... data)
Add in-flight buffers from the
ResultSubpartition . |
void |
addOutputDataFuture(long checkpointId,
ResultSubpartitionInfo info,
int startSeqNum,
CompletableFuture<List<Buffer>> dataFuture)
Add in-flight bufferFuture from the
ResultSubpartition . |
void |
close() |
void |
finishInput(long checkpointId)
Finalize write of channel state data for the given checkpoint id.
|
void |
finishOutput(long checkpointId)
Finalize write of channel state data for the given checkpoint id.
|
ChannelStateWriter.ChannelStateWriteResult |
getAndRemoveWriteResult(long checkpointId)
Must be called after
ChannelStateWriter.start(long, CheckpointOptions) once. |
ChannelStateWriter.ChannelStateWriteResult |
getWriteResult(long checkpointId) |
void |
start(long checkpointId,
CheckpointOptions checkpointOptions)
Initiate write of channel state for the given checkpoint id.
|
public ChannelStateWriterImpl(JobVertexID jobVertexID, String taskName, int subtaskIndex, CheckpointStorage checkpointStorage, ChannelStateWriteRequestExecutorFactory channelStateExecutorFactory, int maxSubtasksPerChannelStateFile)
public void start(long checkpointId, CheckpointOptions checkpointOptions)
ChannelStateWriter
start
in interface ChannelStateWriter
public void addInputData(long checkpointId, InputChannelInfo info, int startSeqNum, CloseableIterator<Buffer> iterator)
ChannelStateWriter
InputChannel
. Must be
called after ChannelStateWriter.start(long, org.apache.flink.runtime.checkpoint.CheckpointOptions)
(long)} and before ChannelStateWriter.finishInput(long)
. Buffers are
recycled after they are written or exception occurs.addInputData
in interface ChannelStateWriter
startSeqNum
- sequence number of the 1st passed buffer. It is intended to use for
incremental snapshots. If no data is passed it is ignored.iterator
- zero or more data buffers ordered by their sequence numbersChannelStateWriter.SEQUENCE_NUMBER_RESTORED
,
ChannelStateWriter.SEQUENCE_NUMBER_UNKNOWN
public void addOutputData(long checkpointId, ResultSubpartitionInfo info, int startSeqNum, Buffer... data)
ChannelStateWriter
ResultSubpartition
. Must be
called after ChannelStateWriter.start(long, org.apache.flink.runtime.checkpoint.CheckpointOptions)
and before ChannelStateWriter.finishOutput(long)
. Buffers are recycled
after they are written or exception occurs.addOutputData
in interface ChannelStateWriter
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 numbersChannelStateWriter.SEQUENCE_NUMBER_RESTORED
,
ChannelStateWriter.SEQUENCE_NUMBER_UNKNOWN
public void addOutputDataFuture(long checkpointId, ResultSubpartitionInfo info, int startSeqNum, CompletableFuture<List<Buffer>> dataFuture) throws IllegalArgumentException
ChannelStateWriter
ResultSubpartition
. Must be
called after ChannelStateWriter.start(long, org.apache.flink.runtime.checkpoint.CheckpointOptions)
and before ChannelStateWriter.finishOutput(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.
addOutputDataFuture
in interface ChannelStateWriter
IllegalArgumentException
public void finishInput(long checkpointId)
ChannelStateWriter
ChannelStateWriter.start(long, CheckpointOptions)
and all of the input data of the given checkpoint added.
When both ChannelStateWriter.finishInput(long)
and ChannelStateWriter.finishOutput(long)
were called the results can be
(eventually) obtained using ChannelStateWriter.getAndRemoveWriteResult(long)
finishInput
in interface ChannelStateWriter
public void finishOutput(long checkpointId)
ChannelStateWriter
ChannelStateWriter.start(long, CheckpointOptions)
and all of the output data of the given checkpoint added.
When both ChannelStateWriter.finishInput(long)
and ChannelStateWriter.finishOutput(long)
were called the results can be
(eventually) obtained using ChannelStateWriter.getAndRemoveWriteResult(long)
finishOutput
in interface ChannelStateWriter
public void abort(long checkpointId, Throwable cause, boolean cleanup)
ChannelStateWriter
abort
in interface ChannelStateWriter
cleanup
- true if ChannelStateWriter.getAndRemoveWriteResult(long)
is not supposed to be called
afterwards.public ChannelStateWriter.ChannelStateWriteResult getAndRemoveWriteResult(long checkpointId)
ChannelStateWriter
ChannelStateWriter.start(long, CheckpointOptions)
once.getAndRemoveWriteResult
in interface ChannelStateWriter
@VisibleForTesting public ChannelStateWriter.ChannelStateWriteResult getWriteResult(long checkpointId)
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.