* feat(mito2): store Narthex samples in independently prunable groups Signed-off-by: evenyag <realevenyag@gmail.com> * fix(mito2): retain samples format version 1 Signed-off-by: evenyag <realevenyag@gmail.com> * style(mito2): format grouped samples test helpers Signed-off-by: evenyag <realevenyag@gmail.com> * perf(mito2): streamline grouped Narthex samples and frame exact keys Signed-off-by: evenyag <realevenyag@gmail.com> * refactor(mito2): validate key directory entry alignment Signed-off-by: evenyag <realevenyag@gmail.com> * perf(mito2): reuse continued keys and coalesce sample directory reads Signed-off-by: evenyag <realevenyag@gmail.com> * style(mito2): use crate-relative key page imports Signed-off-by: evenyag <realevenyag@gmail.com> * test(mito2): inline the raw key frame wire example Signed-off-by: evenyag <realevenyag@gmail.com> * docs(mito2): clarify grouped samples integrity and version policy Signed-off-by: evenyag <realevenyag@gmail.com> --------- Signed-off-by: evenyag <realevenyag@gmail.com>
Mito columnar samples version 1
This fixture freezes the version-1 sample wire contract in
mito-samples.md. It is exercised by
the owning Mito Rust test, not SQLness discovery:
cargo nextest run -p mito2 frozen_v1_samples_fixture_is_rejected
v1-manifest.json and v1-part.hex describe a 397-byte part with raw compression,
one leaf/root, and two samples for (table_id=7, tsid=42) at timestamp 100 ms.
The first row is a put with sequence 9 and Float64 negative zero. The second is a
delete with sequence 8 and a null field. Both rows must survive decoding.
The part was assembled independently of the Rust writer, using explicit little-endian fields and XXH64 with seed zero. Its layout is:
| Range | Content |
|---|---|
| 0..16 | Header |
| 16..32 | Constant-step timestamps: first 100, step 0 |
| 32..41 | Delta sequences: first 9, ZigZag delta -1 |
| 41..43 | Raw operations: put 1, delete 0 |
| 43..53 | Nullable XOR: bitmap mode, validity 0x01, negative-zero bits |
| 53..285 | Leaf/root: one block, four column references |
| 285..397 | Trailer with root reference and checksum |
The current reader writes the same wire version as this fixture, so the version
number alone does not reject it. The manifest carries no identity_encoding
discriminator, and the part records only (table_id, tsid), which is a hash: a
part whose two series were merged is structurally valid and ordered exactly like a
correct one. The test installs these exact bytes and recorded object sizes and
asserts that opening them through the samples reader fails on the missing
identity_encoding discriminator.
The part bytes above also predate two later version-1 shapes, neither of which is
migrated: block descriptors now carry a fixed-size key reference into a separate key
area instead of the key bytes, and the trailer records that area (key_end) and is
120 bytes, not 112. The fixture is still rejected for the same reason — the
discriminator is missing — and that rejection happens while opening the manifest,
before any part byte is decoded, so the frozen bytes are not a reader for the current
part layout and must not be regenerated to look like one.
Do not regenerate this fixture just to make a reader change pass. Preserve its bytes for future reader compatibility; introduce a separate versioned fixture when the approved format changes. This is a frozen-byte compatibility check, not a cross-binary upgrade/downgrade test.
The grouped layout test pins a raw frame inline: a four-byte little-endian stored
length followed by the three payload bytes abc.
Run cargo nextest run -p mito2 raw_key_frame_has_only_length_and_payload.