Skip to content

A data block

Worked example: footer revision 4 file

Data block 0 starts at offset 0 and is 3234 bytes sealed. The AAD is "stc" ‖ 0x00 ‖ file_id u64 ‖ block index u32, so a block moved to another position fails authentication. See Frame and Row block.

01 c5 3e 00 00 codec 1 (zstd), block format 0 (row), raw_len 0x3ec5 = 16069

The decompressed body is 16069 bytes, close to the 16 KiB target for row blocks.

After zstd decoding, the first entries are:

00 05 03 61 00 00 00 00 07 00 00 00 00 00 00 00 01 61 2d 30
shared 0, unshared 5, vlen 3, key 'a' 00000000, ts 7, Put, "a-0"
04 01 03 01 07 00 00 00 00 00 00 00 01 61 2d 31
shared 4, unshared 1, vlen 3, suffix 01, ts 7, Put, "a-1"
04 01 03 02 07 ... 01 61 2d 32
shared 4, unshared 1, vlen 3, suffix 02, ts 7, Put, "a-2"

The first entry has shared 0 because it is a restart point and carries the whole 5-byte key. The next entries share the first 4 bytes ('a' and three zero bytes) with the previous key and store only the changing last byte.

The block ends with 55 restart offsets, each a little-endian u32, followed by 37 00 00 00, the restart count 55. Every 16th entry is a restart, and 880 / 16 = 55. A lookup binary-searches the restart array and then scans at most 16 entries.