Skip to main content

FORMAT_VERSION_V4

Constant FORMAT_VERSION_V4 

Source
pub const FORMAT_VERSION_V4: u16 = 4;
Expand description

On-disk format revision. Bump when the page layout changes incompatibly.

History:

  • Version 1 (Phases 2 / 3a / 3b): schema catalog and table data were opaque bincode blobs chained across typed payload pages.
  • Version 2 (Phases 3c / 3d): tables are stored as cell-based B-Trees; the schema catalog is itself a table called sqlrite_master with four columns (name, sql, rootpage, last_rowid).
  • Version 3 (Phase 3e): sqlrite_master gains a type column (first), distinguishing 'table' and 'index' rows; secondary indexes persist as their own cell-based B-Trees whose cells use the new KIND_INDEX format.
  • Version 4 (Phase 7): cell encoding gains the KIND_VECTOR value tag (length-prefixed dense f32 array) for the new VECTOR(N) column type, plus the KIND_HNSW cell tag for vector ANN indexes. All Phase 7 storage additions (VECTOR cells, JSON cells, HNSW index nodes) live inside the v4 envelope.
  • Version 5 (Phase 8c): adds the KIND_FTS_POSTING cell tag for persisted FTS posting lists. Bumped on demand — a database without any FTS index keeps writing v4. The first save with at least one FTS index attached writes v5 instead. Decoders accept both v4 and v5; v5 reading a v4-shaped DB just sees zero FTS indexes in sqlrite_master. See [Phase 8 plan Q10].
  • Version 6 (SQLR-6): adds a persisted free-page list at header bytes [28..32] (freelist_head) plus the PAGE_TYPE_FREELIST_TRUNK page tag. Bumped on demand — a save that produces no freed pages keeps writing the file’s existing version. The first save that yields a non-empty freelist promotes the file to v6.