Repository navigation
rgw: redirect to the endpoint of the bucket's zonegroup - #70931
Conversation
rgw_build_bucket_policies() returns ERR_PERMANENT_REDIRECT when a request reaches a zonegroup that does not hold the bucket, but s->zonegroup_endpoint was read from the local zonegroup. abort_early() builds the Location header from that endpoint, so the client was redirected back to the gateway it had just used. Clients that follow redirects then retry in a tight loop. Look the bucket's zonegroup up in the current period and take the endpoint from there instead. If that zonegroup is not part of the period, leave the endpoint empty and log the reason rather than pointing the client at itself. This also restores Request.ZoneGroup.Name and Request.ZoneGroup.Endpoint in lua scripts to the bucket's zonegroup, which is what they reported before the endpoint lookup was dropped. Fixes: http://tracker.ceph.com/issues/64983 Fixes: e2eb66a Signed-off-by: ramin.najarbashi <[email protected]>
Add unittest_rgw_zone for rgw::get_zonegroup_endpoint() and the new rgw::find_zonegroup_by_id(), including the case that caused the redirect loop: a bucket in another zonegroup must resolve to that zonegroup's endpoint and not the local one. Signed-off-by: ramin.najarbashi <[email protected]>
|
@cbodley @adamemerson @yuvalif Could you take a look when you have time? We hit this redirect loop issue after a recent update and are currently affected by it. This PR aims to fix the problem described in tracker #64983. |
|
@cbodley @adamemerson @yuvalif — follow-up to help unblock this. Tracker: http://tracker.ceph.com/issues/64983 (the earlier Why this is urgent for us: after a recent upgrade we hit the redirect loop in a multi-zonegroup deployment (client follows Ask: when you have a moment, |
|
Hi @cbodley @adamemerson @yuvalif — gentle bump when you have a spare moment. No rush on my side; just checking whether an Thanks again. |
|
ok to test |
|
This PR has been added to main integration testing by anuchaithra started 2026-08-19-07:20. |
|
jenkins test make check arm64 |
|
@adamemerson — a question on x86_64 That console URL currently returns 404 (log not available), so I cannot tell whether it is this change or an infra/runner issue. Is there anything I should do on this PR (rebase, code fix), or is a retrigger of Thank you. |
|
jenkins test make check arm64 |
pr testing completed and approved by @ivancich , more details in : https://tracker.ceph.com/issues/79605 |
Problem
When a request for a bucket that lives in another zonegroup reaches a gateway,
rgw_build_bucket_policies()correctly returnsERR_PERMANENT_REDIRECT, buts->zonegroup_endpointwas read from the local zonegroup:abort_early()then builds theLocationheader from that endpoint, so the301points at the gateway the client just used. Clients that follow redirectsresend the same request in a tight loop.
Example from a two-zonegroup cluster:
...with a
Locationheader naming the local zonegroup's first endpoint.This is the loop reported in http://tracker.ceph.com/issues/64983, where
two-zonegroup teuthology jobs spent hours redirecting to the same endpoint
until the requests failed with
RequestTimeTooSkewed.Fix
Add
rgw::find_zonegroup_by_id(), which resolves a zonegroup id against thelocal zonegroup or the current period, and use it to take the endpoint and name
from the zonegroup that actually holds the bucket.
When the bucket's zonegroup is not part of the period, the endpoint is left
empty and the reason is logged, so the response carries no
Locationratherthan pointing the client back at itself.
Single-zonegroup deployments are unaffected: the lookup returns the local
zonegroup, exactly as before.
This also restores
Request.ZoneGroup.NameandRequest.ZoneGroup.Endpointinlua scripts to the bucket's zonegroup, which is what they reported before
e2eb66a dropped the per-bucket zonegroup lookup.
Testing
Built and ran locally (gcc 12, Release):
The cross-zonegroup redirect path itself is exercised by the
rgw/multisitesuite with
realms/two-zonegroup.yaml; I have not run teuthology for thischange.
Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.