Package org.apache.flink.runtime.state
Interface TaskStateManager
-
- All Superinterfaces:
AutoCloseable
,CheckpointListener
- All Known Implementing Classes:
TaskStateManagerImpl
public interface TaskStateManager extends CheckpointListener, AutoCloseable
This interface provides methods to report and retrieve state for a task.When a checkpoint or savepoint is triggered on a task, it will create snapshots for all stream operator instances it owns. All operator snapshots from the task are then reported via this interface. A typical implementation will dispatch and forward the reported state information to interested parties such as the checkpoint coordinator or a local state store.
This interface also offers the complementary method that provides access to previously saved state of operator instances in the task for restore purposes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description LocalRecoveryConfig
createLocalRecoveryConfig()
Returns the configuration for local recovery, i.e. the base directories for all file-based local state of the owning subtask and the general mode for local recovery.FileMergingSnapshotManager
getFileMergingSnapshotManager()
InflightDataRescalingDescriptor
getInputRescalingDescriptor()
InflightDataRescalingDescriptor
getOutputRescalingDescriptor()
Optional<Long>
getRestoreCheckpointId()
Acquires the checkpoint id to restore from.SequentialChannelStateReader
getSequentialChannelStateReader()
StateChangelogStorage<?>
getStateChangelogStorage()
Returns the configured state changelog storage for this task.StateChangelogStorageView<?>
getStateChangelogStorageView(Configuration configuration, ChangelogStateHandle changelogStateHandle)
Returns the state changelog storage view of givenChangelogStateHandle
for this task.Optional<OperatorSubtaskState>
getSubtaskJobManagerRestoredState(OperatorID operatorID)
Get the restored state from jobManager which belongs to an operator running in the owning task.boolean
isTaskDeployedAsFinished()
Whether all the operators of the task are finished on restore.PrioritizedOperatorSubtaskState
prioritizedOperatorState(OperatorID operatorID)
Returns means to restore previously reported state of an operator running in the owning task.void
reportIncompleteTaskStateSnapshots(CheckpointMetaData checkpointMetaData, CheckpointMetrics checkpointMetrics)
Report the stats for state snapshots for an aborted checkpoint.void
reportInitializationMetrics(SubTaskInitializationMetrics subTaskInitializationMetrics)
void
reportTaskStateSnapshots(CheckpointMetaData checkpointMetaData, CheckpointMetrics checkpointMetrics, TaskStateSnapshot acknowledgedState, TaskStateSnapshot localState)
Report the state snapshots for the operator instances running in the owning task.-
Methods inherited from interface java.lang.AutoCloseable
close
-
Methods inherited from interface org.apache.flink.api.common.state.CheckpointListener
notifyCheckpointAborted, notifyCheckpointComplete
-
-
-
-
Method Detail
-
reportInitializationMetrics
void reportInitializationMetrics(SubTaskInitializationMetrics subTaskInitializationMetrics)
-
reportTaskStateSnapshots
void reportTaskStateSnapshots(@Nonnull CheckpointMetaData checkpointMetaData, @Nonnull CheckpointMetrics checkpointMetrics, @Nullable TaskStateSnapshot acknowledgedState, @Nullable TaskStateSnapshot localState)
Report the state snapshots for the operator instances running in the owning task.- Parameters:
checkpointMetaData
- meta data from the checkpoint request.checkpointMetrics
- task level metrics for the checkpoint.acknowledgedState
- the reported states to acknowledge to the job manager.localState
- the reported states for local recovery.
-
getInputRescalingDescriptor
InflightDataRescalingDescriptor getInputRescalingDescriptor()
-
getOutputRescalingDescriptor
InflightDataRescalingDescriptor getOutputRescalingDescriptor()
-
reportIncompleteTaskStateSnapshots
void reportIncompleteTaskStateSnapshots(CheckpointMetaData checkpointMetaData, CheckpointMetrics checkpointMetrics)
Report the stats for state snapshots for an aborted checkpoint.- Parameters:
checkpointMetaData
- meta data from the checkpoint request.checkpointMetrics
- task level metrics for the checkpoint.
-
isTaskDeployedAsFinished
boolean isTaskDeployedAsFinished()
Whether all the operators of the task are finished on restore.
-
getRestoreCheckpointId
Optional<Long> getRestoreCheckpointId()
Acquires the checkpoint id to restore from.
-
prioritizedOperatorState
@Nonnull PrioritizedOperatorSubtaskState prioritizedOperatorState(OperatorID operatorID)
Returns means to restore previously reported state of an operator running in the owning task.- Parameters:
operatorID
- the id of the operator for which we request state.- Returns:
- Previous state for the operator. The previous state can be empty if the operator had no previous state.
-
getSubtaskJobManagerRestoredState
Optional<OperatorSubtaskState> getSubtaskJobManagerRestoredState(OperatorID operatorID)
Get the restored state from jobManager which belongs to an operator running in the owning task.- Parameters:
operatorID
- the id of the operator for which we request state.- Returns:
- the subtask restored state from jobManager.
-
createLocalRecoveryConfig
@Nonnull LocalRecoveryConfig createLocalRecoveryConfig()
Returns the configuration for local recovery, i.e. the base directories for all file-based local state of the owning subtask and the general mode for local recovery.
-
getSequentialChannelStateReader
SequentialChannelStateReader getSequentialChannelStateReader()
-
getStateChangelogStorage
@Nullable StateChangelogStorage<?> getStateChangelogStorage()
Returns the configured state changelog storage for this task.
-
getStateChangelogStorageView
@Nullable StateChangelogStorageView<?> getStateChangelogStorageView(Configuration configuration, ChangelogStateHandle changelogStateHandle)
Returns the state changelog storage view of givenChangelogStateHandle
for this task.
-
getFileMergingSnapshotManager
@Nullable FileMergingSnapshotManager getFileMergingSnapshotManager()
-
-