SaketaChalamchala opened a new pull request, #5533:
URL: https://github.com/apache/ozone/pull/5533
## What changes were proposed in this pull request?
AWS S3 api for force deleting a bucket and its contents `rb --force` fails
on FSO buckets.
This happens because the S3 client sends individual delete requests for each
key in the bucket. This will work with the flat namespace in OBJECT_STORE
buckets.
But in FSO buckets with hierarchical namespace some key deletes might fail.
Causing the bucket delete operations to fail.
For example,
```
$ ozone sh bucket create o3://localhost:9862/s3v/bucket1
$ ozone sh key put o3://localhost:9862/s3v/bucket1/dir1/dir2/dir3/key1 a.txt
$
$ aws s3 --endpoint http://0.0.0.0:9878 rb --force s3://bucket1
# Request 0 is list all keys in the bucket
# Request 1
delete: s3://bucket1/dir1/dir2/dir3/ ### fails because /dir1/dir2/dir3/ is
not empty
# Request 2
delete: s3://bucket1/dir1/ ### fails because /dir1/ is not
empty
# Request 3
delete: s3://bucket1/dir1/dir2/dir3/key1 ### succeeds
# Request 4
delete: s3://bucket1/dir1/dir2/ ### fails because /dir1/dir2/ is
not empty
# Request 5 is delete: s3://bucket1
remove_bucket failed: s3://bucket1 An error occurred (BucketNotEmpty) when
calling the DeleteBucket operation: The bucket you tried to delete is not
empty.
```
Since we can't modify the order in which AWS S3 client sends the individual
key delete, improved the error message to indicate the `rb --force` is
supported on OBJECT_STORE buckets. FSO buckets would need to be emptied prior
to deletion.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-9108
## How was this patch tested?
Manual test
```
$ ozone sh bucket create /s3v/bucket1
$ ozone sh key put /s3v/bucket1/dir1/dir2/dir3/key1 CONTRIBUTING.md
$ aws s3 --endpoint http://s3g:9878 rb --force s3://bucket1
delete: s3://bucket1/dir1/
delete: s3://bucket1/dir1/dir2/dir3/key1
delete: s3://bucket1/dir1/dir2/dir3/
delete: s3://bucket1/dir1/dir2/
remove_bucket failed: s3://bucket1 An error occurred (BucketNotEmpty) when
calling the DeleteBucket operation: The bucket you tried to delete is not
empty. If you are using --force option to delete all objects in the bucket,
please ensure that the bucket layout is OBJECT_STORE or that the bucket is
completely empty before delete.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]