@Internal public class SharedStateRegistryImpl extends Object implements SharedStateRegistry
SharedStateRegistry
implementation.Modifier and Type | Class and Description |
---|---|
static class |
SharedStateRegistryImpl.EmptyDiscardStateObjectForRegister
An object with empty discardState for registering.
|
DEFAULT_FACTORY
Constructor and Description |
---|
SharedStateRegistryImpl()
Default uses direct executor to delete unreferenced state
|
SharedStateRegistryImpl(Executor asyncDisposalExecutor) |
Modifier and Type | Method and Description |
---|---|
void |
checkpointCompleted(long checkpointId) |
void |
close() |
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 newHandle,
long checkpointID,
boolean preventDiscardingCreatedCheckpoint)
Register a reference to the given shared state in the registry.
|
String |
toString() |
Set<Long> |
unregisterUnusedState(long lowestCheckpointID)
Unregister state that is not referenced by the given checkpoint ID or any newer.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
registerReference
public SharedStateRegistryImpl()
public SharedStateRegistryImpl(Executor asyncDisposalExecutor)
public StreamStateHandle registerReference(SharedStateRegistryKey registrationKey, StreamStateHandle newHandle, long checkpointID, boolean preventDiscardingCreatedCheckpoint)
SharedStateRegistry
IMPORTANT: the caller must use the returned state handle instead of the passed one because the registry might replace or update it.
registerReference
in interface SharedStateRegistry
newHandle
- 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.public Set<Long> unregisterUnusedState(long lowestCheckpointID)
SharedStateRegistry
unregisterUnusedState
in interface SharedStateRegistry
lowestCheckpointID
- which is still valid.public void registerAll(Iterable<? extends CompositeStateHandle> stateHandles, long checkpointID)
SharedStateRegistry
NOTE: For state from checkpoints from other jobs or runs (i.e. after recovery), please use
SharedStateRegistry.registerAllAfterRestored(CompletedCheckpoint, RestoreMode)
registerAll
in interface SharedStateRegistry
stateHandles
- The shared states to register.checkpointID
- which uses the states.public void registerAllAfterRestored(CompletedCheckpoint checkpoint, RestoreMode mode)
SharedStateRegistry
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.
registerAllAfterRestored
in interface SharedStateRegistry
public void checkpointCompleted(long checkpointId)
checkpointCompleted
in interface SharedStateRegistry
public void close()
close
in interface AutoCloseable
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.