public interface SharedStateRegistry extends AutoCloseable
A SharedStateRegistry will be deployed in the CheckpointCoordinator to keep track of
usage of StreamStateHandles by a key that (logically) identifies them.
| 限定符和类型 | 字段和说明 |
|---|---|
static SharedStateRegistryFactory |
DEFAULT_FACTORY
A singleton object for the default implementation of a
SharedStateRegistryFactory |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
checkpointCompleted(long checkpointId) |
void |
registerAll(Iterable<? extends CompositeStateHandle> stateHandles,
long checkpointID)
Register given shared states in the registry.
|
void |
registerAllAfterRestored(CompletedCheckpoint checkpoint,
RestoreMode mode)
Set the lowest checkpoint ID below which no state is discarded, inclusive.
|
default StreamStateHandle |
registerReference(SharedStateRegistryKey registrationKey,
StreamStateHandle state,
long checkpointID)
Shortcut for
registerReference(SharedStateRegistryKey, StreamStateHandle, long,
boolean) with preventDiscardingCreatedCheckpoint = false. |
StreamStateHandle |
registerReference(SharedStateRegistryKey registrationKey,
StreamStateHandle state,
long checkpointID,
boolean preventDiscardingCreatedCheckpoint)
Register a reference to the given shared state in the registry.
|
Set<Long> |
unregisterUnusedState(long lowestCheckpointID)
Unregister state that is not referenced by the given checkpoint ID or any newer.
|
closestatic final SharedStateRegistryFactory DEFAULT_FACTORY
SharedStateRegistryFactorydefault StreamStateHandle registerReference(SharedStateRegistryKey registrationKey, StreamStateHandle state, long checkpointID)
registerReference(SharedStateRegistryKey, StreamStateHandle, long,
boolean) with preventDiscardingCreatedCheckpoint = false.StreamStateHandle registerReference(SharedStateRegistryKey registrationKey, StreamStateHandle state, long checkpointID, boolean preventDiscardingCreatedCheckpoint)
IMPORTANT: the caller must use the returned state handle instead of the passed one because the registry might replace or update it.
state - the shared state for which we register a reference.checkpointID - which uses the statepreventDiscardingCreatedCheckpoint - as long as this state is still in use. The
"checkpoint that created the state" is recorded on the first state registration.Set<Long> unregisterUnusedState(long lowestCheckpointID)
lowestCheckpointID - which is still valid.void registerAll(Iterable<? extends CompositeStateHandle> stateHandles, long checkpointID)
NOTE: For state from checkpoints from other jobs or runs (i.e. after recovery), please use
registerAllAfterRestored(CompletedCheckpoint, RestoreMode)
stateHandles - The shared states to register.checkpointID - which uses the states.void registerAllAfterRestored(CompletedCheckpoint checkpoint, RestoreMode mode)
After recovery from an incremental checkpoint, its state should NOT be discarded, even if
not used anymore (unless recovering in CLAIM mode).
This should hold for both cases: when recovering from that initial checkpoint; and from any subsequent checkpoint derived from it.
void checkpointCompleted(long checkpointId)
Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.