feat: add per-record CRC skip in iter_records#1
Open
jgwesterlund wants to merge 10 commits intomainfrom
Open
Conversation
Merge pull request #1 from jgwesterlund/fix/ring-open-recovery-safety
lets hope, cause im tired....
Add skip_corrupt parameter to iter_records() that scans forward past corrupt records instead of stopping at the first one. Track skipped count in _last_iter_skipped. Scan searches up to full ring capacity to handle corruption spanning arbitrary lengths. Co-Authored-By: Claude Opus 4.6 <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.
Pull Request
What does this change do?
Adds a
skip_corruptparameter toiter_records()that scans forward past corrupt records instead of stopping at the first one. Tracks the number of skipped corrupt regions in_last_iter_skipped.Why is this needed?
Previously, iteration stopped at the first corrupt record, making it impossible to recover valid records beyond corruption. This enables data recovery from partially corrupted rings. The scan searches up to full ring capacity—no fixed 4096-byte cap—so corruption spanning arbitrary lengths is handled.
Type of change
How was this tested?
5 new tests in
tests/test_extended.py:skip_corrupt=False(default) still stops at first corruption_last_iter_skippedcount is accurateAll 41 tests pass, ruff clean, mypy clean.
Checklist
Notes for reviewers
Records start at
DATA_START=4, which is offset 4 mod 8. The scan increments byALIGN(8 bytes) from the current offset rather than using_align_up()to global 8-byte boundaries, since that would skip valid record offsets.Docs updated:
usage.md,api.md,recovery.md.