Improve reliability of upload retries and B2 file deletions #3885
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.
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 added documentation for relevant changes (in the manual).changelog/unreleased/
that describes the changes for our users (see template).gofmt
on the code in all commits.