fix: upon failure attempt an undo for all calls in DeleteBucket() (#12480)

its possible that, version might exist on second pool such that
upon deleteBucket() might have deleted the bucket on pool1 successfully
since it doesn't have any objects, undo such operations properly in
all any error scenario.

Also delete bucket metadata from pool layer rather than sets layer.
This commit is contained in:
Harshavardhana 2021-06-09 17:13:00 -07:00 committed by GitHub
parent 22c58be421
commit a93aa2eac1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 8 deletions

View File

@ -1248,9 +1248,6 @@ func (z *erasureServerPools) IsTaggingSupported() bool {
// even if one of the serverPools fail to delete buckets, we proceed to
// undo a successful operation.
func (z *erasureServerPools) DeleteBucket(ctx context.Context, bucket string, forceDelete bool) error {
if z.SinglePool() {
return z.serverPools[0].DeleteBucket(ctx, bucket, forceDelete)
}
g := errgroup.WithNErrs(len(z.serverPools))
// Delete buckets in parallel across all serverPools.
@ -1267,14 +1264,15 @@ func (z *erasureServerPools) DeleteBucket(ctx context.Context, bucket string, fo
// buckets operation by creating all the buckets again.
for _, err := range errs {
if err != nil {
if _, ok := err.(InsufficientWriteQuorum); ok {
if !z.SinglePool() {
undoDeleteBucketServerPools(ctx, bucket, z.serverPools, errs)
}
return err
}
}
deleteBucketMetadata(ctx, z, bucket)
// Success.
return nil
}

View File

@ -842,9 +842,6 @@ func (s *erasureSets) DeleteBucket(ctx context.Context, bucket string, forceDele
}
}
// Delete all bucket metadata.
deleteBucketMetadata(ctx, s, bucket)
// Success.
return nil
}