Repository navigation
fix(journal): bound the recovery scan by the bytes between head and tail - #76
Merged
Merged
Conversation
Both recovery scans ran until the position equaled the tail. A tail no record boundary reaches, such as a corrupt in-memory pointer, sent them around the ring through stale records forever, replaying old transactions on the way. They now stop after reading the bytes from head to tail, so every scan ends and reads each record at most once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Both journal recovery scans ran
for pos != tail. If the tail is a position no record boundary reaches, the scan goes around the ring through stale records from earlier laps and never stops, replaying old transactions as it goes.readSuperblockalready refuses an on-disk head or tail that is outside the data area or not sector-aligned (#34), so this is defense in depth. The scans now stop after reading the bytes between head and tail, so every scan ends and reads each record at most once. With valid pointers they behave as before, including a tail at the very end of the data area (#65).TestScanStopsAtUnreachableTailfills the ring a full lap, commits two pending intents, and moves the in-memory tail 512 bytes past a record boundary. On main'srecovery.gothe scan was still running after 10 s. On this branch it replays the two intents once each.Results: the new test passes 10 out of 10 with
-race, along with the full-ring and tail-at-end tests. All unit tests pass with-race, lint is clean, and parity passes.🤖 Generated with Claude Code