Repository navigation
fix(journal): replay writes an inode only if nothing wrote it since the read - #132
Merged
Merged
Conversation
…he read A replay of a failed node's journal read the inode outside any lock and then wrote it back unconditionally, so a same-node change made in between (the node's goroutines join the exclusive lock the replay holds) was lost. The replay now writes with WriteIfUnchanged on the generation it read; on a conflict it re-reads and the generation check skips the record. Also documents that an exclusive lock is exclusive per node only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the lock-exclusion audit. Exclusive locks only keep nodes apart, so goroutines on the replaying node could change an inode between the replay's unlocked read and its write, and the replay overwrote that change.
updateExtentsnow usesWriteIfUnchangedwith the generation it read. On a conflict it re-reads, and the #80 generation check skips the record.TestReplayKeepsInodeWrittenDuringItfails whenWriteis put back.lock.Acquire: exclusive means per node.TestSameNodeEditsKeepEveryEntry(perf(dir): answer lookups from an in-memory directory index #127) already fails 10/10 withoutLockDir.-sfbis ignored, and no production code builds ansfb.Manager.freeSFBSlotis still reachable through unlink or migration of legacy files. A same-node race there can only lose a slot bit, and nothing else reads those bits; fsck reclaims containers by inode references.Tested on .68: journal, lock, inode and dir unit tests;
-raceon journal; replay, failover and crash integration tests; lint clean.🤖 Generated with Claude Code