Package org.apache.flink.runtime.state
Class TaskStateManagerImpl
java.lang.Object
org.apache.flink.runtime.state.TaskStateManagerImpl
- All Implemented Interfaces:
AutoCloseable,org.apache.flink.api.common.state.CheckpointListener,TaskStateManager
This class is the default implementation of
TaskStateManager and collaborates with the
job manager through CheckpointResponder) as well as a task-manager-local state store.
Like this, client code does not have to deal with the differences between remote or local state
on recovery because this class handles both cases transparently.
Reported state is tagged by clients so that this class can properly forward to the right receiver for the checkpointed state.
-
Constructor Summary
ConstructorsConstructorDescriptionTaskStateManagerImpl(org.apache.flink.api.common.JobID jobId, ExecutionAttemptID executionAttemptID, TaskLocalStateStore localStateStore, FileMergingSnapshotManagerClosableWrapper fileMergingSnapshotManager, StateChangelogStorage<?> stateChangelogStorage, TaskExecutorStateChangelogStoragesManager changelogStoragesManager, JobManagerTaskRestore jobManagerTaskRestore, CheckpointResponder checkpointResponder) TaskStateManagerImpl(org.apache.flink.api.common.JobID jobId, ExecutionAttemptID executionAttemptID, TaskLocalStateStore localStateStore, FileMergingSnapshotManagerClosableWrapper fileMergingSnapshotManager, StateChangelogStorage<?> stateChangelogStorage, TaskExecutorStateChangelogStoragesManager changelogStoragesManager, JobManagerTaskRestore jobManagerTaskRestore, CheckpointResponder checkpointResponder, SequentialChannelStateReaderImpl sequentialChannelStateReader) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()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.Acquires the checkpoint id to restore from.Returns the configured state changelog storage for this task.getStateChangelogStorageView(org.apache.flink.configuration.Configuration configuration, ChangelogStateHandle changelogStateHandle) Returns the state changelog storage view of givenChangelogStateHandlefor this task.getSubtaskJobManagerRestoredState(OperatorID operatorID) Get the restored state from jobManager which belongs to an operator running in the owning task.booleanWhether all the operators of the task are finished on restore.voidnotifyCheckpointAborted(long checkpointId) Tracking when some local state can be disposed.voidnotifyCheckpointComplete(long checkpointId) Tracking when local state can be confirmed and disposed.prioritizedOperatorState(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.
-
Constructor Details
-
TaskStateManagerImpl
public TaskStateManagerImpl(@Nonnull org.apache.flink.api.common.JobID jobId, @Nonnull ExecutionAttemptID executionAttemptID, @Nonnull TaskLocalStateStore localStateStore, @Nullable FileMergingSnapshotManagerClosableWrapper fileMergingSnapshotManager, @Nullable StateChangelogStorage<?> stateChangelogStorage, @Nonnull TaskExecutorStateChangelogStoragesManager changelogStoragesManager, @Nullable JobManagerTaskRestore jobManagerTaskRestore, @Nonnull CheckpointResponder checkpointResponder) -
TaskStateManagerImpl
public TaskStateManagerImpl(@Nonnull org.apache.flink.api.common.JobID jobId, @Nonnull ExecutionAttemptID executionAttemptID, @Nonnull TaskLocalStateStore localStateStore, @Nullable FileMergingSnapshotManagerClosableWrapper fileMergingSnapshotManager, @Nullable StateChangelogStorage<?> stateChangelogStorage, @Nonnull TaskExecutorStateChangelogStoragesManager changelogStoragesManager, @Nullable JobManagerTaskRestore jobManagerTaskRestore, @Nonnull CheckpointResponder checkpointResponder, @Nonnull SequentialChannelStateReaderImpl sequentialChannelStateReader)
-
-
Method Details
-
reportInitializationMetrics
- Specified by:
reportInitializationMetricsin interfaceTaskStateManager
-
reportTaskStateSnapshots
public void reportTaskStateSnapshots(@Nonnull CheckpointMetaData checkpointMetaData, @Nonnull CheckpointMetrics checkpointMetrics, @Nullable TaskStateSnapshot acknowledgedState, @Nullable TaskStateSnapshot localState) Description copied from interface:TaskStateManagerReport the state snapshots for the operator instances running in the owning task.- Specified by:
reportTaskStateSnapshotsin interfaceTaskStateManager- 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.
-
reportIncompleteTaskStateSnapshots
public void reportIncompleteTaskStateSnapshots(CheckpointMetaData checkpointMetaData, CheckpointMetrics checkpointMetrics) Description copied from interface:TaskStateManagerReport the stats for state snapshots for an aborted checkpoint.- Specified by:
reportIncompleteTaskStateSnapshotsin interfaceTaskStateManager- Parameters:
checkpointMetaData- meta data from the checkpoint request.checkpointMetrics- task level metrics for the checkpoint.
-
getInputRescalingDescriptor
- Specified by:
getInputRescalingDescriptorin interfaceTaskStateManager
-
getOutputRescalingDescriptor
- Specified by:
getOutputRescalingDescriptorin interfaceTaskStateManager
-
isTaskDeployedAsFinished
public boolean isTaskDeployedAsFinished()Description copied from interface:TaskStateManagerWhether all the operators of the task are finished on restore.- Specified by:
isTaskDeployedAsFinishedin interfaceTaskStateManager
-
getRestoreCheckpointId
Description copied from interface:TaskStateManagerAcquires the checkpoint id to restore from.- Specified by:
getRestoreCheckpointIdin interfaceTaskStateManager
-
prioritizedOperatorState
Description copied from interface:TaskStateManagerReturns means to restore previously reported state of an operator running in the owning task.- Specified by:
prioritizedOperatorStatein interfaceTaskStateManager- 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
Description copied from interface:TaskStateManagerGet the restored state from jobManager which belongs to an operator running in the owning task.- Specified by:
getSubtaskJobManagerRestoredStatein interfaceTaskStateManager- Parameters:
operatorID- the id of the operator for which we request state.- Returns:
- the subtask restored state from jobManager.
-
createLocalRecoveryConfig
Description copied from interface:TaskStateManagerReturns 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.- Specified by:
createLocalRecoveryConfigin interfaceTaskStateManager
-
getSequentialChannelStateReader
- Specified by:
getSequentialChannelStateReaderin interfaceTaskStateManager
-
getStateChangelogStorage
Description copied from interface:TaskStateManagerReturns the configured state changelog storage for this task.- Specified by:
getStateChangelogStoragein interfaceTaskStateManager
-
getStateChangelogStorageView
@Nullable public StateChangelogStorageView<?> getStateChangelogStorageView(org.apache.flink.configuration.Configuration configuration, ChangelogStateHandle changelogStateHandle) Description copied from interface:TaskStateManagerReturns the state changelog storage view of givenChangelogStateHandlefor this task.- Specified by:
getStateChangelogStorageViewin interfaceTaskStateManager
-
getFileMergingSnapshotManager
- Specified by:
getFileMergingSnapshotManagerin interfaceTaskStateManager
-
notifyCheckpointComplete
Tracking when local state can be confirmed and disposed.- Specified by:
notifyCheckpointCompletein interfaceorg.apache.flink.api.common.state.CheckpointListener- Throws:
Exception
-
notifyCheckpointAborted
public void notifyCheckpointAborted(long checkpointId) Tracking when some local state can be disposed.- Specified by:
notifyCheckpointAbortedin interfaceorg.apache.flink.api.common.state.CheckpointListener
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-