[#31] Add force bucket delete flag #436

Merged
alexvanin merged 1 commit from pogpp/frostfs-s3-gw:feature/31-full_bucket_removal into master 2024-07-26 06:53:27 +00:00
Member

Signed-off-by: Pavel Pogodaev p.pogodaev@yadro.com

Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
pogpp added 1 commit 2024-07-19 19:24:08 +00:00
[#31] Add force bucket delete flag
Some checks failed
/ DCO (pull_request) Successful in 2m2s
/ Vulncheck (pull_request) Successful in 2m19s
/ Builds (1.21) (pull_request) Successful in 2m32s
/ Builds (1.22) (pull_request) Successful in 2m27s
/ Lint (pull_request) Failing after 2m17s
/ Tests (1.21) (pull_request) Failing after 2m13s
/ Tests (1.22) (pull_request) Failing after 2m46s
93f871cd1f
Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
alexvanin reviewed 2024-07-22 06:14:46 +00:00
@ -240,0 +240,4 @@
skipObjCheck := false
if value, ok := r.Header[api.AmzForceBucketDelete]; !ok {
h.logAndSendError(w, "missing X-Amz-Force-Delete-Bucket", reqInfo, errors.GetAPIError(errors.ErrMissingForceBucketDeleteHeader))
return
Owner

This is compatibility-breaking change. We should not fail in case of missing this header.

This is compatibility-breaking change. We should not fail in case of missing this header.
alexvanin marked this conversation as resolved
@ -794,3 +794,3 @@
}
func (n *Layer) DeleteBucket(ctx context.Context, p *DeleteBucketParams) error {
func (n *Layer) DeleteBucket(ctx context.Context, p *DeleteBucketParams, skipCheck bool) error {
Owner

Why not put skipcheck in a DeleteBucketParams? Looks quite suitable for this setting.

Why not put `skipcheck` in a `DeleteBucketParams`? Looks quite suitable for this setting.
alexvanin marked this conversation as resolved
pogpp force-pushed feature/31-full_bucket_removal from 93f871cd1f to 18cc091545 2024-07-23 13:25:58 +00:00 Compare
pogpp force-pushed feature/31-full_bucket_removal from 18cc091545 to 95dfa4657a 2024-07-23 13:33:49 +00:00 Compare
pogpp requested review from alexvanin 2024-07-23 13:34:36 +00:00
pogpp requested review from mbiryukova 2024-07-23 13:35:11 +00:00
pogpp requested review from dkirillov 2024-07-23 13:35:12 +00:00
pogpp requested review from r.loginov 2024-07-23 13:35:44 +00:00
pogpp force-pushed feature/31-full_bucket_removal from 95dfa4657a to 8e61b055da 2024-07-23 13:39:24 +00:00 Compare
alexvanin reviewed 2024-07-23 13:49:24 +00:00
@ -813,3 +814,3 @@
return err
}
if len(res) != 0 {
if len(res) != 0 && !p.SkipCheck {
Owner

I appreciate small changes, it looks very nice and clean.

However, I am not sure it is worth keeping n.getAllObjectVersions when we can skip it entirely if SkipCheck == true.

I appreciate small changes, it looks very nice and clean. However, I am not sure it is worth keeping `n.getAllObjectVersions` when we can skip it entirely if `SkipCheck == true`.
Member

Also it would be nice to have tests for this new behavior

Also it would be nice to have tests for this new behavior
alexvanin marked this conversation as resolved
@ -0,0 +34,4 @@
```text
DELETE / HTTP/1.1
Host: data.s3.<Region>.frostfs-s3-gw.com
Owner

There should be X-Amz-Force-Delete-Bucket: true header as well.

There should be `X-Amz-Force-Delete-Bucket: true` header as well.
alexvanin marked this conversation as resolved
pogpp changed title from WIP: [#31] Add force bucket delete flag to [#31] Add force bucket delete flag 2024-07-25 07:45:11 +00:00
pogpp changed title from [#31] Add force bucket delete flag to [#31] Add force bucket delete flag 2024-07-25 07:45:26 +00:00
pogpp force-pushed feature/31-full_bucket_removal from 8e61b055da to 9c0b781193 2024-07-25 10:54:44 +00:00 Compare
pogpp force-pushed feature/31-full_bucket_removal from 9c0b781193 to 51c5c227c2 2024-07-25 11:05:04 +00:00 Compare
alexvanin approved these changes 2024-07-25 12:55:28 +00:00
alexvanin left a comment
Owner

Looks great!

Looks great!
dkirillov reviewed 2024-07-25 14:26:47 +00:00
@ -517,6 +535,13 @@ func deleteObjectsBase(hc *handlerContext, bktName string, objVersions [][2]stri
return w
}
func deleteBucketForce(t *testing.T, tc *handlerContext, bktName string, code int, value string) {
Member

Minor (non-blocking): it's better to write

func deleteBucketForce(t *testing.T, tc *handlerContext, bktName string, value bool, code int) {
Minor (non-blocking): it's better to write ``` func deleteBucketForce(t *testing.T, tc *handlerContext, bktName string, value bool, code int) { ```
dkirillov approved these changes 2024-07-25 14:27:17 +00:00
alexvanin merged commit 51c5c227c2 into master 2024-07-26 06:53:27 +00:00
alexvanin deleted branch feature/31-full_bucket_removal 2024-07-26 06:53:28 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-s3-gw#436
No description provided.