fix: DeleteBucket for peers() must recreate bucket upon errors (#17079)

This commit is contained in:
Harshavardhana 2023-04-25 14:16:35 -07:00 committed by GitHub
parent fae9000304
commit b09fe0e50e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -273,9 +273,24 @@ func (sys *S3PeerSys) DeleteBucket(ctx context.Context, bucket string, opts Dele
errs := g.Wait()
errs = append(errs, deleteBucketLocal(ctx, bucket, opts))
quorum := (len(sys.allPeerClients) / 2) + 1
err := reduceWriteQuorumErrs(ctx, errs, bucketOpIgnoredErrs, quorum)
return toObjectErr(err, bucket)
var errReturn error
for _, err := range errs {
if errReturn == nil && err != nil {
// always return first error
errReturn = toObjectErr(err, bucket)
break
}
}
for _, err := range errs {
if err == nil && errReturn != nil {
// re-create successful deletes, since we are return an error.
sys.MakeBucket(ctx, bucket, MakeBucketOptions{})
break
}
}
return errReturn
}
// DeleteBucket deletes bucket on a peer