Layout of revisions 1 to 4
This is the field table of a columnar block in revisions 1 to 4. Revision 5 replaces the four key fields with a typed key section but is otherwise the same. Fields are not at fixed offsets, so the table gives the encoding of each field. count(limit) is a varint that must not exceed limit, see count limit. IntCol, Flat and BytesCol are described on Column container types.
Layout
Section titled “Layout”| Field | Encoding | Meaning |
|---|---|---|
| version | u8 | The block revision, 1 to 5 |
n entries |
count(65536) |
Number of entries in the block |
key shared lens |
IntCol (n) |
Bytes each key shares with the previous key |
key suffix lens |
IntCol (n) |
Bytes each key adds after the shared prefix |
| restart offsets | Flat (ceil(n/32)) |
Offset into the key body at every 32nd key |
| key body length | count(block len) |
Length of the key body |
| key body | bytes | Concatenated suffixes |
| ts | IntCol (n) |
Timestamp, the u64 bit pattern read as i64 |
| kinds | IntCol (n) |
1 = Put, 2 = Delete |
| value mode | u8 | 0 = generic, 1 = rows |
| values | BytesCol (n) in mode 0, see below for mode 1 |
The entry values |
Keys are front-coded: each key is described by how many bytes it shares with the previous key and the suffix that follows. A restart offset is stored for every 32nd key, giving the position in the key body where that key’s suffix starts. Revision 5 may replace this whole key part with a typed key section.
Values
Section titled “Values”The value mode byte chooses how the values are stored. See Value modes for mode 0 (one BytesCol of raw values) and mode 1 (row-shaped values split into column slots).
What changed per revision
Section titled “What changed per revision”- Revision 1 is this layout, with no reference field in the column slots.
- Revision 2 adds the column slot reference.
- Revision 3 adds the FSST bytes codec.
- Revision 4 widens the reference so it can name a key field.