Repository navigation
rgw/multisite: defer datalog entries a stale period cannot resolve - #72777
Open
lumir-sliva wants to merge 2 commits into
Open
lumir-sliva wants to merge 2 commits into
lumir-sliva wants to merge 2 commits into
Conversation
When data sync meets a datalog entry for a bucket it has no instance for, RGWSyncGetBucketInfoCR fetches the instance from the metadata master and RGWMetaSyncSingleEntryCR treats a 404 as "deleted". Which zone is the master comes from the local period, and a zone that missed a period push is on an old one. A zone that was down while the master moved comes back on its old period, in which it is still the master itself, and answers its own lookup with 404 for every bucket created on the new master while it was away. The bucket peers come back empty, the entry completes as if synced, the shard marker moves past it, nothing is written to the error repo and the objects never arrive. The same happens without a restart when a link cut heals after the master moved, and to a secondary whose period is stale and whose old master has not synced the bucket yet. Before giving a bucket up on a 404, read the realm from the zone that logged the entry (GET /admin/realm over the data sync source connection) and compare realm epochs. If the source is on a newer realm epoch than the local current period, the 404 came from a master the realm no longer has, so return -ESTALE. If the realm cannot be read, return that error rather than -ENOENT. On equal epochs the 404 is authoritative and the bucket is skipped as before, so a bucket deleted on the master still converges. The bucket instance is never fetched from the source zone, which would resurrect buckets that were deleted on the master and not yet on the source. RGWDataSyncSingleEntryCR writes a deferred entry to the error repo as for any failure, but then completes successfully, so the entry is retried on the error repo's own backoff until the period push arrives and the realm reload restarts sync. Failing it would fail the whole shard: the restarted shard retries its entire error repo at once, and with writes arriving on the new master it does so again on every poll. An out-of-band notification has no timestamp and can't be parked; it completes too, since its datalog entry follows and is parked then. In full sync, RGWDataFullSyncSingleEntryCR no longer gives a bucket up when its first shard is deferred, and goes on to the remaining shards. RGWSyncGetBucketInfoCR has no sync context of its own, so the source connection is passed in by its callers: RGWSyncBucketCR from sc->conn, RGWGetBucketPeersCR from its source zone, and through RGWSyncGetBucketSyncPolicyHandlerCR. Without a source zone (bucket sync run without --source-zone) nothing changes. The deferral is logged as a warning each time the entry is tried, since a zone that never receives the new period keeps retrying until its period is updated. It is not logged as an error by the callers and stays out of 'sync error list', like -EBUSY and -EAGAIN. Fixes: https://tracker.ceph.com/issues/81761 Signed-off-by: Lumir Sliva <[email protected]>
Stop the master zone, promote a secondary, create a bucket with an object there, then start the old master and check that the object reaches it. The push of the new period to the old master fails while it is down and is retried after rgw_period_push_interval; raise that on the secondary's cluster so the old master runs data sync on its old period, in which it is still the master, before the new period reaches it. Without the fix the old master looks the bucket instance up on itself, takes the 404 for a deleted bucket, drops the datalog entry and the bucket sync checkpoint times out. Fixes: https://tracker.ceph.com/issues/81761 Signed-off-by: Lumir Sliva <[email protected]>
|
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 |
5 of 14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A zone that comes back after the metadata master moved can lose, for good, the objects written to buckets that were created on the new master while it was away. No error, nothing in
sync error list, andsync statussays caught up.Problem
The returning zone starts on its local period, in which it is still the metadata master itself. The new master's period push only lands later, because the pusher backed off while the zone was unreachable (
rgw_period_push_interval_max, 30 s by default). Until then:RGWSyncGetBucketInfoCRfetches it fromget_master_conn(), i.e. from itself. Its own access log shows theGET /admin/metadata/bucket.instance/...answered 404.RGWMetaSyncSingleEntryCRtakes the 404 as "deleted",RGWGetBucketPeersCRtolerates the-ENOENT, the pipe set comes back empty andRGWRunBucketSourcesSyncCRcompletes withr=0.The same happens without a restart when a link cut heals after the master moved.
Fix
Before giving a bucket up on that 404, read the realm from the zone that logged the entry (
GET /admin/realmover the data sync source connection) and compare realm epochs:-ESTALE;RGWDataSyncSingleEntryCRwrites the entry to the error repo and completes it, so it's retried on the error repo's backoff until the period push lands and the realm reload restarts sync.-ENOENT.The instance is never fetched from the source zone, which would resurrect buckets deleted on the master and not yet on the source.
The parked entry completes instead of failing because a failed entry fails the whole data sync shard: the restarted shard retries its entire error repo at once, and with writes still arriving on the new master that repeats on every poll. Out-of-band notifications carry no timestamp and can't be parked; they complete as well, since their datalog entry follows and is parked then.
In full sync the deferral only gets parked once full sync obligations carry a timestamp, which they currently never do: #72776 (https://tracker.ceph.com/issues/81830). Without it the full sync case behaves as it does on main.
Test
Two zones from
test-rgw-multisite.shon one box: zone 1 (master) stopped, zone 2 promoted, a bucket with 5 objects created on zone 2, zone 1 restarted. Zone 2's push is delayed withrgw_period_push_interval{,_max}=120so that zone 1's data sync always gets to the entry first.rgw_data_notify_interval_msec=200Earlier iterations of the same approach lost nothing in another 11 runs. While the zone is stale, each entry touching an unresolvable bucket costs two extra requests (the self-lookup and the realm GET), 185 over the 232 s window above; they stop with the push.
The second commit adds
test_bucket_created_during_master_outage, which raises the push interval on the secondary's cluster withconfig setto hit the window every time. On main it fails atzone_bucket_checkpointafter 526 s; with the fix it passes in 352 s.test_multi_period_incremental_syncpasses with the fix (with #72671 on top for the unrelated https://tracker.ceph.com/issues/81758).Not exercised in a run: the equal-epoch path for a bucket really deleted on the master. Deleting a bucket through S3 keeps its
bucket.instanceon the master, so in my tries the master never answered 404; that path is the unchanged one.Fixes: https://tracker.ceph.com/issues/81761
Checklist