2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-22 02:48:55 +00:00

Merge pull request #3544 from restic/fix-b2-delete-retry

b2: Successful delete if file does not exist
This commit is contained in:
rawtaz 2022-01-13 23:28:30 +01:00 committed by GitHub
commit 7f6fc78f95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -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

View File

@ -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 {