Package org.apache.flink.runtime.state
Interface SharedStateRegistry
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
SharedStateRegistryImpl
This registry manages state that is shared across (incremental) checkpoints, and is responsible
for deleting shared state that is no longer used in any valid checkpoint.
A SharedStateRegistry will be deployed in the CheckpointCoordinator to keep track of
usage of StreamStateHandles by a key that (logically) identifies them.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SharedStateRegistryFactoryA singleton object for the default implementation of aSharedStateRegistryFactory -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckpointCompleted(long checkpointId) voidregisterAll(Iterable<? extends CompositeStateHandle> stateHandles, long checkpointID) Register given shared states in the registry.voidregisterAllAfterRestored(CompletedCheckpoint checkpoint, org.apache.flink.core.execution.RecoveryClaimMode mode) Set the lowest checkpoint ID below which no state is discarded, inclusive.default StreamStateHandleregisterReference(SharedStateRegistryKey registrationKey, StreamStateHandle state, long checkpointID) Shortcut forregisterReference(SharedStateRegistryKey, StreamStateHandle, long, boolean)with preventDiscardingCreatedCheckpoint = false.registerReference(SharedStateRegistryKey registrationKey, StreamStateHandle state, long checkpointID, boolean preventDiscardingCreatedCheckpoint) Register a reference to the given shared state in the registry.unregisterUnusedState(long lowestCheckpointID) Unregister state that is not referenced by the given checkpoint ID or any newer.Methods inherited from interface java.lang.AutoCloseable
close
-
Field Details
-
DEFAULT_FACTORY
A singleton object for the default implementation of aSharedStateRegistryFactory
-
-
Method Details
-
unregisterUnusedState
Unregister state that is not referenced by the given checkpoint ID or any newer.- Parameters:
lowestCheckpointID- which is still valid.- Returns:
- a set of checkpointID which is still in use.
-
registerAll
Register given shared states in the registry.NOTE: For state from checkpoints from other jobs or runs (i.e. after recovery), please use
registerAllAfterRestored(CompletedCheckpoint, RecoveryClaimMode)- Parameters:
stateHandles- The shared states to register.checkpointID- which uses the states.
-
registerAllAfterRestored
void registerAllAfterRestored(CompletedCheckpoint checkpoint, org.apache.flink.core.execution.RecoveryClaimMode mode) Set the lowest checkpoint ID below which no state is discarded, inclusive.After recovery from an incremental checkpoint, its state should NOT be discarded, even if
not usedanymore (unless recovering inCLAIMmode).This should hold for both cases: when recovering from that initial checkpoint; and from any subsequent checkpoint derived from it.
-
checkpointCompleted
void checkpointCompleted(long checkpointId)