s3: DeleteBucket to use listing before returning bucket not empty error (#20301)

Use Walk(), which is a recursive listing with versioning, to check if 
the bucket has some objects before being removed. This is beneficial
because the bucket can contain multiple dangling objects in multiple
drives.

Also, this will prevent a bug where a bucket is deleted in a deployment
that has many erasure sets but the bucket contains one or few objects
not spread to enough erasure sets.
This commit is contained in:
Anis Eleuch
2024-08-22 22:57:20 +01:00
committed by GitHub
parent a8f143298f
commit 73992d2b9f
4 changed files with 43 additions and 21 deletions
+1
View File
@@ -145,6 +145,7 @@ type WalkOptions struct {
LatestOnly bool // returns only latest versions for all matching objects
AskDisks string // dictates how many disks are being listed
VersionsSort WalkVersionsSortOrder // sort order for versions of the same object; default: Ascending order in ModTime
Limit int // maximum number of items, 0 means no limit
}
// ExpirationOptions represents object options for object expiration at objectLayer.