Repository navigation
fix(packer): write no pack after a failed pack write - #690
Open
stefanwichmann wants to merge 2 commits into
Open
stefanwichmann wants to merge 2 commits into
stefanwichmann wants to merge 2 commits into
Conversation
`Actor::new` runs the pack writes in a `readahead_scoped` stage. When a write fails, `try_for_each` stops, but `pariter`'s readahead threads go on pulling items and drop each send's error (`let _ = tx.send(i)`), so the write stage writes every queued pack, each with the backend's full retries. Since rustic-rs#672, `finalize` waits for all of them before it returns the first error. Against a server that stops reading uploads, with a 600 s request bound and two retries, each further pack costs another half hour, and a backup's end grows with its data instead of ending after one pack's attempts. The write stage now remembers a failed write and skips every later pack with an error that `try_for_each`, already stopped, never sees. A unit test fails the first of four queued pack writes and asserts that no other write starts; without the change, all four do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A packer's thread finalizes its `RawPacker` once its channel closes, whether `finalize` closed it or the last clone was dropped. On the error path that is the second: when the data packer fails, `Archiver::archive` returns before `tree_archiver.finalize`, and the dropped tree packer still saves its unfinished pack, with the backend's full retries; rustic-rs#672 made the drop wait for that write. Against a server that stops reading uploads, that is one more pack's attempts after the backup has already failed, for a pack no snapshot references. `finalize` now sets a flag the thread reads after the channel closes, and a packer dropped without it saves nothing. Packs already handed to the writer are written as before, unless one fails. A unit test drops a packer holding a blob smaller than a pack and asserts that no write starts, then finalizes one and asserts that one does; without the change, the drop writes the pack. 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.
Closes #689
A failed pack write no longer leaves the packer writing every other pack, each with the backend's full retries, before the error returns. Two commits, one per cause in #689.
fix(packer): write no pack after a pack write failed
The write stage in
Actor::newremembers a failed write and skips every later pack with an error thattry_for_each, already stopped at the first one, never sees.pariter's readahead threads still pull the queued packs, but nothing is written.fix(packer): save no unfinished pack from a packer dropped unfinalized
Packer::finalizesets a flag before it closes the channel, and the thread finalizes theRawPackeronly when the flag is set. A packer dropped withoutfinalize, as the tree packer is when the data packer fails, saves nothing. Packs already handed to the writer are written as before, unless one fails. This changes what #672 kept ("It still happens, as before"): that write was for a pack no snapshot references.Tests
Two unit tests in
blob/packer.rs, next to #672's, on itsSlowPackBackend:no_pack_write_starts_after_a_failed_one: the first of four queued pack writes fails; one write starts. Without the change, four do.a_packer_dropped_without_finalize_does_not_save_its_unfinished_pack: dropping a packer holding a blob smaller than a pack starts no write, and finalizing one starts one. Without the change, the drop writes the pack.Checked against a REST server that stops reading uploads: before, 6 to 15 pack uploads depending on the source size; after, the three attempts at the first pack.
🤖 Generated with Claude Code