Range tombstone
A range tombstone is a versioned deletion marker that suppresses covered older keys across an ordered key interval.
RocksDB DeleteRange uses [start, end). In v9.7.3 equal endpoints are empty; reversed endpoints return InvalidArgument under the comparator. [4] [5] One logged entry goes into a dedicated memtable; insertion costs O(log T) in buffered tombstones, not covered keys. [1]
The example [c, d)@4, [g, h)@7 and [a, z)@10 produces five disjoint spans with seven sequence-tagged fragments (stacked versions). [3] [7]
A covering tombstone visible to the read snapshot can stop lower-level searches. The current table is still checked for newer point values and pending merge operands are resolved. [3] [7] [8]
The 2018 benchmark used 5 million keys, 10,000 tombstones and 10 runs, with the database in block cache. Point lookups took 0.6128 µs with fragmentation, 1.3179 µs unfragmented and 0.6036 µs after per-key scan-and-delete. Scans of up to 10 keys took 2.8226, 6.23 and 2.6844 µs respectively. These are that experiment's results, not universal latency estimates. [1]
Physical cleanup is separate and snapshot-sensitive. Range tombstones occupy SST meta-blocks and are truncated at file boundaries; compaction handles covered versions within snapshot stripes. [1] [3]
DeleteFilesInRange instead selects whole files, with different snapshot and endpoint rules. [6]
At commit 94c7f76da0ba it preserves the iterator sequence and retains point markers. Partial read views can disable it; read-write table_filter iterators are rejected when enabled. [9] [10]
A finite model separates hidden live keys, sequence changes and premature marker removal; it is not engine execution. [11]
Relations
- related
- LSM tombstone, Log-structured merge-tree, Sorted string table, RocksDB DeleteFilesInRange, Secondary range delete
Advantages
- Deleting a key range costs one logged write instead of a scan that reads and deletes every covered key. [1]
Limitations
- Very long range scans can be slower than after per-key deletes, because each memtable and file keeps its own tombstone iterator. [1]
Citations
- Abhishek Madan and Andrew Kryczka. DeleteRange: A New Native RocksDB Operation. RocksDB blog, 21 November 2018, including benchmark tables.
- RocksDB wiki: DeleteRange Implementation (tombstone fragments, read path, compaction and truncation)
- RocksDB v9.7.3. db.h: DeleteRange endpoint contract.
- RocksDB v9.7.3. WriteBatch memtable insertion: equal and reversed DeleteRange bounds.
- RocksDB v9.7.3. convenience.h: DeleteFilesInRange contract.
- RocksDB v9.7.3. FragmentedRangeTombstoneIterator: snapshot visibility and version stacks.
- RocksDB v9.7.3. TableCache::Get: range tombstone and point-value lookup.
- RocksDB commit 94c7f76da0ba751f1b686f43f4bedb5c58e1dc47. advanced_options.h: experimental conversion, visibility exclusions and table_filter rejection.
- RocksDB commit 94c7f76da0ba751f1b686f43f4bedb5c58e1dc47. db_iter.cc: read-path range conversion and sequence identity.
- Hesela. Tombstone conversion: finite read-equivalence model, code, tests and explicit limits.
Further reading
Sources & caveats
- delete-range is the November 2018 post by Madan and Kryczka (Meta), reread in full on the access date, including the benchmark tables.
- delete-range-impl is the engine's DeleteRange implementation wiki page, read in full for fragmentation, the read path, compaction and truncation.
- 5 million keys, 10,000 tombstones, 10 runs and the 0.6128, 1.3179, 0.6036, 2.8226, 6.23 and 2.6844 µs values come from delete-range. The seven-fragment example comes from delete-range-impl. The endpoint acceptance rule is corrected against the versioned API and insertion path.
- Endpoint correction: the wiki's set-theoretic empty-range description does not replace the v9.7.3 API error contract. [4] [5]
- Source-review correction: distinguish disjoint spans from stacked sequence versions and require read visibility before interpreting a covering tombstone.
- Conversion supplement reviewed against pinned source commit 94c7f76da0ba751f1b686f43f4bedb5c58e1dc47. Original educational model is separately labeled; no native engine execution.