2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 23:06:32 +00:00

prune: Add internal integrity check

After repacking every blob that should be kept must have been repacked.
We have seen a few cases in which a single blob went missing, which
could have been caused by a bitflip somewhere. This sanity check might
help catch some of these cases.
This commit is contained in:
Michael Eischer 2022-07-17 12:05:04 +02:00
parent 5cbde03eae
commit d0590b7841

View File

@ -658,6 +658,14 @@ func doPrune(opts PruneOptions, gopts GlobalOptions, repo restic.Repository, pla
// Also remove repacked packs
plan.removePacks.Merge(plan.repackPacks)
if len(plan.keepBlobs) != 0 {
Warnf("%v was not repacked\n\n"+
"Integrity check failed.\n"+
"Please report this error (along with the output of the 'prune' run) at\n"+
"https://github.com/restic/restic/issues/new/choose\n", plan.keepBlobs)
return errors.Fatal("internal error: blobs were not repacked")
}
}
if len(plan.ignorePacks) == 0 {