From 3ff063e913f992c0748ce9b7fffc5955d4096524 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Thu, 9 May 2024 18:48:22 +0200 Subject: [PATCH] check: verify pack a second time if broken --- internal/checker/checker.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 016b9c5bf..1ae6b23f1 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -725,6 +725,16 @@ func (c *Checker) ReadPacks(ctx context.Context, packs map[restic.ID]int64, p *p } err := checkPack(ctx, c.repo, ps.id, ps.blobs, ps.size, bufRd, dec) + if err != nil { + // retry pack verification to detect transient errors + err2 := checkPack(ctx, c.repo, ps.id, ps.blobs, ps.size, bufRd, dec) + if err2 != nil { + err = err2 + } else { + err = fmt.Errorf("second check successful, original error %w", err) + } + } + p.Add(1) if err == nil { continue