Repository navigation
fix(cold-store-reaper): per-file commit boundary in prune_backups (#2550) - #3451
Merged
Merged
Conversation
) The apply path ran every Drive trash PATCH inside one SQLite transaction interleaved with transfer_ledger inserts: a mid-run failure rolled back every ledger row while the Drive trashes persisted, and trashed files are invisible to list_backups, so those rows could never be rewritten by a retry. Now each candidate is trashed first, then its ledger row commits in its own transaction before the next candidate; the same ColdStoreError still propagates on a failed trash. Regression test injects HTTP 500 on the 2nd of 5 prune PATCHes and asserts 1 trash + 1 committed row for the same file, the remaining candidates still planned, and a healthy retry completing the set with no duplicates.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 17 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Fixes #2550. Queue task 5365 (repo-health-code-pilot, lane D); implementation of triage task 3786's pin.
Change —
pkgs/cold-store-reaper/cold_store.py,prune_backupsapply pathThe commit boundary is now per file: for each prune candidate, run the Drive trash PATCH first, then write that file's
transfer_ledgerrow in its ownwith conn:transaction and commit before the next candidate (connection closed viafinally). Previously one transaction wrapped every PATCH and insert across all dbs, so a mid-runColdStoreErrorrolled back every ledger row while the Drive trashes persisted — and sincelist_backupslists only untrashed files, those rows were permanently unwritable.Unchanged: dry-run behaviour, retention selection (
_retention_plan), the success-path result, and theColdStoreErrortype/message for a failed trash.Tests —
tests/test_cold_store.py(+1)test_prune_apply_mid_run_failure_keeps_completed_rows: wrapscold_store.http_requestto return HTTP 500 on the 2nd of 5 prune PATCHes and asserts — ColdStoreError raised; exactly 1 file trashed in Drive AND exactly 1 committed backup-prune ledger row, for the same file; the 4 unattempted candidates still appear in a re-run dry plan; a healthy retry trashes and ledgers the remainder with final refs == all 5 pruned filenames, no duplicates.Laptop (worktree):
python3 -m unittest tests.test_cold_store.TestPruneBackups5/5; fulltests.test_cold_store89 tests OK (1 skipped).Need help on this PR? Tag
@codesmith-botwith what you need.