fix(memiavl): keep read-only Load from modifying the live WAL #132
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.37) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 212 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.321
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #132"
general
weight: 0.35
thomas-nguy
What
Read-only
memiavl.LoadandGetLatestVersionnow use a newreadOnlyWALthat never changes WAL files. Historical queries (loadAtVersioninstore/rootmulti) hit this path while the node writes.Issue
The read-only path ran
OpenWAL, which repairs the WAL, without the file lock:Openfinishes an in-progressTruncateFront. If a reader does it first, the writer's later WAL writes fail (file already closed) andCommitpanics.Solution
readOnlyWALtreats a half-written last entry as unwritten and reads.START/.ENDfiles the waywal.Openwould recover them, retrying if the tail is renamed mid-open.walReader, plus awriteAheadLogwriter only when writable; the exportedCatchupWALkeeps its*wal.Logsignature.LoadkeepsOpenWAL, since it holds the lock.GetLatestVersionno longer repairs the tail or creates a missing WAL dir, and returns the snapshot version when the WAL is empty.Closeis safe to call twice;CommittedVersionthen returnswal.ErrClosed.Loadcloses the tree when the WAL fails, fixing a leak of 3 mmap'd files per store per failed historical load.OpenWALreturnsErrCorruptinstead of(nil, nil)and repairs the tailwal.Openloaded, not the last file by name.TargetVersion: 0loads still read thecurrentsymlink;loadAtVersionalways sets a target.#102 reverted this (5c62232) and gets it back by merging master after this lands, with no revert. #103 carries it and adds
Sync()to the writer interface.