Skip to content

Comments

rgw: skip empty check on non-owned buckets by zonegroup#60227

Merged
cbodley merged 3 commits intoceph:mainfrom
clwluvw:zonegroup-delbucket
Apr 23, 2025
Merged

rgw: skip empty check on non-owned buckets by zonegroup#60227
cbodley merged 3 commits intoceph:mainfrom
clwluvw:zonegroup-delbucket

Conversation

@clwluvw
Copy link
Member

@clwluvw clwluvw commented Oct 9, 2024

Compare RGW's zonegroup with the bucket's zonegroup and only do the empty check when the bucket is owned by the RGW running the delete.

Fixes: https://tracker.ceph.com/issues/68190

@clwluvw
Copy link
Member Author

clwluvw commented Oct 27, 2024

Should we make this more generic to indexless buckets? (ca96feb)

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@github-actions github-actions bot added the stale label Dec 26, 2024
@clwluvw clwluvw removed the stale label Dec 27, 2024
@clwluvw clwluvw requested a review from cbodley January 8, 2025 17:43
@github-actions
Copy link

github-actions bot commented Jan 8, 2025

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@clwluvw clwluvw force-pushed the zonegroup-delbucket branch 2 times, most recently from 2d47f0a to ea0b0a1 Compare January 8, 2025 22:42
@clwluvw clwluvw force-pushed the zonegroup-delbucket branch from ea0b0a1 to 1880739 Compare January 9, 2025 16:16
@clwluvw clwluvw requested a review from a team as a code owner January 9, 2025 16:16
Comment on lines +1436 to +1437
int RGWBucketAdminOp::remove_bucket(rgw::sal::Driver* driver, const rgw::SiteConfig& site,
RGWBucketAdminOpState& op_state,
Copy link
Contributor

@cbodley cbodley Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the DELETE /admin/bucket api doesn't actually call through this function, so i think we'll need special logic for that. currently it just calls rgw_forward_request_to_master() then sal::Bucket::remove()

edit: or maybe the rest api should use RGWBucketAdminOp::remove_bucket() instead

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm I couldn't get your point with that... why do we need DELETE /admin/bucket to comeback to RGWBucketAdminOp::remove_bucket again? Is it about those controls I added to RGWBucketAdminOp::remove_bucket()?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because RGWOp_Bucket_Remove doesn't call through RGWBucketAdminOp::remove_bucket(), it won't get redirected to the bucket's zonegroup so may remove the bucket without its data

we generally put code in RGWBucketAdminOp so it can shared by both the radosgw-admin commands and their /admin APIs. that's why it's surprising to me that RGWOp_Bucket_Remove doesn't use it

Copy link
Member Author

@clwluvw clwluvw Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because RGWOp_Bucket_Remove doesn't call through RGWBucketAdminOp::remove_bucket(), it won't get redirected to the bucket's zonegroup so may remove the bucket without its data

Basically in RGWBucketAdminOp::remove_bucket() we don't redirect to the bucket's zonegroup but to stop if the zonegroups don't match: 1880739#diff-36d954c172f2e053a2942c640d14a6183efb6f19d0ad7c991762a769094f2b35R1449-R1455

we generally put code in RGWBucketAdminOp so it can shared by both the radosgw-admin commands and their /admin APIs. that's why it's surprising to me that RGWOp_Bucket_Remove doesn't use it

I agree this doesn't look efficient, we can merge these together, but I was wondering how to handle that if-clause to not stop for forwarded requests when zonegroup doesn't match and it's master zonegroup. as that is an admin API it's always about system_user so that can't be a good identifier I believe.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cbodley I have integrated both into one and tried a workaround for detecting forwarded requests by checking for rgwx-zonegroup arg. Could you please have another look?

@clwluvw clwluvw force-pushed the zonegroup-delbucket branch 3 times, most recently from 3bc710e to c1881c5 Compare January 13, 2025 17:08
@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@cbodley
Copy link
Contributor

cbodley commented Mar 31, 2025

qa was mostly green in https://pulpito.ceph.com/cbodley-2025-03-28_17:53:04-rgw-wip-cbodley-testing-distro-default-smithi/, but the rgw/dbstore suite failed on test_bucket_delete_nonempty:

=================================== FAILURES ===================================
_________________________ test_bucket_delete_nonempty __________________________

    def test_bucket_delete_nonempty():
        key_names = ['foo']
        bucket_name = _create_objects(keys=key_names)
        client = get_client()

>       e = assert_raises(ClientError, client.delete_bucket, Bucket=bucket_name)

s3tests_boto3/functional/test_s3.py:1532:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

excClass = <class 'botocore.exceptions.ClientError'>
callableObj = <bound method ClientCreator._create_api_method.<locals>._api_call of <botocore.client.S3 object at 0x7faa2d922410>>
args = (), kwargs = {'Bucket': 'test-qod9ft1hu6wj1a69qj4n440z-105'}
excName = 'ClientError'

    def assert_raises(excClass, callableObj, *args, **kwargs):
        """
        Like unittest.TestCase.assertRaises, but returns the exception.
        """
        try:
            callableObj(*args, **kwargs)
        except excClass as e:
            return e
        else:
            if hasattr(excClass, '__name__'):
                excName = excClass.__name__
            else:
                excName = str(excClass)
>           raise AssertionError("%s not raised" % excName)
E           AssertionError: ClientError not raised

s3tests_boto3/functional/utils.py:19: AssertionError

if you need to debug that locally, vstart supports --rgw_store dbstore

@clwluvw
Copy link
Member Author

clwluvw commented Mar 31, 2025

the rgw/dbstore suite failed on test_bucket_delete_nonempty

This looks strange as the zoengroup id, which I take should be uuid is set to default

std::unique_ptr<RGWZoneGroup> rzg = std::make_unique<RGWZoneGroup>("default", "default");

@clwluvw
Copy link
Member Author

clwluvw commented Mar 31, 2025

the rgw/dbstore suite failed on test_bucket_delete_nonempty

This looks strange as the zoengroup id, which I take should be uuid is set to default

std::unique_ptr<RGWZoneGroup> rzg = std::make_unique<RGWZoneGroup>("default", "default");

@cbodley - Would that make sense to skip this fix for dbstore based on the following comment?

/* XXX: for now only one zonegroup supported */

@cbodley
Copy link
Contributor

cbodley commented Mar 31, 2025

@cbodley - Would that make sense to skip this fix for dbstore based on the following comment?

sure. it will probably be a long time before any other drivers support multisite. as long as we have multisite test coverage, that will force us to fix this in dbstore eventually

clwluvw added 2 commits March 31, 2025 22:50
Compare RGW's zonegroup with bucket's zonegroup and only do the empty
check when the bucket is owned by the RGW running the delete.

Fixes: https://tracker.ceph.com/issues/68190
Signed-off-by: Seena Fallah <[email protected]>
To align same functionality for bucket deletion from both API and
rgw-admin, use the same function from RGWBucketAdminOp.

Signed-off-by: Seena Fallah <[email protected]>
@clwluvw clwluvw force-pushed the zonegroup-delbucket branch from 472c2c6 to eb9f569 Compare March 31, 2025 20:51
Allow running `radosgw-admin bucket rm` from secondary zonegroup.
This allows bucket deletion with `--purge-objects` and with
`--bypass-gc` when deleting the bucket owned by non-master zonegroup.

Signed-off-by: Seena Fallah <[email protected]>
@clwluvw clwluvw force-pushed the zonegroup-delbucket branch from eb9f569 to c7694dd Compare March 31, 2025 20:52
@clwluvw
Copy link
Member Author

clwluvw commented Mar 31, 2025

fixed the dbstore case and also addressed @anthonyeleven's review on the doc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants