@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.NoOpChannelStateWriterNO_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,
org.apache.flink.util.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)
ChannelStateWriterstart in interface ChannelStateWriterpublic void addInputData(long checkpointId,
InputChannelInfo info,
int startSeqNum,
org.apache.flink.util.CloseableIterator<Buffer> iterator)
ChannelStateWriterInputChannel. Must be
called after ChannelStateWriter.start(long,CheckpointOptions) and before ChannelStateWriter.finishInput(long).
Buffers are recycled after they are written or exception occurs.addInputData in interface ChannelStateWriterstartSeqNum - 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_UNKNOWNpublic void addOutputData(long checkpointId,
ResultSubpartitionInfo info,
int startSeqNum,
Buffer... data)
ChannelStateWriterResultSubpartition. 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 ChannelStateWriterstartSeqNum - 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_UNKNOWNpublic void addOutputDataFuture(long checkpointId,
ResultSubpartitionInfo info,
int startSeqNum,
CompletableFuture<List<Buffer>> dataFuture)
throws IllegalArgumentException
ChannelStateWriterResultSubpartition. 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 ChannelStateWriterIllegalArgumentExceptionpublic void finishInput(long checkpointId)
ChannelStateWriterChannelStateWriter.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 ChannelStateWriterpublic void finishOutput(long checkpointId)
ChannelStateWriterChannelStateWriter.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 ChannelStateWriterpublic void abort(long checkpointId,
Throwable cause,
boolean cleanup)
ChannelStateWriterabort in interface ChannelStateWritercleanup - true if ChannelStateWriter.getAndRemoveWriteResult(long) is not supposed to be called
afterwards.public ChannelStateWriter.ChannelStateWriteResult getAndRemoveWriteResult(long checkpointId)
ChannelStateWriterChannelStateWriter.start(long, CheckpointOptions) once.getAndRemoveWriteResult in interface ChannelStateWriter@VisibleForTesting public ChannelStateWriter.ChannelStateWriteResult getWriteResult(long checkpointId)
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2014–2024 The Apache Software Foundation. All rights reserved.