Open sequence
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.
- Check the store format.
check_store_formatreads the first 24 bytes ofdata/MANIFESTwithout writing anything. Ifstore_formatormanifest_formatis newer than the build, open fails withNewerFormatand leaves the directory byte-identical (SPEC V456). See the MANIFEST header. - Open or create the keyring.
keysis opened or created. Opening bumps the persisted epoch by one, see Nonces and epochs. - Scan the WAL for epochs.
wal::observe_epochsscans every WAL block, takes the largest nonce epoch seen and advances the keyring past it. - Open the LSM.
Lsm::openrunsobserve_epochsover MANIFEST records and over the footers of every.stcand.stcifile 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. - Replay the WAL. Replay starts from the MANIFEST’s
replay_from, see Recovery.
The stamp
Section titled “The stamp”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.