dird: fix expected file count error during bsr build #1511
Merged
BareosBot merged 11 commits intobareos:masterfrom Aug 10, 2023
Merged
dird: fix expected file count error during bsr build #1511BareosBot merged 11 commits intobareos:masterfrom
BareosBot merged 11 commits intobareos:masterfrom
Conversation
3e3436f to
6e249ab
Compare
alaaeddineelamri
suggested changes
Jul 31, 2023
alaaeddineelamri
approved these changes
Aug 9, 2023
f9f8f27 to
cf039c8
Compare
We should only decrement the expected file counter if a file we are actually restoring is split over two volumes. That means we need to keep track of which FileIndices we actually selected to be restored instead of just assuming that we are restoring the whole volume.
Testing whether two intervals intersect -- which is what the conditional is trying to do -- can be easily done with a <= d && b >= c, where the intervals are [a, b] and [c, d] with a<=b and c<=d. It is then easy to check that this is equivalent to max(a, c) <= min(b, d), which is what the code now does.
This is done because bsr->VolParams saves them as unsigned anyways.
c440cce to
80788e9
Compare
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.
Thank you for contributing to the Bareos Project!
We decrement the expected file count counter incorrectly! We should only do so if the last file we selected for restore is split over two volumes; not just whether the last file on the volume is split.
File Indices are not unique between jobs so we have to ensure that we only ever compare the file indices of the same job as well.
Please check
If you have any questions or problems, please give a comment in the PR.
Helpful documentation and best practices
Checklist for the reviewer of the PR (will be processed by the Bareos team)
Make sure you check/merge the PR using
devtools/pr-toolto have some simple automated checks run and a proper changelog record added.General
- Check backport line- Required backport PRs have been createdSource code quality
- Required documentation changes are present and part of the PRTests