Repository navigation
fix(storage): refuse a lost log its mark vouches for, cut only a zero tail past the committed length, remake an unfinished log, report an unwitnessed log - #99
Conversation
… tail past the committed length, remake an unfinished new log, and say when a log runs unwitnessed
…nowledged tail is cut, cut a last frame writeback tore, keep a damaged log and a standalone hybrid's lost log refused
|
Follow-up f0fb2af on the re-review:
Tests: 5 new in |
…ot be synchronized, and say the store is unwitnessed
…hronized at close and checkpoint only, and say a store whose mark cannot be written is unwitnessed
|
Follow-up 10b5d34 (with 0c2de56 before it). Per Dave's decision, fsync is trusted.
|
…int has made the mark durable
Storage gaps around the committed-length witness, from the review of 2026-11-13: P2-14, P2-15 and two P3s. Dave decided to keep refusing a damaged mark; this PR keeps that and closes the gaps around it. Draft; stacked on #98; do not merge without review.
P2-14. A lost log that its mark vouches for is refused, not reopened empty
Before: if a sync store's log was gone while its mark survived,
sql.openmade an empty log and deleted the mark, which was the only evidence of the loss.Now: a mark that says transactions were committed (
sequence > 0), or that cannot be read, refuses the open:Removing the mark is the same explicit action as for a log found short. Managed and catalog databases are left as they were, through a new
manifestNamesLogoption set bycatalog.jslandhybrid.jsl: their manifest is the authority, and they already refuse a missing log it names.P2-15. A zero tail past the committed length is cut, not refused
Before: a power cut can leave a log's end allocated and never written. A sound store then refused to open with
invalid frame lengthorchecksum mismatch.Now: a broken frame is treated as a torn tail and cut only when all of these hold:
Anything else is refused as before: non-zero garbage, or zeros where committed transactions should be. The mark is now read before the log, which also lets a damaged mark be refused before anything is read.
P3. A new log whose creation was cut off is made again
Before: a process killed after
createDurablenamed a new log but before its header was written left a 0-byte or partial header. That was refused for good asinvalid file header. The reviewer reproduced it with aSIGXFSZkill.Now: a sync log that is empty, or only a prefix of the log magic, can hold no transaction. It is removed and made again.
P3. Running without a mark is visible
store:witness()(optional on theStoretype) answers:witnessed;unwitnessed: synchronized, but the mark could not be made, so a log found short will not be caught;not-synchronized.Tests (
tests/wal-committed-length.jsl, 4 new; each fails onba83c5a)expected true to be false.expected "zeros: false" to be "zeros: true".""or"JQL"is made again. On the old code:invalid file header.witness()sayswitnessed, andunwitnessedwhen making the mark fails.Gates on this branch (
24820e0)jess main
3c7639f, l3i 2.10.0:jess package test .: exit 0, 1,418 passed, 0 failed (style suite included).jess package check .:errors: [].A later PR (
test/memfs-fidelity) adds a fault-labtornmode. Its sweep fails on the storage before this PR withinvalid frame length, and passes on this one.Rollback
Revert this commit. A standalone store whose log is lost then opens empty again.