mirror of
https://github.com/octoleo/restic.git
synced 2025-01-26 16:48:29 +00:00
repository: try to recover from invalid blob while repacking
If a blob that should be kept is invalid, Repack will now try to request the blob using LoadBlob. Only return an error if that fails.
This commit is contained in:
parent
d0590b7841
commit
623770eebb
@ -73,7 +73,13 @@ func repack(ctx context.Context, repo restic.Repository, dstRepo restic.Reposito
|
||||
for t := range downloadQueue {
|
||||
err := StreamPack(wgCtx, repo.Backend().Load, repo.Key(), t.PackID, t.Blobs, func(blob restic.BlobHandle, buf []byte, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
var ierr error
|
||||
// check whether we can get a valid copy somewhere else
|
||||
buf, ierr = repo.LoadBlob(wgCtx, blob.Type, blob.ID, nil)
|
||||
if ierr != nil {
|
||||
// no luck, return the original error
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
keepMutex.Lock()
|
||||
|
Loading…
x
Reference in New Issue
Block a user