Crash-consistent copy-on-write B+tree

DesignHard50 min

Your task

Design a single-node embedded storage engine that achieves crash-consistency WITHOUT a traditional write-ahead log, a copy-on-write B+tree (LMDB/Btrfs-class) where updates never overwrite live pages. Requirement: after any crash (even mid-write), the database opens at the last fully-committed state with no recovery scan, supporting many concurrent readers that never block the single writer and never see a torn page. Walk through how a write commits atomically by writing new pages and flipping a root, how readers get a stable snapshot, and the space cost this design pays.

It covers

  • Wal less
  • Copy on write btree
  • Crash recovery