Skip to main content

Module mutable_run

Module mutable_run 

Source
Expand description

Mutable run tier — the LSM layer between the skip-list memtable and the immutable .sr sorted runs (Phase 11.1).

A flush drains the live memtable into this in-memory tier instead of immediately writing a new sorted run. The tier is a crate::pma::Pma keyed by the composite (RowId, Epoch) version key, so it stays sorted (the natural order RunWriter consumes) and absorbs further flushes in place with amortized O(log² n) inserts — exactly the “cache-oblivious mutable sorted run” described in §2. Only once the tier crosses a byte watermark does it spill to an immutable sorted run on disk, coalescing many small flushes into one larger run (fewer runs ⇒ fewer reader merges ⇒ faster scans).

MVCC semantics mirror crate::memtable::Memtable: every version is kept, keyed by (RowId, Epoch); a snapshot read returns the newest version with epoch <= snapshot. The tier is purely in-memory and rebuilds from WAL replay on reopen, so it carries no on-disk state of its own.

Structs§

MutableRun
The PMA-backed mutable run tier. Holds flushed-but-not-yet-spilled rows in sorted (RowId, Epoch) order.