Skip to content

Footer revision 4: ranged bloom

Only builds that include footer revision 4 support read it; older builds report NewerFormat("sst footer").

Footer revision 4 is the footer of a SEAM data file whose bloom filter leaves out every key that starts with one of a list of prefixes. It is the only revision that sets the BLOOM_RANGES flag without also setting BLOCK_COUNTS.

A SEAM 1 reader accepts it. A SEAM 1 writer picks revision 5 whenever a file has a stats frame, and that is the default for every new file, so revision 4 files are expected only in pre-release stores.

The 64-byte plaintext footer is the same shape in every revision, see Footer. For revision 4 the fields have these values.

Field Value in revision 4
magic "STC1"
version 4
flags SKIP (0x02) and RANGES (0x04) set, COUNTS (0x08) clear. STATS (0x01) may be set.
Footer plaintext, 64 bytes (the same in every revision)
  1. magic4 B"STC1"
  2. version2 B4
  3. layer1 B
  4. flags1 B0x06 or 0x07
  5. file_id8 B
  6. bloom_off8 B
  7. bloom_len4 B
  8. index_off8 B
  9. index_len4 B
  10. entries8 B
  11. min_ts8 B
  12. max_ts8 B

A writer picks revision 4 when at least one key was left out of the bloom filter because it starts with a bloom-off prefix (SPEC V729). The SQL layer registers the prefix 0x01 followed by the 4-byte big-endian root table id for every table created with WITH (bloom = off), see Ext B: bloom off.

The priority order that decides between all five revisions is on Choosing a footer revision.

  • BLOOM_SKIP and BLOOM_RANGES both set means the bloom frame ends in the ranged tail, which holds skip tags and key prefixes.
  • BLOCK_COUNTS clear means the stats frame, if there is one, is stats revision 1 and has no per-block version codes.

Revision 4 was added to the format without raising the store stamp, because the footer describes its own revision. The consequence is the one stated on every page of this kind: a build that does not know revision 4 reads the footer, sees version 4, and fails with NewerFormat("sst footer"). See Compatibility rules.

The decrypted footer of the ranged bloom fixture is a revision 4 footer with the stats frame present, so flags is 0x07.

53 54 43 31 04 00 01 07 "STC1", version 4, layer 1, flags 0x07 (STATS|SKIP|RANGES)
01 00 00 00 00 00 00 00 file_id 1
20 0f 00 00 00 00 00 00 bloom_off 3872
ac 02 00 00 bloom_len 684