K
- type of the backend keys.public abstract class RocksDBSnapshotStrategyBase<K> extends AbstractSnapshotStrategy<KeyedStateHandle> implements CheckpointListener
SnapshotStrategy
implementations for RocksDB state backend.Modifier and Type | Field and Description |
---|---|
protected CloseableRegistry |
cancelStreamRegistry
A
CloseableRegistry that will be closed when the task is cancelled. |
protected org.rocksdb.RocksDB |
db
RocksDB instance from the backend.
|
protected int |
keyGroupPrefixBytes
Number of bytes in the key-group prefix.
|
protected KeyGroupRange |
keyGroupRange
The key-group range for the task.
|
protected TypeSerializer<K> |
keySerializer
The key serializer of the backend.
|
protected LinkedHashMap<String,RocksDBKeyedStateBackend.RocksDbKvStateInfo> |
kvStateInformation
Key/Value state meta info from the backend.
|
protected LocalRecoveryConfig |
localRecoveryConfig
The configuration for local recovery.
|
protected ResourceGuard |
rocksDBResourceGuard
Resource guard for the RocksDB instance.
|
description
Constructor and Description |
---|
RocksDBSnapshotStrategyBase(String description,
org.rocksdb.RocksDB db,
ResourceGuard rocksDBResourceGuard,
TypeSerializer<K> keySerializer,
LinkedHashMap<String,RocksDBKeyedStateBackend.RocksDbKvStateInfo> kvStateInformation,
KeyGroupRange keyGroupRange,
int keyGroupPrefixBytes,
LocalRecoveryConfig localRecoveryConfig,
CloseableRegistry cancelStreamRegistry) |
Modifier and Type | Method and Description |
---|---|
protected abstract RunnableFuture<SnapshotResult<KeyedStateHandle>> |
doSnapshot(long checkpointId,
long timestamp,
CheckpointStreamFactory streamFactory,
CheckpointOptions checkpointOptions)
This method implements the concrete snapshot logic for a non-empty state.
|
RunnableFuture<SnapshotResult<KeyedStateHandle>> |
snapshot(long checkpointId,
long timestamp,
CheckpointStreamFactory streamFactory,
CheckpointOptions checkpointOptions)
Operation that writes a snapshot into a stream that is provided by the given
CheckpointStreamFactory and returns a @RunnableFuture that gives a state handle to
the snapshot. |
logAsyncCompleted, logSyncCompleted, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
notifyCheckpointAborted, notifyCheckpointComplete
@Nonnull protected org.rocksdb.RocksDB db
@Nonnull protected final ResourceGuard rocksDBResourceGuard
@Nonnull protected final TypeSerializer<K> keySerializer
@Nonnull protected final LinkedHashMap<String,RocksDBKeyedStateBackend.RocksDbKvStateInfo> kvStateInformation
@Nonnull protected final KeyGroupRange keyGroupRange
@Nonnegative protected final int keyGroupPrefixBytes
@Nonnull protected final LocalRecoveryConfig localRecoveryConfig
@Nonnull protected final CloseableRegistry cancelStreamRegistry
CloseableRegistry
that will be closed when the task is cancelled.public RocksDBSnapshotStrategyBase(@Nonnull String description, @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 public final RunnableFuture<SnapshotResult<KeyedStateHandle>> snapshot(long checkpointId, long timestamp, @Nonnull CheckpointStreamFactory streamFactory, @Nonnull CheckpointOptions checkpointOptions) throws Exception
SnapshotStrategy
CheckpointStreamFactory
and returns a @RunnableFuture
that gives a state handle to
the snapshot. It is up to the implementation if the operation is performed synchronous or
asynchronous. In the later case, the returned Runnable must be executed first before
obtaining the handle.snapshot
in interface SnapshotStrategy<SnapshotResult<KeyedStateHandle>>
checkpointId
- The ID of the checkpoint.timestamp
- The timestamp of the checkpoint.streamFactory
- The factory that we can use for writing our state to streams.checkpointOptions
- Options for how to perform this checkpoint.StateObject
.Exception
@Nonnull protected abstract RunnableFuture<SnapshotResult<KeyedStateHandle>> doSnapshot(long checkpointId, long timestamp, CheckpointStreamFactory streamFactory, CheckpointOptions checkpointOptions) throws Exception
Exception
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.