Skip to content

rgw/multisite: never distribute an uncommitted staging period - #72669

Open
lumir-sliva wants to merge 2 commits into
ceph:mainfrom
lumir-sliva:rgw-multisite-no-staging-period-push
Open

lumir-sliva wants to merge 2 commits into
ceph:mainfrom
lumir-sliva:rgw-multisite-no-staging-period-push

Conversation

@lumir-sliva

@lumir-sliva lumir-sliva commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

A failed period update --commit on the master zone still notified the realm. At that point the period carries the staging id <realm_id>:staging, so the period pusher sent it to every other zone, and they made it their current period. The real period that follows has a lower epoch and gets dropped, every later master change is refused, and in my tests both zones ended up master of their own copy (split brain).

The notify became unconditional in ab30392 (#57640), when it moved out of rgw::commit_period(). Squid isn't affected.

The fix has three layers. Each one stops the leak on its own, so a zone that still leaks can't poison a zone with the fix:

  • commit_period() in radosgw-admin notifies only after a successful commit
  • RGWPeriodPusher::handle_notify() refuses to push a staging id
  • RGWOp_Period_Post rejects a pushed staging id with -EINVAL

Tested on two tentacle 20.2.4 clusters (4 gateways per zone) with a genuine refusal: metadata sync stopped on zone B, master moved A -> B -> A, then promoting B without --yes-i-really-mean-it was refused with "2 period(s) behind". Each layer was switched on alone:

  • no layer: 4 staging pushes reach A 0.07 s after the refusal, HTTP 200
  • full fix: nothing sent
  • only the pusher check (old radosgw-admin): 4x "not pushing uncommitted staging period", 0 pushes
  • only the receiver check (old sender): 32 pushes in 120 s, all HTTP 400, A keeps its period

The receiver check protects the peer's state but not period delivery. An old pusher that leaked a staging period has recorded its realm epoch, so it drops the real period from the next commit as "not newer" and keeps retrying the staging one (backoff capped at 30 s) until its gateway restarts or a later period comes along. In a mixed-version realm, the zone that runs period update --commit needs the new radosgw-admin or the new gateways. If a commit fails on a zone that hasn't been upgraded yet, restart that zone's gateways before retrying.

A zone that already took the staging period as current doesn't recover by itself after the upgrade: the real period with the same realm epoch is refused as a fork in the period history. In my tests, running radosgw-admin realm pull --url <master> on that zone, then metadata sync init and a gateway restart on both zones, got it back.

The second commit adds two tests to rgw_multi/tests.py:

  • test_failed_period_commit_not_distributed: period update --commit on the master leaves the staging period one epoch behind, so a following period commit is refused on the epoch check. The test checks that no zone switches to the staging period.
  • test_staging_period_push_rejected: sends the master's staging period to a secondary's /admin/realm/period the way an older pusher does, and expects HTTP 400 with the secondary keeping its period.

On a 3-zone mstart realm, 2 runs each: without the fix both fail (the second zone takes <realm_id>:staging, and the push gets HTTP 200). With the fix both pass, the refused commit sends nothing, and the receiver logs "rejecting uncommitted staging period". The pusher check has no test of its own, because with the radosgw-admin fix in place nothing can trigger it.

Built on current main (504b1a2, radosgw and radosgw-admin). The lab runs were on a v20.2.4 backport of the same fix, and the test runs on a build carrying the same three files.

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

Backport: tentacle.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
    • Includes unit test(s)
    • Includes integration test(s)
    • Includes bug reproducer
    • No tests

commit_period() in radosgw-admin notified the realm even when
rgw::commit_period() failed. The period at that point still carries the
staging id, so RGWPeriodPusher on every gateway pushed
"<realm_id>:staging" to the other zones, which stored it as their
current period. The real committed period arrives later with a lower
epoch and gets discarded, the zone is stuck on the staging period and
every following master change is refused.

This started when the realm notify moved out of rgw::commit_period() in
ab30392, which made it unconditional. A refused master change is
enough to trigger it, for example "period update --commit" on a
secondary without --yes-i-really-mean-it.

Only notify after a successful commit, and refuse staging period ids in
the period pusher and in POST /admin/realm/period, so a peer that still
leaks one can't poison the other zones.

Fixes: https://tracker.ceph.com/issues/81760
Signed-off-by: Lumir Sliva <[email protected]>
@lumir-sliva
lumir-sliva requested a review from a team as a code owner October 14, 2026 10:07
@github-actions

Copy link
Copy Markdown

Thank you for your contribution. Since you are not yet a member of the Ceph organization with write permissions on ceph/ceph.git, our CI will not automatically run. Any member of the Ceph organization may label this PR ci-approved to allow Jenkins CI jobs to run.

@smanjara

smanjara commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

looks good, thanks @lumir-sliva. please add a test case if you can.

Two tests for the fix of #81760. A failed 'period commit' on the
master zone must not reach the other zones: 'period update --commit'
leaves the staging period one epoch behind, so committing it again is
refused, and before the fix the period pusher still sent
"<realm_id>:staging" to every zone, which made it current. And a zone
must refuse a staging period pushed to POST /admin/realm/period, as an
older gateway's period pusher would send it.

Fixes: https://tracker.ceph.com/issues/81760
Signed-off-by: Lumir Sliva <[email protected]>
@lumir-sliva

Copy link
Copy Markdown
Contributor Author

looks good, thanks @lumir-sliva. please add a test case if you can.

thanks, tests added.

@anrao19

anrao19 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-anrao6-testing-2026-11-13-0833-main.

@anrao19 anrao19 added wip-anrao1-testing and removed wip-anrao6-testing wip-anrao6-testing labels Nov 26, 2026
@anrao19

anrao19 commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

This PR has been removed from wip-anrao6-testing-2026-11-13-1158-main.

@anrao19

anrao19 commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-anrao1-testing-2026-11-26-0609-main.

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.

5 participants