db-11 — Observation

What the cross-language verification actually proves, and what the file looks like by hand.

Output of scripts/cross_test.sh

=== compare Scenario A (sequential seed=42 pages=32 cache=8 ops=200 ps=256) ===
  A          rust=cbac0289ce1eb784e5bd80ab1298c3f9677f1aeb3cfdb09ce78d6796c43b9428 (    8448 B)
  A          go  =cbac0289ce1eb784e5bd80ab1298c3f9677f1aeb3cfdb09ce78d6796c43b9428 (    8448 B)
  A          cpp =cbac0289ce1eb784e5bd80ab1298c3f9677f1aeb3cfdb09ce78d6796c43b9428 (    8448 B)
  match(A): cbac0289ce1eb784e5bd80ab1298c3f9677f1aeb3cfdb09ce78d6796c43b9428
=== compare Scenario B (random seed=7 pages=64 cache=8 ops=500 ps=256) ===
  B          rust=3405654fd750bffa933c2d1b590160fcbf8ec446f261cc25c5c04c8c0c3dd023 (   16640 B)
  B          go  =3405654fd750bffa933c2d1b590160fcbf8ec446f261cc25c5c04c8c0c3dd023 (   16640 B)
  B          cpp =3405654fd750bffa933c2d1b590160fcbf8ec446f261cc25c5c04c8c0c3dd023 (   16640 B)
  match(B): 3405654fd750bffa933c2d1b590160fcbf8ec446f261cc25c5c04c8c0c3dd023
=== compare Scenario C (mixed seed=2024 pages=128 cache=16 ops=1000 ps=512) ===
  C          rust=5b10acb3e9cf57e3b314c17dc9fa122d79caac6a46501c71875374f9d6720460 (   66048 B)
  C          go  =5b10acb3e9cf57e3b314c17dc9fa122d79caac6a46501c71875374f9d6720460 (   66048 B)
  C          cpp =5b10acb3e9cf57e3b314c17dc9fa122d79caac6a46501c71875374f9d6720460 (   66048 B)
  match(C): 5b10acb3e9cf57e3b314c17dc9fa122d79caac6a46501c71875374f9d6720460
=== spot-check header ===
  spot-checks ok
=== ALL OK ===

File sizes are exactly (pages + 1) * page_size:

  • A: (32 + 1) * 256 = 8448
  • B: (64 + 1) * 256 = 16640
  • C: (128 + 1) * 512 = 66048

The +1 is page 0 (header).

Reading the header by hand

For Scenario A (page_size = 256, num_pages = 33 including the header):

xxd -l 24 /tmp/pager-A.rust.bin
00000000: 4453 452d 5041 4745 522d 7631 0000 0000  DSE-PAGER-v1....
00000010: 0001 0000 2100 0000                      ....!...

Decoded:

bytesmeaning
44 53 45 2d 50 41 47 45 52 2d 76 31 00 00 00 00magic DSE-PAGER-v1\0\0\0\0
00 01 00 00page_size = 0x00000100 = 256 (LE)
21 00 00 00num_pages = 0x00000021 = 33 (LE)

Bytes 24..255 are zero (header padding to page_size).

The cross-test's spot-check confirms bytes 0..19 exactly equal 4453452d50414745522d76310000000000010000. Any single-byte change to the format would surface here, and would break the sha256 match across all three languages, and would change the file size, and would invalidate the canonical hashes table — four independent failure signals for one bug.

Reading a data page by hand

For Scenario A the workload writes a known byte value B = (r >> 24) & 0xFF to every byte of the chosen page. So any non-zero data page in /tmp/pager-A.rust.bin should be 256 identical bytes:

xxd -s 256 -l 256 /tmp/pager-A.rust.bin | head -2
00000100: 8c8c 8c8c 8c8c 8c8c 8c8c 8c8c 8c8c 8c8c  ................
00000110: 8c8c 8c8c 8c8c 8c8c 8c8c 8c8c 8c8c 8c8c  ................

A run of one byte value repeated 256 times. Different pages contain different fill bytes; the sha256 of the file rolls all of them up. This makes hand-debugging a divergence between languages straightforward: dump both files, diff -u <(xxd a) <(xxd b), and the first non-matching page tells you exactly which (pid, byte) the languages disagreed on.

Cache statistics (informal)

Running Scenario B with cache = 8 over pages = 64:

hits   = ~190
misses = ~310

Hit ratio ~38%, consistent with the random scenario's expected cache_capacity / num_pages baseline (8 / 64 = 12.5%) plus a small temporal-locality bump. The Rust unit tests assert hits + misses == ops but not the exact ratio, because writes that bypass reads (write-on-miss admission) keep the absolute counts implementation-defined enough that an exact check would be fragile. The file bytes, however, are not implementation-defined — and that is what we pin.