diff --git a/changelog/unreleased/issue-3541 b/changelog/unreleased/issue-3541 new file mode 100644 index 000000000..ea20949d7 --- /dev/null +++ b/changelog/unreleased/issue-3541 @@ -0,0 +1,9 @@ +Bugfix: Improve handling of temporary B2 delete errors + +Deleting files on B2 can sometimes fail temporarily, which requires restic to +retry the delete operation. In some cases the file was deleted nevertheless +causing the retries and ultimately the restic command to fail. This has been +fixed. + +https://github.com/restic/restic/issues/3541 +https://github.com/restic/restic/pull/3544 diff --git a/internal/backend/b2/b2.go b/internal/backend/b2/b2.go index 8d4116452..90aeca3b2 100644 --- a/internal/backend/b2/b2.go +++ b/internal/backend/b2/b2.go @@ -265,7 +265,13 @@ func (be *b2Backend) Remove(ctx context.Context, h restic.Handle) error { defer be.sem.ReleaseToken() obj := be.bucket.Object(be.Filename(h)) - return errors.Wrap(obj.Delete(ctx), "Delete") + err := obj.Delete(ctx) + // consider a file as removed if b2 informs us that it does not exist + if b2.IsNotExist(err) { + return nil + } + + return errors.Wrap(err, "Delete") } type semLocker struct {