Skip to content

Research notes / Database storage

LSM tombstones: deleted is not yet reclaimed

Updated / Primary-source review

A successful delete can hide a key while its old value still occupies storage. Reclaiming that space too early can break snapshot reads or expose an older value again. Visibility, durability and reclamation need separate evidence.

On this page10 sections

Why an absent key needs a record

In LevelDB, sorted tables contain values and deletion markers. The marker tells a lookup not to accept an obsolete value in an older table. Compaction merges files and can discard obsolete versions; an ordinary deletion marker can be removed when deeper levels cannot contain an older value it must hide. [1]

Consider an upper table containing DELETE k and a lower table containing k = old. Removing only the marker would make the obsolete value eligible again. This two-record counterexample explains why counting tombstones is not enough to decide which bytes are garbage. It is an illustration, not an observed incident.

The same distinction matters for Bloom filters: membership in a file is not proof that a key is live in the database.

Three completion questions

Visibility
Does the intended read view still return the key?
Durability
Will the deletion survive the failure model being tested?
Reclamation
Have obsolete versions and unneeded files actually been removed?

RocksDB's synchronous-write option controls persistence of a write. Ordinary asynchronous acknowledgement is not the same promise after a machine crash. [3] Conversely, a persisted deletion marker does not imply that older SST contents have been rewritten. Recording the instruction and completing the cleanup are distinct events.

RocksDB snapshots preserve a sequence-number view and do not survive database restarts. They are not volume snapshots or independent backup copies. [2] The following invented trace assumes ordinary, non-transactional snapshot semantics, snapshot-preserving settings and no concurrent writes:

One key, two views. Sequence numbers are ordering labels, not elapsed time.
EventLatest viewSnapshot S at 10
10: put k = old; create Soldold
11: delete kabsentold
Compact while S existsabsentold must remain readable
Release Sabsentview no longer available

The old value must remain available for S, but releasing S does not itself execute compaction or prove a byte count was reclaimed. Read the table as a correctness requirement, not as a prediction of file layout or cleanup time.

SingleDelete trades a stronger contract for earlier cleanup

Use SingleDelete only when the application can establish the key's write history. The v9.7.3 API requires one Put since the previous SingleDelete, without an intervening overwrite. Mixing ordinary Delete or Merge into that key's history is outside its contract. A current Get cannot prove how many writes produced the visible value. [8]

The benefit comes during compaction: a matching deletion and value can cancel without waiting for the ordinary tombstone's no-older-value check. Snapshot visibility and transaction conflict checks still apply. [9] The following histories are contract examples, not results from running RocksDB.

One initially unused key; operations in time order. SD means SingleDelete.
HistoryWhat can be concluded?
Put(a); SD; Put(b); SDMatches the one-Put-per-cycle rule; cleanup remains conditional.
Put(a); Put(b); SDOverwrite violates the contract; no particular recovered value is promised.
Put(a); Delete; SDMixes deletion types; a later compaction can reject the combination.
Put(a); snapshot S; SDWith ordinary snapshot-preserving settings, S still needs a.

Retained records do not always mean retained payload

The upstream tests distinguish two cases. In SingleDeleteAcrossSnapshotBoundary, the earlier read view keeps the value available. In KeepSingleDeletionForWriteConflictChecking, the marker and Put record remain but the value becomes empty: their sequence history is needed to detect a conflicting write, not to serve that payload. These are source-reviewed test expectations, not tests executed by Hesela. [10]

This explains why tombstone counts, retained record counts and retained value bytes can move differently. Treating every surviving marker as removable waste can break correctness.

A successful write is not a history audit

In v9.7.3, enforce_single_del_contracts defaults to true. When compaction encounters the documented SD/Delete mismatch, enforcement returns a corruption status. Setting it false is a migration escape hatch, not a way to make that history valid. [11]

Our operational inference: audit all writers, retries and import paths before substituting this API for ordinary deletion. Do not treat the absence of a compaction error as proof that an overwrite never happened. Track write status and background compaction status separately. The exact implementation described here is v9.7.3, not every RocksDB release.

Corpus: RocksDB SingleDelete and RocksDB read snapshot.

Range deletion is not a faster erase command

RocksDB's DeleteRange records a tombstone for a half-open interval: the start is included and the end excluded. It avoids issuing a separate delete for every key, but does not synchronously wipe the underlying values. Its design separates logical deletion from background cleanup. [4]

Coverage alone is insufficient for a point read: the range tombstone must be visible to that read. The engine still checks the current table for newer point values and resolves pending merge operands. An earlier snapshot can therefore need data that a later read treats as deleted. [19] [20]

Likewise, an instruction to compact needs a defined scope. RocksDB documents options that can skip bottommost-level files and options controlling whether manual compaction waits to avoid write stalls. A returned compaction call is not a universal certificate that every obsolete byte was rewritten. Inspect the selected range, options, status and retained readers. [7]

Deleting whole files changes the contract

DeleteFilesInRange is not shorthand for DeleteRange. In RocksDB v9.7.3, it selects eligible SST files, leaves L0 untouched and defaults to include_end = true. Older snapshots may lose access to removed data. A file crossing the requested boundary can retain keys inside it. [12]

Version-scoped contracts, not results from an engine benchmark.
QuestionDeleteRangeDeleteFilesInRange
What is changed?A versioned deletion marker for a key interval.Selected whole SST files are removed from the current version.
Ending keyExcluded.Included by default; configurable.
Earlier read snapshotOrdinary snapshot-preserving semantics apply.Not a promise to preserve access to deleted files.
Can successful return leave keys in the interval?Later writes can be visible.Yes, including keys in L0 or boundary-crossing files.

Even the meaning of an empty range needs care. For DeleteRange, the v9.7.3 write path accepts equal endpoints as empty, but returns InvalidArgument when the end precedes the start under the configured comparator. Do not turn a mathematical empty-set rule into an API-success rule. [16]

The file-removal path skips files already being compacted. If no files qualify, it can return OK without recording any removal. Our operational inference: check read visibility and live-file metadata separately before treating success as completed cleanup. [13]

A removal pause is not a database freeze

DisableFileDeletions pauses obsolete-file removal while compactions continue. It is not a read snapshot or a complete backup. The live-copy contract also requires file enumeration and copying. [17]

The pause is nested: after two disables and one enable, removal remains paused even though EnableFileDeletions returns OK. Only when the counter reaches zero does that implementation discover obsolete files and invoke purging if candidates exist. This source-derived example does not establish a reclaimed-byte count. [18]

There is a second limit: this v9.7.3 enable path returns OK and does not propagate individual file-removal errors. The removal helper logs those outcomes and reports table-file status through file-deletion events. Check those observations and filesystem usage before concluding that storage was reclaimed. [18]

Corpus: RocksDB file-deletion pause.

Why a contained file may still need its neighbor

Consider an illustration with two adjacent files sharing key 1: file A holds its newer value and file B its older value. Removing only A could make the older value visible again. The versioned upstream test DeleteFileRangeFileEndpointsOverlapBug exercises that shape. The test was source-reviewed, not executed by Hesela. [14]

The selection helper avoids splitting a shared-key boundary between selected files and their neighbors. This is a correctness restriction on file selection, not evidence that v9.7.3 has the historical bug. [15] Ordinary key-range containment is therefore insufficient as a standalone cleanup algorithm.

Corpus: RocksDB DeleteFilesInRange.

Lethe treats deletion delay as a design target

Sarkar and colleagues' Lethe paper defines delete persistence latency as the delay from inserting a tombstone to removing the invalidated entries through compaction. FADE uses deletion age and file metadata to schedule cleanup; KiWi organizes pages around both a lookup key and a secondary deletion attribute. The latter addresses cases such as time-based expiration in data sorted by ID. [5, sections 3-4]

Its evaluation is a synthetic, RocksDB-based experiment, not a fleet study. The reported default setup uses 1 KB entries, a 1 MB buffer and a 1 GB load; WAL is disabled and compactions take priority over writes. Delete thresholds are fractions of experiment runtime. These choices limit transfer to a durable, latency-sensitive service. We reviewed the updated manuscript, including its methodology; we did not reproduce its performance measurements. [5, section 5]

KiWi addresses a different boundary from whole-SST deletion: pages within each delete tile are arranged by a secondary deletion key, while entries within a page remain sorted by the lookup key. Fully covered pages can be dropped; boundary pages containing surviving entries need processing. This changes the physical layout and lookup trade-off. It is not a flag that makes ordinary DeleteFilesInRange perform a secondary-key predicate. [5, section 4.2]

A 2026 optimization, and its safety boundary

RocksDB documents adding a redundant range marker during iteration to accelerate later scans. Its June 2026 announcement reports availability from 11.3.0; zero disables min_tombstones_for_range_conversion. Original point markers remain until ordinary cleanup. A partial view can miss live keys inside a proposed interval. [6]

The reviewed source commit 94c7f76da0ba labels conversion experimental. Restricted read tiers, incomplete timestamp views and some prefix configurations disable it. Separately, read-write iterators with table_filter are rejected while the option is enabled. A skipped optimization and an iterator error are different outcomes: inspect iterator status. These are commit-scoped source contracts, not native tests or promises about every release. [21]

The iterator uses its read sequence for the added marker, not a fresh application-write sequence. Further guards concern memtable rotation, transaction visibility and external-file ingestion. Our model below isolates read equivalence; it does not reproduce those implementation guards. [22]

Five executable counterexamples and controls

Our invented key space is a < b < c. A point event is visible at or after its sequence; a visible range hides covered values at an equal or earlier sequence. value@4 means a value written at sequence 4, not four seconds. Every row below is computed from the downloadable model, not manually transcribed.

Invented histories: baseline versus deliberately altered history. Not a RocksDB execution.
Case and read viewBeforeAfter
An unseen live key inside the range
Infer [a,c) from only the a deletion and c boundary; miss b.
Read b at 3.
value@1absent
A new write after the scan
Observe absence at 3, but stamp the summary with 5.
Read a at 5.
value@4absent
An earlier snapshot still needs the marker
Add summary at 3 and remove the point deletion at 2.
Read a at 2.
absentvalue@1
Same snapshot, original markers retained
Summarize absence at 3 with sequence 3; retain the point events.
Read a at 5.
value@4value@4
The ending key is outside the interval
Add [a,c) at 3; retain the point events.
Read c at 3.
value@3value@3

The first case loses b, which was never deleted. The second loses a reinserted value by using sequence 5 for an absence observed at 3. The third removes a deletion at 2 while adding a summary at 3: a reader at 2 can see the old value again. Keeping the original history and sequence avoids those particular changes; the excluded end remains readable.

The bounded check enumerates all 1296 four-event Put/Delete histories over three keys. It considers 5184 history/snapshot pairs and accepts 2496 where both interior keys are absent. Retaining point history and adding [a,c) at that same snapshot preserves 44928 key/view comparisons, with0 differences. Views 0 through 5 include earlier snapshots and later writes. This exhaustive result covers only that finite model; it is neither a failure-rate estimate nor an engine correctness proof.

Model code, tests, complete histories and results and method and reproduction. Run node model.mjs and node --test model.test.mjs. No engine, device or additional package is required.

This also separates the research questions: Lethe's FADE schedules physical cleanup using deletion age; a redundant read-path summary changes scan work while old entries can remain. Faster reads therefore do not establish a shorter erasure deadline. This comparison is our interpretation of different mechanisms, not a head-to-head experiment. [5, sections 3-5]

Repair does not make a later archive import deletion-safe

Repair compares the selected current replicas; a snapshot is a separate set of retained SSTables. Cassandra's backup documentation and loader implementation describe preserving those files and later streaming their stored data. They do not turn an older snapshot into a record of subsequent deletions. [23] [24] [25]

Our constructed one-cell model starts with an archive containing old@10. Every active replica then receives delete@20. We grant ideal complete reconciliation and eligible local purge, leaving all three replicas empty. Importing the unchanged old@10 makes that value visible again; another reconciliation spreads it. Absence carries no timestamp that can defeat the import.

This is a model, not a Cassandra run. Its ordinary-cell ordering follows the pinned 5.0.0 reconciliation code. Its purge gate abstracts age, local coverage and repaired-data eligibility; it does not implement SSTable metadata or a native compaction job. Mutation timestamps 10, 20 and 30 are ordering labels, distinct from deletion-clock seconds.[26] [27] [28]

Eight constructed controls. Immediate means replica 0 just after import; final means every replica after ideal complete reconciliation.
ControlRecovery objectiveImmediate valueFinal value
Purged; no importpreserve deletion at 20absentabsent
Purged; old archive importedpreserve deletion at 20oldold
Deletion retained everywherepreserve deletion at 20absentabsent
Deletion retained at replica 2 onlypreserve deletion at 20oldabsent
Newer live value retainedpreserve newer value at 30newnew
Import includes deletionpreserve deletion at 20absentabsent
Unrepaired inputs prevent purgepreserve deletion at 20absentabsent
Isolated historical restorerestore historical value at 10oldold

Keeping a marker at replica 2 suppresses the old value after reconciliation, but replica 0 can expose it beforehand. This is not a claim about a particular read consistency level. A newer legitimate live write also wins: preventing an obsolete value from returning is not equivalent to keeping a key deleted.

The stale-import and isolated-historical-restore controls use identical empty target states and incoming value. One violates the current deletion objective; the other meets the historical objective. Therefore equal bytes, a successful load and agreement among replicas cannot select the intended recovery history for the operator.

State the recovery objective before admitting old data

Our derived recommendation is to record the intended target epoch, archive identity and lineage, whether original mutation timestamps survive import, which later deletions must remain effective, and the independent evidence that enforces them. Isolate a deliberate historical restore from a current service until that policy is decided. No finite grace interval alone covers arbitrarily late admission of old data; increasing a timeout is not a universal solution. This is not a recommendation to retain all markers forever.

Lethe's FADE addresses a different boundary: it schedules tombstones through the active LSM tree and discusses purging obsolete WAL records.[5, section 4.1] Our inference is that this engine-level cleanup deadline does not certify a later import from an independently retained archive. A backup can preserve its intended historical bytes while being unsuitable for admission to the current deletion history. These are complementary acceptance questions, not a measured failure of Lethe.

Under the fixed assumptions, enumeration checks 1302designed marker/import combinations for one through five replicas. These are not probabilities or independent observations. No TTL, counters, row/range deletions, topology changes, concurrent writes, native loader receive path or storage fault was tested. This does not establish physical sanitization or a new Cassandra defect.

Reproduce with Python 3.10+ and its standard library:code and evidence package, complete results, eight pinned source receipts and method and commands. The original eight controls and their numerical evidence are unchanged.

Related: replica repair coverage, backup verification versus restore acceptance and the corpus records for anti-entropy repair and backup manifests.

An investigation checklist, not a tuning recipe

For a delete-heavy service, record the exact engine build, write options, compaction policy and active readers before comparing runs. Keep the same initial data, key ordering, deletion fraction and foreground load. Compare runs with a retained snapshot and with it released, using copies of test data.

Measure separate endpoints: read visibility, recovery after the specified fault, obsolete-file removal and allocated filesystem bytes. Add foreground latency percentiles, bytes read and written by compaction, and the age of outstanding deletions. A successful lookup check cannot substitute for these other observations. This is our proposed validation protocol, not a completed benchmark.

Finally, database cleanup says nothing by itself about copies in backups, replicas, filesystem snapshots or remapped flash. Establish those boundaries separately; see SSD sanitization evidence and discard versus zeroing. No media-sanitization or compliance guarantee follows from this review.

Corpus: LSM tombstone, range tombstone, delete persistence latency.

Primary sources

  1. LevelDB project. Implementation: sorted tables and compaction.
  2. RocksDB project. Snapshot: sequence numbers, point-in-time reads and lifetime.
  3. RocksDB project. Basic Operations: synchronous and non-sync writes.
  4. Abhishek Madan and Andrew Kryczka. DeleteRange: A New Native RocksDB Operation. RocksDB, 21 November 2018.
  5. Subhadeep Sarkar, Tarikul Islam Papon, Dimitris Staratzis and Manos Athanassoulis. Lethe: A Tunable Delete-Aware LSM Engine. SIGMOD 2020. Updated manuscript arXiv:2006.04777v4, sections 3-5. DOI: 10.1145/3318464.3389757.
  6. Josh Kang. Range Tombstone Conversion: Faster Scans Over Long Runs of Deletes. RocksDB, 22 June 2026.
  7. RocksDB project. Manual Compaction: range, bottommost-level and stall options.
  8. RocksDB v9.7.3. db.h: SingleDelete caller contract.
  9. RocksDB v9.7.3. CompactionIterator::NextFromInput: SingleDelete pairing, snapshot and conflict checks.
  10. RocksDB v9.7.3. Compaction iterator tests: snapshot boundaries and write-conflict retention.
  11. RocksDB v9.7.3. options.h: enforce_single_del_contracts.
  12. RocksDB v9.7.3. convenience.h: DeleteFilesInRange contract.
  13. RocksDB v9.7.3. DBImpl::DeleteFilesInRanges: selection, compaction exclusions and version edits.
  14. RocksDB v9.7.3. DBDeleteFileRangeTest: range boundaries, L0 and shared-endpoint regression.
  15. RocksDB v9.7.3. VersionStorageInfo::GetCleanInputsWithinInterval and endpoint grouping.
  16. RocksDB v9.7.3. WriteBatch memtable insertion: equal and reversed DeleteRange bounds.
  17. RocksDB v9.7.3. db.h: nested file-deletion pauses and live-copy enumeration.
  18. RocksDB v9.7.3. DBImpl file deletion: counter release, candidate discovery and purging.
  19. RocksDB v9.7.3. FragmentedRangeTombstoneIterator: snapshot visibility and version stacks.
  20. RocksDB v9.7.3. TableCache::Get: range tombstone and point-value lookup.
  21. RocksDB commit 94c7f76da0ba751f1b686f43f4bedb5c58e1dc47. advanced_options.h: experimental conversion, visibility exclusions and table_filter rejection.
  22. RocksDB commit 94c7f76da0ba751f1b686f43f4bedb5c58e1dc47. db_iter.cc: read-path range conversion and sequence identity.
  23. Apache Cassandra 5.0.0. Repair: current replica scope.
  24. Apache Cassandra 5.0.0. Backups: retained SSTable copies.
  25. Apache Cassandra 5.0.0. SSTableLoader: opening and streaming existing data.
  26. Apache Cassandra 5.0.0. Cells: regular-cell timestamp reconciliation.
  27. Apache Cassandra 5.0.0. PurgeFunction: deletion time and timestamp gates.
  28. Apache Cassandra 5.0.0. CompactionController: local overlap and repaired inputs.

Archive-import sources reviewed 3 November 2026; file-deletion sources reviewed 23 October 2026; SingleDelete review 20 October 2026; earlier review 12 October 2026. No copied figures, hardware experiment or new performance result. Source works retain their own rights.

Published by Hesela team · Published · Updated

Report a correction · Editorial standards · Reuse guidance

Change history

: first published.

: latest recorded update. A detailed change note is not available for this revision.

New-publication RSS · Correction RSS

Cite this page
Hesela team. LSM tombstones: deleted is not yet reclaimed. Hesela. 2026-11-03. https://hesela.com/analyses/lsm-tombstones-delete-persistence/