Skip to content

Db::open (crates/strata-txn/src/lib.rs:651-720) opens a store in a fixed order. The order matters: a store that is too new is refused before any byte changes, and nonce epochs are advanced past everything on disk before the first new seal.

  1. Check the store format. check_store_format reads the first 24 bytes of data/MANIFEST without writing anything. If store_format or manifest_format is newer than the build, open fails with NewerFormat and leaves the directory byte-identical (SPEC V456). See the MANIFEST header.
  2. Open or create the keyring. keys is opened or created. Opening bumps the persisted epoch by one, see Nonces and epochs.
  3. Scan the WAL for epochs. wal::observe_epochs scans every WAL block, takes the largest nonce epoch seen and advances the keyring past it.
  4. Open the LSM. Lsm::open runs observe_epochs over MANIFEST records and over the footers of every .stc and .stci file that authenticates (SPEC V58, V164). It then opens the MANIFEST, which rewrites it and stamps the current store format. It opens every listed file by parsing its footer, and runs the startup sweep.
  5. Replay the WAL. Replay starts from the MANIFEST’s replay_from, see Recovery.

The rewrite in step 4 is what stamps the store. The old store numbers 1 to 4 are pre-release stamps: pre-4 is the layout SEAM 1 adopts, and a build at the spec commit writes store_format = 4 for it. For the first public release the plan is to stamp SEAM 1 as 1 under a new header with a “SEAM” marker, with pre-1 to pre-4 migrated on open; this is planned and not yet in the code. The store is stamped at open, before any new data or WAL byte is written, and it cannot be opened by an older build afterwards. The mechanics are on Rewrite and format stamp.