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.
What identifies it
Section titled “What identifies it”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. |
- magic4 B"STC1"
- version2 B4
- layer1 B
- flags1 B0x06 or 0x07
- file_id8 B
- bloom_off8 B
- bloom_len4 B
- index_off8 B
- index_len4 B
- entries8 B
- min_ts8 B
- max_ts8 B
When a writer chooses it
Section titled “When a writer chooses it”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.
What the flags promise
Section titled “What the flags promise”BLOOM_SKIPandBLOOM_RANGESboth set means the bloom frame ends in the ranged tail, which holds skip tags and key prefixes.BLOCK_COUNTSclear means the stats frame, if there is one, is stats revision 1 and has no per-block version codes.
Introduced without a stamp bump
Section titled “Introduced without a stamp bump”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.
Example
Section titled “Example”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 120 0f 00 00 00 00 00 00 bloom_off 3872ac 02 00 00 bloom_len 684