pingqiuandClaude Opus 5.5 125d895d26 storage: serialize every fsync of the walstore file with fault latching
The fault check under the store lock did not share a boundary with the
latching: the flusher's extent fsync (and a WAL fsync) latch without the
store lock, so a publication could pass the check, wait in its metadata
barrier, and still publish after another path's fsync failed.

Every fsync of the store's file (WAL batch, flusher extent, checkpoint,
recovered bounds, direct frontier, frontier seed) now runs through
syncFile under one leaf mutex, fileSyncMu: it is refused if a fault is
latched, and a failure latches the fault before the mutex is released.
Superblock publications run their pwrite and fsync together under it, so
a refused publication does not even dirty the superblock; a pwrite
failure still returns without latching. Nothing is acquired under
fileSyncMu (callers may hold the store lock), so it adds no lock-order
edge beyond store lock -> fileSyncMu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:38:38 -08:00
Languages
Go 84.6%
Rust 7.8%
Shell 2.7%
templ 1.6%
Java 1%
Other 2%