Package org.apache.flink.runtime.state
Interface TaskStateManager
-
- All Superinterfaces:
AutoCloseable,org.apache.flink.api.common.state.CheckpointListener
- All Known Implementing Classes:
TaskStateManagerImpl
public interface TaskStateManager extends org.apache.flink.api.common.state.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 LocalRecoveryConfigcreateLocalRecoveryConfig()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.FileMergingSnapshotManagergetFileMergingSnapshotManager()InflightDataRescalingDescriptorgetInputRescalingDescriptor()InflightDataRescalingDescriptorgetOutputRescalingDescriptor()Optional<Long>getRestoreCheckpointId()Acquires the checkpoint id to restore from.SequentialChannelStateReadergetSequentialChannelStateReader()StateChangelogStorage<?>getStateChangelogStorage()Returns the configured state changelog storage for this task.StateChangelogStorageView<?>getStateChangelogStorageView(org.apache.flink.configuration.Configuration configuration, ChangelogStateHandle changelogStateHandle)Returns the state changelog storage view of givenChangelogStateHandlefor this task.Optional<OperatorSubtaskState>getSubtaskJobManagerRestoredState(OperatorID operatorID)Get the restored state from jobManager which belongs to an operator running in the owning task.booleanisTaskDeployedAsFinished()Whether all the operators of the task are finished on restore.PrioritizedOperatorSubtaskStateprioritizedOperatorState(OperatorID operatorID)Returns means to restore previously reported state of an operator running in the owning task.voidreportIncompleteTaskStateSnapshots(CheckpointMetaData checkpointMetaData, CheckpointMetrics checkpointMetrics)Report the stats for state snapshots for an aborted checkpoint.voidreportInitializationMetrics(SubTaskInitializationMetrics subTaskInitializationMetrics)voidreportTaskStateSnapshots(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
-
-
-
-
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(org.apache.flink.configuration.Configuration configuration, ChangelogStateHandle changelogStateHandle)
Returns the state changelog storage view of givenChangelogStateHandlefor this task.
-
getFileMergingSnapshotManager
@Nullable FileMergingSnapshotManager getFileMergingSnapshotManager()
-
-