K
- type of the backend keys.public class RocksIncrementalSnapshotStrategy<K> extends RocksDBSnapshotStrategyBase<K,RocksDBSnapshotStrategyBase.NativeRocksDBSnapshotResources>
RocksDBKeyedStateBackend
that is based on RocksDB's native checkpoints and creates incremental snapshots.RocksDBSnapshotStrategyBase.NativeRocksDBSnapshotResources, RocksDBSnapshotStrategyBase.PreviousSnapshot, RocksDBSnapshotStrategyBase.RocksDBSnapshotOperation
SnapshotStrategy.SnapshotResultSupplier<S extends StateObject>
backendUID, db, EMPTY_PREVIOUS_SNAPSHOT, instanceBasePath, keyGroupPrefixBytes, keyGroupRange, keySerializer, kvStateInformation, localDirectoryName, localRecoveryConfig, rocksDBResourceGuard
Constructor and Description |
---|
RocksIncrementalSnapshotStrategy(org.rocksdb.RocksDB db,
ResourceGuard rocksDBResourceGuard,
TypeSerializer<K> keySerializer,
LinkedHashMap<String,RocksDBKeyedStateBackend.RocksDbKvStateInfo> kvStateInformation,
KeyGroupRange keyGroupRange,
int keyGroupPrefixBytes,
LocalRecoveryConfig localRecoveryConfig,
CloseableRegistry cancelStreamRegistry,
File instanceBasePath,
UUID backendUID,
SortedMap<Long,Collection<IncrementalKeyedStateHandle.HandleAndLocalPath>> uploadedStateHandles,
RocksDBStateUploader rocksDBStateUploader,
long lastCompletedCheckpointId) |
Modifier and Type | Method and Description |
---|---|
SnapshotStrategy.SnapshotResultSupplier<KeyedStateHandle> |
asyncSnapshot(RocksDBSnapshotStrategyBase.NativeRocksDBSnapshotResources snapshotResources,
long checkpointId,
long timestamp,
CheckpointStreamFactory checkpointStreamFactory,
CheckpointOptions checkpointOptions)
Operation that writes a snapshot into a stream that is provided by the given
CheckpointStreamFactory and returns a @SupplierWithException that gives a state
handle to the snapshot. |
void |
close() |
void |
notifyCheckpointAborted(long abortedCheckpointId)
This method is called as a notification once a distributed checkpoint has been aborted.
|
void |
notifyCheckpointComplete(long completedCheckpointId)
Notifies the listener that the checkpoint with the given
checkpointId completed and
was committed. |
protected RocksDBSnapshotStrategyBase.PreviousSnapshot |
snapshotMetaData(long checkpointId,
List<StateMetaInfoSnapshot> stateMetaInfoSnapshots) |
cleanupIncompleteSnapshot, getDescription, materializeMetaData, prepareLocalSnapshotDirectory, syncPrepareResources
public RocksIncrementalSnapshotStrategy(@Nonnull org.rocksdb.RocksDB db, @Nonnull ResourceGuard rocksDBResourceGuard, @Nonnull TypeSerializer<K> keySerializer, @Nonnull LinkedHashMap<String,RocksDBKeyedStateBackend.RocksDbKvStateInfo> kvStateInformation, @Nonnull KeyGroupRange keyGroupRange, @Nonnegative int keyGroupPrefixBytes, @Nonnull LocalRecoveryConfig localRecoveryConfig, @Nonnull CloseableRegistry cancelStreamRegistry, @Nonnull File instanceBasePath, @Nonnull UUID backendUID, @Nonnull SortedMap<Long,Collection<IncrementalKeyedStateHandle.HandleAndLocalPath>> uploadedStateHandles, @Nonnull RocksDBStateUploader rocksDBStateUploader, long lastCompletedCheckpointId)
public SnapshotStrategy.SnapshotResultSupplier<KeyedStateHandle> asyncSnapshot(RocksDBSnapshotStrategyBase.NativeRocksDBSnapshotResources snapshotResources, long checkpointId, long timestamp, @Nonnull CheckpointStreamFactory checkpointStreamFactory, @Nonnull CheckpointOptions checkpointOptions)
SnapshotStrategy
CheckpointStreamFactory
and returns a @SupplierWithException
that gives a state
handle to the snapshot.checkpointId
- The ID of the checkpoint.timestamp
- The timestamp of the checkpoint.checkpointStreamFactory
- The factory that we can use for writing our state to streams.checkpointOptions
- Options for how to perform this checkpoint.StateObject
.public void notifyCheckpointComplete(long completedCheckpointId)
CheckpointListener
checkpointId
completed and
was committed.
These notifications are "best effort", meaning they can sometimes be skipped. To behave
properly, implementers need to follow the "Checkpoint Subsuming Contract". Please see the
class-level JavaDocs
for details.
Please note that checkpoints may generally overlap, so you cannot assume that the notifyCheckpointComplete()
call is always for the latest prior checkpoint (or snapshot) that
was taken on the function/operator implementing this interface. It might be for a checkpoint
that was triggered earlier. Implementing the "Checkpoint Subsuming Contract" (see above)
properly handles this situation correctly as well.
Please note that throwing exceptions from this method will not cause the completed checkpoint to be revoked. Throwing exceptions will typically cause task/job failure and trigger recovery.
completedCheckpointId
- The ID of the checkpoint that has been completed.public void notifyCheckpointAborted(long abortedCheckpointId)
CheckpointListener
Important: The fact that a checkpoint has been aborted does NOT mean that the data
and artifacts produced between the previous checkpoint and the aborted checkpoint are to be
discarded. The expected behavior is as if this checkpoint was never triggered in the first
place, and the next successful checkpoint simply covers a longer time span. See the
"Checkpoint Subsuming Contract" in the class-level JavaDocs
for
details.
These notifications are "best effort", meaning they can sometimes be skipped.
This method is very rarely necessary to implement. The "best effort" guarantee, together with the fact that this method should not result in discarding any data (per the "Checkpoint Subsuming Contract") means it is mainly useful for earlier cleanups of auxiliary resources. One example is to pro-actively clear a local per-checkpoint state cache upon checkpoint failure.
abortedCheckpointId
- The ID of the checkpoint that has been aborted.public void close()
close
in interface AutoCloseable
close
in class RocksDBSnapshotStrategyBase<K,RocksDBSnapshotStrategyBase.NativeRocksDBSnapshotResources>
protected RocksDBSnapshotStrategyBase.PreviousSnapshot snapshotMetaData(long checkpointId, @Nonnull List<StateMetaInfoSnapshot> stateMetaInfoSnapshots)
snapshotMetaData
in class RocksDBSnapshotStrategyBase<K,RocksDBSnapshotStrategyBase.NativeRocksDBSnapshotResources>
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.