summaryrefslogtreecommitdiff
path: root/src/mouse.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 19:36:39 -0300
committerGabriel Schneider <[email protected]>2026-11-05 19:36:48 -0300
commit992d5b1aa2813fcba05d8564872f8d426eade9f6 (patch)
tree11991c07584b361b2958cb7a1c7c19d76811c4b6 /src/mouse.zig
parentb3cf70c686d1505bc687cb1f0935959ffa5d119d (diff)
downloadpardes-992d5b1aa2813fcba05d8564872f8d426eade9f6.tar.gz
pardes-992d5b1aa2813fcba05d8564872f8d426eade9f6.zip
state file, a torn one mended: a power loss inside the writeback window after Recent's commit (not fsynced) can leave its root header on disk and its bytes not, and xitdb then refuses the file, which pardes set aside as `pardes.xitdb.broken` with every dump in it, whole but unreached; now the open scans back from the file's end for the last commit whose trailer verifies (its CRC-64 over the file id and its own place, its root a map written before it) and whose maps read whole, puts the root header back at it under the file's lock and opens the file there (src/Db.zig `mend`, xitdb's layout read by hand, xitdb itself checking the result), so the Recent's change or two after it are lost and the dumps before it are not; the file is set aside only when no commit is whole, its bytes as they were; on a 105 MB state file (Debug) a whole one opens in 78-93 us, one torn in Recent's last commit after a Dump in 5.0-5.5 ms, and one with no commit whole, scanned to its start, in 429-438 ms before it is set aside; tests: Db.zig's 'one a power loss tore is opened at its last whole commit, the dumps before it kept; it is set aside only when none is whole' is new (a file cut short in its last commit, one with garbage after its last commit and its root header pointing into it, one torn in Recent's commit after a Dump: the Dump read back and loaded each time, its text with it, Recent's change kept or gone as the tear says; one with no commit whole set aside byte for byte), and fails with the mend switched off
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/mouse.zig')
0 files changed, 0 insertions, 0 deletions