Skip to content

Choosing a footer revision

A footer holds one of five revisions in its version field. A reader checks the flags against the revision, and a writer picks the revision from what it wrote.

parse_footer (sst.rs:1501) accepts only these combinations. STATS is optional in revisions 1 to 4 and required in revision 5.

Revision Name Legal flags Writer chooses it when
1 plain no SKIP, no RANGES, no COUNTS none of the below
2 bloom skip SKIP set, no RANGES, no COUNTS skip tags present
3 codec no RANGES, no COUNTS (SKIP free) an LZ4 frame was written
4 ranged bloom SKIP and RANGES set, no COUNTS at least one key was left out by a bloom-off prefix (SPEC V729)
5 block counts STATS and COUNTS set; RANGES implies SKIP the file has a stats frame (default for every new file)

When writing, the first rule that matches wins:

  1. stats frame present: revision 5
  2. else ranged: revision 4
  3. else LZ4 frame: revision 3
  4. else skip: revision 2
  5. else revision 1
  • version greater than 5 is NewerFormat("sst footer").
  • A magic mismatch or version 0 is Corrupt.
  • A flag combination not legal for the revision is Corrupt("sst footer flags").

These were added without a store-format bump. A build that does not know them reads the footer, sees the revision, and fails with NewerFormat("sst footer"). See Compatibility rules.