RocksDB read snapshot
A RocksDB read snapshot is a handle selecting a point-in-time read view within a running database.
In the same database, set ReadOptions::snapshot to the acquired handle for reads of that view. GetSnapshot can return null; release a successful handle with ReleaseSnapshot when it is no longer needed, and do not reuse it afterward. [1]
The view does not survive database restart. With snapshot-preserving settings, flush and compaction retain versions needed by active snapshots, rather than guaranteeing retention of specific SST filenames. It is not a checkpoint directory or a backup. [2]
With unordered_write=true, pending lower-sequence writes may become visible after acquisition. Application compaction filters can change or remove snapshot-visible data. Both weaken an unconditional immutable-view assumption. [4] [5]
Relations
- related
- rocksdb-checkpoint, rocksdb-backup-engine, rocksdb-column-family, compaction, lsm-tombstone, snapshot
Citations
- RocksDB v10.10.1. db.h: GetSnapshot and ReleaseSnapshot.
- RocksDB project. Snapshot: lifetime, read visibility and compaction retention.
- RocksDB v10.10.1. options.h: buffering, atomic flush, write policy and snapshot immutability.
- RocksDB v10.10.1. compaction_filter.h: snapshot-visible data caveat.
Further reading
Sources & caveats
- API scope: ordinary RocksDB read snapshots, with v10.10.1 header and project Snapshot documentation; not a claim of distributed snapshot coordination.