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

Improve reliability of upload retries and B2 file deletions #3885

Merged
merged 5 commits into from
Aug 26, 2022

Conversation

MichaelEischer
Copy link
Member

@MichaelEischer MichaelEischer commented Aug 21, 2022

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

When hard deleting the latest file version on B2, this uncovers earlier versions. If an upload required retries, multiple version might exist for a file. Thus to reliably delete a file, we have to remove all versions of it. Otherwise symptoms like #3161 or even data loss can be the result.

This change allows the retry backend to skip deleting failed uploads for backends that support atomic file replacements. For these backends we just can overwrite the old copy, if it is necessary to retry an upload. This has the benefit of issuing one operation less and might be beneficial if a backend storage, due to bugs or similar, could mix up the order of the upload and delete calls.

As a random additional change the PR also increases the file listing size for B2 to the maximum in order to reduce the number of network roundtrips necessary to list the files in a large repository.

There is currently only a changelog for the B2 delete change as the other ones only affect extremely technical details.

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

Fixes #3161

Checklist

  • I have read the contribution guidelines.
  • [s] 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.

When hard deleting the latest file version on B2, this uncovers earlier
versions. If an upload required retries, multiple version might exist
for a file. Thus to reliably delete a file, we have to remove all
versions of it.
For backends which are able to atomically replace files, we just can
overwrite the old copy, if it is necessary to retry an upload. This has
the benefit of issuing one operation less and might be beneficial if a
backend storage, due to bugs or similar, could mix up the order of the
upload and delete calls.
Just request as many files as possible in one call to reduce the number
of network roundtrips.
@MichaelEischer
Copy link
Member Author

#3893 showed no problems, so let's merge this. There's no test to specifically check that the delete retry loop for B2 completely works as expected, but the backend tests work, so the normal case is at least working fine.

@MichaelEischer MichaelEischer merged commit 908f744 into restic:master Aug 26, 2022
@MichaelEischer MichaelEischer deleted the delete-fixes branch August 26, 2022 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

check says prune would do more work right after prune
3 participants