Module 8 · Dive 8.1
Fjall & the LSM-tree.
The Rust engine stores its pages in Fjall, a log-structured merge-tree. Writes land in an in-memory memtable; when it fills, it flushes whole to an immutable SSTable on disk; and compaction reclaims space by merging SSTables and dropping superseded versions. It is a different shape from CubDB’s copy-on-write B-tree (Module 4), but it keeps the same promise: files are written once and never mutated. Write, flush, and compact.
Memtable, flush, merge
interactiveTwo shapes, one immutability
graft.engine-split.design.mdCubDB and Fjall solve the same problem from opposite directions. The B-tree writes a new copy of the path on every change and keeps the tree balanced as it goes, so reads are a single descent but each write touches several nodes. The LSM-tree batches writes in memory and flushes them sequentially, so writes are cheap and append-only, but a read may have to check the memtable and several SSTables, and space is reclaimed later by compaction rather than immediately. What matters for the Volume contract is that both are immutable on disk: a flushed SSTable, like a written CubDB block, is never overwritten, so old versions stay readable and a crash can only ever lose the un-flushed memtable tail — which the commit log replays (Module 6). The engine picks the LSM shape for write-heavy page churn; the guarantees the rest of the platform depends on are unchanged. Next, how those SSTables and segments reach a remote that could be anything.
References & sources
- Echo records
- graft specs / graft.1.mdeg.1 — the core fork (Fjall retained, libgraft_ext removed)
- graft.roadmap.mdeg.1 — the core fork; Fjall retained as the local store
- graft.engine-split.design.mdecho_graft on Fjall, the LSM local store
- store.design.mdlocal page tier, flush + compaction
- External
- fjall-rs/fjallthe LSM-tree storage engine
- Log-structured merge-treememtable, SSTables, compaction
- B-treethe other shape (CubDB, Module 4)