Rewrite and format stamp
Manifest::open always rewrites the MANIFEST. This is how a store changes its format stamp, and it happens at one durable point.
- Take a snapshot of the replayed state.
- Set
generationto the old generation plus 1. - Stamp the header
store_formatwith the build’s current store format. - Write to
MANIFEST.tmpwith mode 0600. fsync, rename into place, andfsyncthe directory.
The log is also rewritten when it exceeds 4 MiB.
The stamp
Section titled “The stamp”Consequently a store becomes stamped at one durable point, before any byte of the new format is written to data files or WAL (SPEC V455). There is no downgrade afterwards (SPEC V456). A build whose stamp is lower than the file’s refuses to open the store before changing anything.
Format pre-4 is the SEAM 1 layout (SEAM 1 will be stamped 1 on disk at the first public release; planned, not yet in code). Pre-release stores carry pre-1 to pre-3, see pre-release stamps. The stored number for the current layout is discussed on the header page.
The stamp is bound into the AAD of every record, so a record from before the rewrite cannot be carried across it. Files keep their own per-file stamps and are migrated in the background, see Migration.