Skip to content

Reduce memory usage when searching for used blobs#2599

Merged
fd0 merged 5 commits intorestic:masterfrom
MichaelEischer:tweak-mem-usage
Aug 1, 2020
Merged

Reduce memory usage when searching for used blobs#2599
fd0 merged 5 commits intorestic:masterfrom
MichaelEischer:tweak-mem-usage

Conversation

@MichaelEischer
Copy link
Copy Markdown
Member

@MichaelEischer MichaelEischer commented Feb 22, 2020

What is the purpose of this change? What does it change?

The seen BlobSet always contained a subset of the entries in blobs.
Thus use blobs instead and avoid the memory overhead of the second set.

Was the change discussed in an issue or in the forum before?

No.

Checklist

  • I have read the Contribution Guidelines
  • I have added tests for all changes in this PR
  • [ ] I have added documentation for the changes (in the manual)
  • There's a new file in changelog/unreleased/ that describes the changes for our users (template here)
  • 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

Copy link
Copy Markdown
Contributor

@aawsome aawsome left a comment

Choose a reason for hiding this comment

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

Thanks for proposing this PR! I also stumbled over the double BlobSet already and somewhere (I think it was in #2513) already called FindUsedBlobs with the seenBlobs = usedBlobs.

I think in the long term the remaining BlobSet should be integrated into the index - after #2523 is finished.
This PR however can and should be merged independently. Good job 👍

@MichaelEischer
Copy link
Copy Markdown
Member Author

@aawsome I actually got the idea from your unusual call to FindUsedBlobs in #2513. Sorry, for not mentioning that, I first failed to find your PR again and then completely forgot about it while adding tests. You are now mentioned in a "Suggested-by:" line in the commit message.

The seen BlobSet always contained a subset of the entries in blobs.
Thus use blobs instead and avoid the memory overhead of the second set.

Suggested-by: Alexander Weiss <alex@weissfam.de>
The only effective change in behavior is that that toplevel nodes can
also be skipped.
This also copies the TreeLoader interface from internal/walker to allow
stubbing the repository in the call to `FindUsedBlobs`.
Copy link
Copy Markdown
Member

@fd0 fd0 left a comment

Choose a reason for hiding this comment

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

Great improvement :)

@fd0 fd0 merged commit b7b479b into restic:master Aug 1, 2020
@MichaelEischer MichaelEischer deleted the tweak-mem-usage branch August 1, 2020 11:49
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.

4 participants