Package org.apache.flink.runtime.state
Class TaskLocalStateStoreImpl
java.lang.Object
org.apache.flink.runtime.state.TaskLocalStateStoreImpl
- All Implemented Interfaces:
OwnedTaskLocalStateStore,TaskLocalStateStore
- Direct Known Subclasses:
ChangelogTaskLocalStateStore
Main implementation of a
TaskLocalStateStore.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AllocationIDAllocationID of the owning slot.protected final ExecutorExecutor that runs the discarding of released state objects.protected booleanStatus flag if this store was already discarded.protected final org.apache.flink.api.common.JobIDJobID from the owning subtask.protected final JobVertexIDJobVertexID of the owning subtask.protected final LocalRecoveryConfigThe configured mode for local recovery.protected final ObjectLock for synchronisation on the storage map and the discarded status.protected final SortedMap<Long,TaskStateSnapshot> Maps checkpoint ids to local TaskStateSnapshots.protected final intSubtask index of the owning subtask.static final String -
Constructor Summary
ConstructorsConstructorDescriptionTaskLocalStateStoreImpl(org.apache.flink.api.common.JobID jobID, AllocationID allocationID, JobVertexID jobVertexID, int subtaskIndex, LocalRecoveryConfig localRecoveryConfig, Executor discardExecutor) -
Method Summary
Modifier and TypeMethodDescriptionvoidabortCheckpoint(long abortedCheckpointId) Notifies that the checkpoint with the given id was confirmed as aborted.voidconfirmCheckpoint(long confirmedCheckpointId) Notifies that the checkpoint with the given id was confirmed as complete.protected voiddeleteDirectory(File directory) Helper method to delete a directory.dispose()Disposes the state of all local snapshots managed by this object.protected FilegetCheckpointDirectory(long checkpointId) Returns theLocalRecoveryConfigfor this task local state store.protected LocalSnapshotDirectoryProviderprotected voidpruneCheckpoints(LongPredicate pruningChecker, boolean breakOnceCheckerFalse) Pruning the useless checkpoints, it should be called only when holding thelock.voidpruneMatchingCheckpoints(LongPredicate matcher) Remove all checkpoints from the store that match the given predicate.retrieveLocalState(long checkpointID) Returns the local state that is stored under the given checkpoint id or null if nothing was stored under the id.voidstoreLocalState(long checkpointId, TaskStateSnapshot localState) Stores the local state for the given checkpoint id.toString()
-
Field Details
-
TASK_STATE_SNAPSHOT_FILENAME
- See Also:
-
jobID
@Nonnull protected final org.apache.flink.api.common.JobID jobIDJobID from the owning subtask. -
allocationID
AllocationID of the owning slot. -
jobVertexID
JobVertexID of the owning subtask. -
subtaskIndex
@Nonnegative protected final int subtaskIndexSubtask index of the owning subtask. -
localRecoveryConfig
The configured mode for local recovery. -
discardExecutor
Executor that runs the discarding of released state objects. -
lock
Lock for synchronisation on the storage map and the discarded status. -
disposed
protected boolean disposedStatus flag if this store was already discarded. -
storedTaskStateByCheckpointID
Maps checkpoint ids to local TaskStateSnapshots.
-
-
Constructor Details
-
TaskLocalStateStoreImpl
public TaskLocalStateStoreImpl(@Nonnull org.apache.flink.api.common.JobID jobID, @Nonnull AllocationID allocationID, @Nonnull JobVertexID jobVertexID, @Nonnegative int subtaskIndex, @Nonnull LocalRecoveryConfig localRecoveryConfig, @Nonnull Executor discardExecutor)
-
-
Method Details
-
storeLocalState
Description copied from interface:TaskLocalStateStoreStores the local state for the given checkpoint id.- Specified by:
storeLocalStatein interfaceTaskLocalStateStore- Parameters:
checkpointId- id for the checkpoint that created the local state that will be stored.localState- the local state to store.
-
getCheckpointDirectory
-
getLocalRecoveryDirectoryProvider
-
retrieveLocalState
Description copied from interface:TaskLocalStateStoreReturns the local state that is stored under the given checkpoint id or null if nothing was stored under the id.- Specified by:
retrieveLocalStatein interfaceTaskLocalStateStore- Parameters:
checkpointID- the checkpoint id by which we search for local state.- Returns:
- the local state found for the given checkpoint id. Can be null
-
getLocalRecoveryConfig
Description copied from interface:TaskLocalStateStoreReturns theLocalRecoveryConfigfor this task local state store.- Specified by:
getLocalRecoveryConfigin interfaceTaskLocalStateStore
-
confirmCheckpoint
public void confirmCheckpoint(long confirmedCheckpointId) Description copied from interface:TaskLocalStateStoreNotifies that the checkpoint with the given id was confirmed as complete. This prunes the checkpoint history and removes all local states with a checkpoint id that is smaller than the newly confirmed checkpoint id.- Specified by:
confirmCheckpointin interfaceTaskLocalStateStore
-
abortCheckpoint
public void abortCheckpoint(long abortedCheckpointId) Description copied from interface:TaskLocalStateStoreNotifies that the checkpoint with the given id was confirmed as aborted. This prunes the checkpoint history and removes states with a checkpoint id that is equal to the newly aborted checkpoint id.- Specified by:
abortCheckpointin interfaceTaskLocalStateStore
-
pruneMatchingCheckpoints
Description copied from interface:TaskLocalStateStoreRemove all checkpoints from the store that match the given predicate.- Specified by:
pruneMatchingCheckpointsin interfaceTaskLocalStateStore- Parameters:
matcher- the predicate that selects the checkpoints for pruning.
-
dispose
Disposes the state of all local snapshots managed by this object.- Specified by:
disposein interfaceOwnedTaskLocalStateStore
-
deleteDirectory
Helper method to delete a directory.- Throws:
IOException
-
pruneCheckpoints
Pruning the useless checkpoints, it should be called only when holding thelock. -
toString
-