Fix statistics in prune for duplicates#3113
Merged
fd0 merged 1 commit intorestic:masterfrom Nov 19, 2020
Merged
Conversation
Note that this fix only solves the statistics problem, if all duplicates are marked for repacking. If not all duplicates are marked for repacking, we lack the information which The situation that not all duplicates are marked for repacking can occur when using the `max-repack-size` option
Member
|
Thanks for the fast fix! I think it'd be a great idea to extract all the calculation logic into a separate function/struct, so we can add proper tests for it (not necessarily in this PR). What do you think? |
Contributor
Author
Fully agree! In fact there are two things we should test:
These tests are IMHO pretty well implemented.
Here tests are missing... |
Contributor
Author
|
@fd0: Forgot to mention: Yes I think we should postpone this testing issue to a follow-up PR. |
6 tasks
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.
What does this PR change? What problem does it solve?
Fixes statistics calculation in
pruneif there are duplicates present in the repo.Output of
restic prune -n -vwithout this bug fix when using the repo incmd/restic/testdata/repo-duplicates.tar.gz:Output with this bug fix:
Note that this fix only solves the statistics problem, if all duplicates are marked for repacking.
If not all duplicates are marked for repacking, we lack the information what duplicates still exist after pruning.
The situation that not all duplicates are marked for repacking can occur when using the
max-repack-sizeoption.Was the change discussed in an issue or in the forum before?
closes #3110
Checklist
changelog/unreleased/that describes the changes for our users (template here)gofmton the code in all commits