mirror of
https://github.com/minio/minio.git
synced 2024-12-25 22:55:54 -05:00
fix: DeleteBucket for peers() must recreate bucket upon errors (#17079)
This commit is contained in:
parent
fae9000304
commit
b09fe0e50e
@ -273,9 +273,24 @@ func (sys *S3PeerSys) DeleteBucket(ctx context.Context, bucket string, opts Dele
|
|||||||
errs := g.Wait()
|
errs := g.Wait()
|
||||||
errs = append(errs, deleteBucketLocal(ctx, bucket, opts))
|
errs = append(errs, deleteBucketLocal(ctx, bucket, opts))
|
||||||
|
|
||||||
quorum := (len(sys.allPeerClients) / 2) + 1
|
var errReturn error
|
||||||
err := reduceWriteQuorumErrs(ctx, errs, bucketOpIgnoredErrs, quorum)
|
for _, err := range errs {
|
||||||
return toObjectErr(err, bucket)
|
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
|
// DeleteBucket deletes bucket on a peer
|
||||||
|
Loading…
Reference in New Issue
Block a user