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
1 changed files with 7 additions and 1 deletions
|
@ -73,7 +73,13 @@ func repack(ctx context.Context, repo restic.Repository, dstRepo restic.Reposito
|
||||||
for t := range downloadQueue {
|
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 {
|
err := StreamPack(wgCtx, repo.Backend().Load, repo.Key(), t.PackID, t.Blobs, func(blob restic.BlobHandle, buf []byte, err error) error {
|
||||||
if err != nil {
|
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()
|
keepMutex.Lock()
|
||||||
|
|
Loading…
Reference in a new issue