Skip to content

find: List missing pack files based on the index#3427

Merged
fd0 merged 6 commits intorestic:masterfrom
MichaelEischer:find-packs-from-index
Jul 30, 2021
Merged

find: List missing pack files based on the index#3427
fd0 merged 6 commits intorestic:masterfrom
MichaelEischer:find-packs-from-index

Conversation

@MichaelEischer
Copy link
Copy Markdown
Member

@MichaelEischer MichaelEischer commented Jun 12, 2021

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

When some pack files where lost, it would be useful to know which files/snapshots were affected without having to rebuild the index first. Currently restic find --pack <pack-id> returns nothing even if the pack file is still contained in the repository index. This PR introduces a fallback to resolve the blobs contained in a pack files from the repository index.

It is now also possible to specify multiple pack files in a single restic find --pack call.

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

https://forum.restic.net/t/missing-packs-not-found/2600

Checklist

  • I have read the Contribution Guidelines
  • I have enabled maintainer edits for this PR
  • 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

@MichaelEischer MichaelEischer force-pushed the find-packs-from-index branch from 891a270 to fc0cb2a Compare June 12, 2021 21:02
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.

LGTM so far!

Just passing the list of blobs to packsToBlobs would also work in most
cases, however, it could cause unexpected results when multiple pack
files have the same prefix. Forget found prefixes to prevent this.
If a pack file is missing try to determine the contained pack ids based
on the repository index. This helps with assessing the damage to a
repository before running `rebuild-index`.
@MichaelEischer MichaelEischer force-pushed the find-packs-from-index branch from fc0cb2a to 3442dc8 Compare July 6, 2021 19:04
@MichaelEischer MichaelEischer requested a review from fd0 July 6, 2021 19:05
@fd0 fd0 merged commit 92f293c into restic:master Jul 30, 2021
@MichaelEischer MichaelEischer deleted the find-packs-from-index branch July 30, 2021 21:05
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.

2 participants