public interface SharedStateRegistry extends AutoCloseable
A SharedStateRegistry
will be deployed in the CheckpointCoordinator
to keep track of
usage of StreamStateHandle
s 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.
|
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.
|
close
static final SharedStateRegistryFactory DEFAULT_FACTORY
SharedStateRegistryFactory
default 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: 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 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.