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 Detail

      • 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.
      • 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.
      • getStateChangelogStorage

        @Nullable
        StateChangelogStorage<?> getStateChangelogStorage()
        Returns the configured state changelog storage for this task.