mirror of
https://github.com/minio/minio.git
synced 2025-01-11 23:13:23 -05:00
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:
parent
22c58be421
commit
a93aa2eac1
@ -1248,9 +1248,6 @@ func (z *erasureServerPools) IsTaggingSupported() bool {
|
|||||||
// even if one of the serverPools fail to delete buckets, we proceed to
|
// even if one of the serverPools fail to delete buckets, we proceed to
|
||||||
// undo a successful operation.
|
// undo a successful operation.
|
||||||
func (z *erasureServerPools) DeleteBucket(ctx context.Context, bucket string, forceDelete bool) error {
|
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))
|
g := errgroup.WithNErrs(len(z.serverPools))
|
||||||
|
|
||||||
// Delete buckets in parallel across all 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.
|
// buckets operation by creating all the buckets again.
|
||||||
for _, err := range errs {
|
for _, err := range errs {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if _, ok := err.(InsufficientWriteQuorum); ok {
|
if !z.SinglePool() {
|
||||||
undoDeleteBucketServerPools(ctx, bucket, z.serverPools, errs)
|
undoDeleteBucketServerPools(ctx, bucket, z.serverPools, errs)
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deleteBucketMetadata(ctx, z, bucket)
|
||||||
|
|
||||||
// Success.
|
// Success.
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -842,9 +842,6 @@ func (s *erasureSets) DeleteBucket(ctx context.Context, bucket string, forceDele
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete all bucket metadata.
|
|
||||||
deleteBucketMetadata(ctx, s, bucket)
|
|
||||||
|
|
||||||
// Success.
|
// Success.
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user