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.
| Modifier and Type | Field and Description |
|---|---|
static SharedStateRegistryFactory |
DEFAULT_FACTORY
A singleton object for the default implementation of a
SharedStateRegistryFactory |
| Modifier and Type | Method and Description |
|---|---|
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.
|
StreamStateHandle |
registerReference(SharedStateRegistryKey registrationKey,
StreamStateHandle state,
long checkpointID)
Register a reference to the given shared state in the registry.
|
void |
unregisterUnusedState(long lowestCheckpointID)
Unregister state that is not referenced by the given checkpoint ID or any newer.
|
closestatic final SharedStateRegistryFactory DEFAULT_FACTORY
SharedStateRegistryFactoryStreamStateHandle registerReference(SharedStateRegistryKey registrationKey, StreamStateHandle state, long checkpointID)
IMPORTANT: caller should check the state handle returned by the result, because the registry is performing de-duplication and could potentially return a handle that is supposed to replace the one from the registration request.
state - the shared state for which we register a reference.checkpointID - which uses the statevoid unregisterUnusedState(long lowestCheckpointID)
lowestCheckpointID - which is still validvoid 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–2022 The Apache Software Foundation. All rights reserved.