rgw: check for location constraint on master zonegroup#52791
rgw: check for location constraint on master zonegroup#52791
Conversation
807cfa7 to
9e042f3
Compare
is this really what we want? i tend to think it should default to the zonegroup that issued the CreateBucket request. if the master zonegroup owns it instead, then the issuing zone/zonegroup would have to forward all object operations to the master zonegroup. in that case, the client would lose any benefits of locality with its local zone/zonegroup |
|
p.s. i reworked some of the forward_request_to_master logic in #50599. just a heads-up that we'll likely see conflicts in RGWCreateBucket::execute |
|
@cbodley With the definition of AWS for the default region, this would make sense to have a default region and if the I would say this would make sure to the clients that they are asking for the right location rather than picking the location that they are requesting as an endpoint (maybe by fault?). |
|
@cbodley I couldn't follow what you meant by forwarding the request to the master. The main idea of this from my PoV was the thing I mentioned in my comment above (bucket creation and...). Are you talking about any more corners here? |
@clwluvw in rgw multisite, the master zonegroup is authoritative for bucket/user metadata, but failover may change which zonegroup is the master. i'm not sure it makes sense to think about the master zonegroup the same way you think about a default region in aws s3 clients/applications don't need to be aware of rgw's zonegroups at all, they just need to know the address of an http endpoint. generally they'll run some workload that creates a bucket and operates on objects in it. i think it would be unexpected if that whole workload gets redirected to a remote zonegroup instead clients that do know about the rgw zonegroups have full control over the placement of their buckets via |
@clwluvw i was only pointing out that another PR moved around some of the same code that you're touching here |
9e042f3 to
b7c934a
Compare
|
@cbodley That pretty much makes sense - Also I was worried about if we want to follow the same concept then how are we going to deal with Regarding the PR you mentioned, I guess the conflict point in the implementation I proposed is still there: // validate the LocationConstraint
if (!location_constraint.empty() && !relaxed_region_enforcement) {
// on the master zonegroup, allow any valid api_name. otherwise it has to
// match the bucket's zonegroupBasically, I think it's better to check the LocationConstraint if the zonegroup is master as well otherwise the user might though it requested another zonegroup on the wrong HTTP endpoint and it gets 200 as a result and so the thought would be the bucket was placed in the zonegroup in bucket create request but the actual is not. What do you think? |
|
ping @cbodley |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
b7c934a to
f178f17
Compare
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
f178f17 to
7265fed
Compare
|
Reproduction:
<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<LocationConstraint>B</LocationConstraint>
</CreateBucketConfiguration >Results in bucket creation in zonegroup A without any error. This is a client error as the user is asking to create the bucket in zone The PR will fix the |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
|
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. |
|
This pull request has been automatically closed because there has been no activity for 90 days. Please feel free to reopen this pull request (or open a new one) if the proposed change is still appropriate. Thank you for your contribution! |
a897498 to
c274c9a
Compare
|
jenkins test make check |
|
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. |
c274c9a to
3049af1
Compare
|
jenkins test submodules |
|
jenkins test windows |
i would hope that #59960 will cause this bucket's creation to set the correct |
I don't think so as when you are master you will ignore the |
thanks. would something like this be reasonable? if (location_constraint) {
bucket.zonegroup = api_name_to_zonegroup_id(location_constrant);
} else if (rgwx_zonegroup) {
bucket.zonegroup = rgwx_zonegroup; // default to requesting zonegroup
} else {
bucket.zonegroup = local_zonegroup_id; // default to local zonegroup
} |
0171282 to
4a22bfa
Compare
|
jenkins test make check arm64 |
src/rgw/rgw_op.cc
Outdated
| // For non-master zonegroups, enforce location constraint match | ||
| const bool enforce_location_match = !period || !my_zonegroup.is_master; | ||
| if (enforce_location_match && !my_zonegroup.equals(bucket_zonegroup->get_id())) { |
There was a problem hiding this comment.
is there a reason that other zonegroups shouldn't also support creation of remote buckets?
in aws, it looks like you can send a CreateBucket request to any region, naming any other valid region in the LocationConstraint
There was a problem hiding this comment.
No you will get IllegalLocationConstraintException is response. and tbh I would still be voting for master to also not create bucket for other zonegroups when the request is initiated by the user - not forwarded.
This would make some races easier to solve deleting the condition that we need to cover.
There was a problem hiding this comment.
No you will get IllegalLocationConstraintException is response.
ah, ok. sorry for the confusion
and tbh I would still be voting for master to also not create bucket for other zonegroups when the request is initiated by the user - not forwarded.
+1
There was a problem hiding this comment.
+1
🥹
I just drafted a test case for this as well, will try to verify on my local asap.
There was a problem hiding this comment.
The tests have passed on my local, but we will need #59960.
There was a problem hiding this comment.
zone a1: https://qa-proxy.ceph.com/teuthology/cbodley-2024-12-19_17:37:17-rgw:multisite-wip-69281-distro-default-smithi/8045098/remote/smithi043/log/rgw.c1.client.0.log.gz
zone a2: https://qa-proxy.ceph.com/teuthology/cbodley-2024-12-19_17:37:17-rgw:multisite-wip-69281-distro-default-smithi/8045098/remote/smithi104/log/rgw.c1.client.1.log.gz
zone b1: https://qa-proxy.ceph.com/teuthology/cbodley-2024-12-19_17:37:17-rgw:multisite-wip-69281-distro-default-smithi/8045098/remote/smithi160/log/rgw.c2.client.0.log.gz
zone b2: https://qa-proxy.ceph.com/teuthology/cbodley-2024-12-19_17:37:17-rgw:multisite-wip-69281-distro-default-smithi/8045098/remote/smithi187/log/rgw.c2.client.1.log.gz
There was a problem hiding this comment.
ok this is actually weird - api_name is empty.
2024-12-19T18:15:53.211 INFO:teuthology.orchestra.run.smithi043.stdout:{"id":"8987fccd-6980-4682-9cce-cf39a4aa6b34","epoch":12,"predecessor_uuid":"5276a8ed-77a4-4898-9669-84e295758977","sync_status":[],"period_map":{"id":"8987fccd-6980-4682-9cce-cf39a4aa6b34","zonegroups":[{"id":"a","name":"a","api_name":"","is_master":true,"endpoints":["http://smithi043.front.sepia.ceph.com:8000"],"hostnames":[],"hostnames_s3website":[],"master_zone":"6a93f239-7b93-4dfe-94b1-baf12183eb58","zones":[{"id":"250dd5e0-4049-46ca-bf5b-e7e54b3b29b4","name":"a2","endpoints":["http://smithi104.front.sepia.ceph.com:8001"],"log_meta":false,"log_data":true,"bucket_index_max_shards":11,"read_only":false,"tier_type":"","sync_from_all":true,"sync_from":[],"redirect_zone":"","supported_features":["compress-encrypted","notification_v2","resharding"]},{"id":"6a93f239-7b93-4dfe-94b1-baf12183eb58","name":"a1","endpoints":["http://smithi043.front.sepia.ceph.com:8000"],"log_meta":false,"log_data":true,"bucket_index_max_shards":11,"read_only":false,"tier_type":"","sync_from_all":true,"sync_from":[],"redirect_zone":"","supported_features":["compress-encrypted","notification_v2","resharding"]}],"placement_targets":[{"name":"default-placement","tags":[],"storage_classes":["STANDARD"]}],"default_placement":"default-placement","realm_id":"a54451a6-0f7f-48fa-b6c0-a34c0eb1ea9d","sync_policy":{"groups":[]},"enabled_features":["notification_v2","resharding"]},{"id":"b","name":"b","api_name":"","is_master":false,"endpoints":["http://smithi160.front.sepia.ceph.com:8000"],"hostnames":[],"hostnames_s3website":[],"master_zone":"b3be8bac-85cd-4275-8c15-00f60f318a67","zones":[{"id":"b3be8bac-85cd-4275-8c15-00f60f318a67","name":"b1","endpoints":["http://smithi160.front.sepia.ceph.com:8000"],"log_meta":false,"log_data":true,"bucket_index_max_shards":11,"read_only":false,"tier_type":"","sync_from_all":true,"sync_from":[],"redirect_zone":"","supported_features":["compress-encrypted","notification_v2","resharding"]},{"id":"e868f7a7-a7b3-4202-8e6f-86642035ca92","name":"b2","endpoints":["http://smithi187.front.sepia.ceph.com:8001"],"log_meta":false,"log_data":true,"bucket_index_max_shards":11,"read_only":false,"tier_type":"","sync_from_all":true,"sync_from":[],"redirect_zone":"","supported_features":["compress-encrypted","notification_v2","resharding"]}],"placement_targets":[{"name":"default-placement","tags":[],"storage_classes":["STANDARD"]}],"default_placement":"default-placement","realm_id":"a54451a6-0f7f-48fa-b6c0-a34c0eb1ea9d","sync_policy":{"groups":[]},"enabled_features":["notification_v2","resharding"]}],"short_zone_ids":[{"key":"250dd5e0-4049-46ca-bf5b-e7e54b3b29b4","val":104308217},{"key":"6a93f239-7b93-4dfe-94b1-baf12183eb58","val":2854171449},{"key":"b3be8bac-85cd-4275-8c15-00f60f318a67","val":1981456006},{"key":"e868f7a7-a7b3-4202-8e6f-86642035ca92","val":3492425437}]},"master_zonegroup":"a","master_zone":"6a93f239-7b93-4dfe-94b1-baf12183eb58","period_config":{"bucket_quota":{"enabled":false,"check_on_raw":false,"max_size":-1,"max_size_kb":0,"max_objects":-1},"user_quota":{"enabled":false,"check_on_raw":false,"max_size":-1,"max_size_kb":0,"max_objects":-1},"user_ratelimit":{"max_read_ops":0,"max_write_ops":0,"max_read_bytes":0,"max_write_bytes":0,"enabled":false},"bucket_ratelimit":{"max_read_ops":0,"max_write_ops":0,"max_read_bytes":0,"max_write_bytes":0,"enabled":false},"anonymous_ratelimit":{"max_read_ops":0,"max_write_ops":0,"max_read_bytes":0,"max_write_bytes":0,"enabled":false}},"realm_id":"a54451a6-0f7f-48fa-b6c0-a34c0eb1ea9d","realm_epoch":2}
There was a problem hiding this comment.
hmm.. I'm not sure why we create zonegroups via zonegroup set but that might explain why api_name is created empty
ceph/qa/tasks/rgw_multisite.py
Lines 357 to 369 in 862ed6e
There was a problem hiding this comment.
passed multisite jobs in https://pulpito.ceph.com/cbodley-2025-01-07_21:31:35-rgw:multisite-wip-69281-distro-default-smithi/
rgw_multi.tests.test_bucket_create_location_constraint ... ok
4a22bfa to
f968c49
Compare
f968c49 to
4c45bb2
Compare
When creating a bucket with a location constraint specified by the user, this constraint is not included in createparams. Therefore, to create the bucket in the requested location, createparams and bucket_zonegroup must be replaced with the user-provided values. Fixes: https://tracker.ceph.com/issues/62309 Signed-off-by: Seena Fallah <[email protected]>
If api_name is not set in the config, use name as the api_name, otherwise on RGW it will be set to an empty string. Signed-off-by: Seena Fallah <[email protected]>
4c45bb2 to
c21b5f7
Compare
Check the location constraint of the request when the zonegroup is master
Fixes: https://tracker.ceph.com/issues/62309