Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework repository.StreamPacks & better restorer error handling #4605

Merged

Conversation

MichaelEischer
Copy link
Member

@MichaelEischer MichaelEischer commented Dec 31, 2023

What does this PR change? What problem does it solve?

restore reports too many errors if a pack file can only be partially loaded. In addition, the restore progress bar is incorrect if restoring blobs from a pack file has to be retried. The PR reworks the error reporting and makes StreamPack (now LoadBlobsFromPack) easier to use and far more reliable. Blobs that cannot be loaded while streaming a pack file are now additionally loaded individually.

Was the change previously discussed in an issue or on the forum?

Partially fixes https://forum.restic.net/t/errors-restoring-with-restic-on-windows-server-s3/6943

Checklist

  • I have read the contribution guidelines.
  • I have enabled maintainer edits.
  • I have added tests for all code changes.
  • [ ] I have added documentation for relevant changes (in the manual).
  • There's a new file in changelog/unreleased/ that describes the changes for our users (see template).
  • I have run gofmt on the code in all commits.
  • All commit messages are formatted in the same style as the other commits in the repo.
  • I'm done! This pull request is ready for review.

Try to retrieve individual blobs via LoadBlob if streaming did not work.
Due to the interface of streamPack, we cannot guarantee that operations
progress fast enough that the underlying connections remains open. This
introduces partial failures which massively complicate the error
handling.

Switch to a simpler approach that retrieves the pack in chunks of 32MB.
If a blob is larger than this limit, then it is downloaded separately.

To avoid multiple copies in memory, an auxiliary interface
`discardReader` is introduced that allows directly accessing the
downloaded byte slices, while still supporting the streaming used by the
`check` command.
With most cloud providers, traffic is much more expensive than API
calls. Thus slightly bias streamPack towards a bit more API calls in
exchange for slightly less traffic.
@MichaelEischer MichaelEischer marked this pull request as ready for review April 22, 2024 19:21
Copy link
Member Author

@MichaelEischer MichaelEischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@MichaelEischer MichaelEischer merged commit ffe5439 into restic:master May 1, 2024
13 checks passed
@MichaelEischer MichaelEischer deleted the better-restorer-error-handling branch May 1, 2024 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

1 participant