mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
fix: clean up dangling buckets during bucket delete (#13523)
This commit is contained in:
parent
79a58e275c
commit
26f55472c6
@ -172,19 +172,25 @@ func (er erasureObjects) DeleteBucket(ctx context.Context, bucket string, opts D
|
|||||||
if err == errErasureWriteQuorum && !opts.NoRecreate {
|
if err == errErasureWriteQuorum && !opts.NoRecreate {
|
||||||
undoDeleteBucket(storageDisks, bucket)
|
undoDeleteBucket(storageDisks, bucket)
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return toObjectErr(err, bucket)
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point we have `err == nil` but some errors might be `errVolumeNotEmpty`
|
if err == nil || errors.Is(err, errVolumeNotFound) {
|
||||||
// we should proceed to attempt a force delete of such buckets.
|
var purgedDangling bool
|
||||||
for index, err := range dErrs {
|
// At this point we have `err == nil` but some errors might be `errVolumeNotEmpty`
|
||||||
if err == errVolumeNotEmpty && storageDisks[index] != nil {
|
// we should proceed to attempt a force delete of such buckets.
|
||||||
storageDisks[index].RenameFile(ctx, bucket, "", minioMetaTmpDeletedBucket, mustGetUUID())
|
for index, err := range dErrs {
|
||||||
|
if err == errVolumeNotEmpty && storageDisks[index] != nil {
|
||||||
|
storageDisks[index].RenameFile(ctx, bucket, "", minioMetaTmpDeletedBucket, mustGetUUID())
|
||||||
|
purgedDangling = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// if we purged dangling buckets, ignore errVolumeNotFound error.
|
||||||
|
if purgedDangling {
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return toObjectErr(err, bucket)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsNotificationSupported returns whether bucket notification is applicable for this layer.
|
// IsNotificationSupported returns whether bucket notification is applicable for this layer.
|
||||||
|
Loading…
Reference in New Issue
Block a user