Skip to content

rgw/multisite: do not report metadata sync caught up on an old period - #72778

Open
lumir-sliva wants to merge 2 commits into
ceph:mainfrom
lumir-sliva:rgw-sync-status-other-period
Open

lumir-sliva wants to merge 2 commits into
ceph:mainfrom
lumir-sliva:rgw-sync-status-other-period

Conversation

@lumir-sliva

Copy link
Copy Markdown
Contributor

Summary

radosgw-admin sync status prints "metadata is caught up with master" for a zone whose metadata sync is still on an older period than the realm's current one, which is exactly the state an operator runs it for after a master change.

Problem

get_md_sync_status() (src/rgw/radosgw-admin/radosgw-admin.cc) compares the sync's period with the zone's own current period, not the master's: the variable is called master_period, but it holds the local get_current_period_id(). Both cases reproduce with three zones on one box, zone 3's gateway down while the master moves from zone 1 to zone 2:

  • Zone 3 missed the period push, so its local period is the old one too. Sync and local period match, the shards are compared against the master's mdlog of that old period, and the output says caught up with no hint at all.
  • After realm pull on zone 3 (gateway still down) the local period is the new one. The command prints "master is on a different period", skips the shard comparison, counts nothing as behind and prints "metadata is caught up with master" right below.

Fix

Ask the master for the realm's current period (GET /admin/realm over the master connection, the endpoint realm pull uses; the local period stays the fallback if the request fails) and compare the sync's period and realm epoch against it. When they differ, the output names the sync's period, the local one if that is stale as well, and the master's, says how many periods metadata sync is behind, and never says caught up. The shard comparison is unchanged and still only runs when the sync is on the local period, whose mdlog is the one fetched. The old "master is on a different period" line is replaced.

Test

Case 1 before:

                incremental sync: 64/64 shards
                metadata is caught up with master

Case 1 after:

                incremental sync: 64/64 shards
                metadata sync is on period 52892c11-... (realm epoch 2)
                local period 52892c11-... (realm epoch 2) is not the master's current period
                master is on period 67fa9171-... (realm epoch 3)
                metadata is 1 period behind the master

Case 2 prints the same without the "local period" line.

The second commit adds test_sync_status_metadata_period_behind, covering both cases and checking that the output says caught up again once the zone is back (3 zones, 1 gateway each). On main it fails at assert 'metadata is caught up with master' not in status; with the fix it passes in 79 s. test_multi_period_incremental_sync fails on current main regardless of this change (zone 3 ends up on a period id the other zones don't have, https://tracker.ceph.com/issues/81758); with #72671 on top it passes with this change as well.

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

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)

'radosgw-admin sync status' compared the period of the metadata sync
with the zone's own current period and, when they differed, printed
"master is on a different period" and skipped the shard comparison.
With no shards to compare it then counted nothing as behind and printed
"metadata is caught up with master" right below. When the zone's own
period was stale too, because it missed the period push while its
gateways were down, the two periods matched, the shards were compared
against the master's mdlog of that old period, and the output said
caught up with no hint at all.

Ask the master for the realm's current period (GET /admin/realm over
the master connection, falling back to the local period if the request
fails) and compare the period and realm epoch of the sync against that.
When they differ, print the period and realm epoch of the sync, of the
local configuration if that one is stale as well, and of the master,
report how many periods the metadata sync is behind, and never
claim it is caught up. The shard comparison is unchanged and still only
runs when the sync is on the local period, whose mdlog is the one
fetched.

Fixes: https://tracker.ceph.com/issues/81763
Signed-off-by: Lumir Sliva <[email protected]>
Stop the gateways of a non-master zone, move the master to another zone
and check that 'radosgw-admin sync status' on the stopped zone reports
its metadata sync as one period behind rather than caught up,
both while the zone's own period is stale and after a 'realm pull'
brought in the current period. Then restart the gateways, move the
master back and check that the output says caught up again.

Fixes: https://tracker.ceph.com/issues/81763
Signed-off-by: Lumir Sliva <[email protected]>
@lumir-sliva
lumir-sliva requested a review from a team as a code owner October 16, 2026 12:43
@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.

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.

2 participants