# Range-tombstone stacks: a native component observation

The v9.7.3 fragmenter can keep many sequence entries behind relatively few
nonoverlapping spans. This packet measures those two counts separately.
It extends [the LSM deletion analysis](https://hesela.com/analyses/lsm-tombstones-delete-persistence/#range-stacks)
and the [range-tombstone definition](https://hesela.dev/terms/range-tombstone/).

## Question and method

For n nested half-open ranges [i, 2n-i), give each input the distinct sequence
i+1. The native probe constructs RocksDB's FragmentedRangeTombstoneList directly
with its unmodified implementation. No database is opened. Keys are eight-digit
lowercase zero-padded hexadecimal ASCII strings, so BytewiseComparator agrees
with numeric order over the tested endpoints. Plain decimal strings would not.

The independent Python oracle enumerates all distinct endpoints and asks which
ranges cover each interval. Read mode retains every covering sequence.
Compaction mode keeps the newest covering sequence plus the newest sequence
visible to each supplied snapshot. This is a point-coverage specification,
not a transcription of the native sweep-line implementation.

The test matrix uses three shapes (nested, disjoint and coincident), n=1..64
and n=256, and four modes (read, compaction without snapshots, compaction with
one snapshot at floor(n/2), and compaction with snapshots at 1..n).
That is 780 component invocations. Comparisons include every span endpoint and
every retained sequence, not only totals. Each case stores a SHA-256 digest
of that full ordered list in results.json.

## Interpretation

Nested read-mode ranges give 2n-1 spans and n squared sequence entries.
Compaction without snapshots keeps one entry per span; a middle snapshot can
require another visible version. Snapshots at every input sequence retain all
versions in this construction. Disjoint and coincident controls distinguish
overlap from merely having many markers.

These are logical entries in native in-memory vectors, not allocated bytes.
The probe does not measure vector capacity, allocator overhead, build CPU,
lookup latency, cache state, output SST size, physical cleanup or recovery.
It does not execute a full compaction job. Duplicate sequence numbers and
user-defined timestamps are excluded; the latter follow a separate native path.
This is neither a GLORAN benchmark replication nor a claim that typical workloads
have this shape, and it makes no claim of algorithmic novelty.

## Reproduce

Use the source archive and hashes in sources.json. Keep RocksDB's Apache-2.0
license when redistributing its source. The probe and oracle here are Hesela
research code; no RocksDB implementation is copied into this packet.

Build the unmodified upstream static library from the archive:

```sh
make -C rocksdb-9.7.3 -j4 static_lib DEBUG_LEVEL=0 OPT=-O1 USE_RTTI=1 PORTABLE=1 DISABLE_WARNING_AS_ERROR=1
g++ -std=c++17 -O1 -DROCKSDB_PLATFORM_POSIX -DOS_LINUX -Irocksdb-9.7.3 -Irocksdb-9.7.3/include probe.cc rocksdb-9.7.3/librocksdb.a -lpthread -lrt -ldl -lz -o probe
python3 -B model.py --observe ./probe --output rerun.json
python3 -B model.py --check results.json
python3 -B -m unittest discover -s . -p test_model.py
python3 -B -O -m unittest discover -s . -p test_model.py
```

The link command records the Linux environment used here, with zlib detected.
Other platforms or optional libraries may require matching linker flags.
The last three commands check stored observations and the oracle; only
--observe executes the native component. Compilation artifacts are not shipped.

## Evidence and sources

- [Native observations](results.json), [native probe](probe.cc), [oracle](model.py),
  [regression tests](test_model.py), [source identity](sources.json).
- [RocksDB v9.7.3 fragmenter](https://github.com/facebook/rocksdb/blob/0e2801ac30b3f283c3b14e523ba3667eca024f09/db/range_tombstone_fragmenter.cc).
- [Upstream native test source](https://github.com/facebook/rocksdb/blob/0e2801ac30b3f283c3b14e523ba3667eca024f09/db/range_tombstone_fragmenter_test.cc):
  reviewed for the component interface, not represented as an executed upstream suite.
- [GLORAN v1](https://arxiv.org/html/2511.06061v1), sections 3, 4.4 and 6,
  motivates checking both representation and cost accounting. Its published
  measurements are not inputs to these counts.
