Repository navigation
rgw/multisite: rgw meta sync version check - #71058
SaravananPalanisamyRWTH wants to merge 4 commits into
Conversation
427d38a to
57b3ba4
Compare
|
it looks like some commits may have disappeared here, but i'll add my 2c anyway. as i mentioned in discussion of https://tracker.ceph.com/issues/80389#note-3, i'm skeptical that we ever want to compare cls versions across zones
we may be better off finding a way to prevent metadata sync from racing with itself in the first place. that's happening within a single radosgw process, so we'd just need to track outstanding calls to RGWMetaSyncSingleEntryCR in memory for example: if we're processing the mdlog and see a metadata key that's already in progress, skip it but set a flag on the existing RGWMetaSyncSingleEntryCR. after RGWMetaSyncSingleEntryCR finishes, it would check that flag to see whether it should retry - and if RGWReadRemoteMetadataCR returns the same version as before, it can skip the RGWMetaStoreEntryCR |
this sounds like a good approach.
just one thing to add - skipping an entry makes it easy to get the marker tracker wrong, so we should be explicit about handling that. the retry flag can probably live on the tracker rather than on the CR. bucket sync in rgw_data_sync.cc already does this with |
57b3ba4 to
0ac035b
Compare
Thank you for the suggestion @smanjara . I had already considered this approach and implemented it using the existing |
0ac035b to
919d0f6
Compare
919d0f6 to
48edd52
Compare
aaf2758 to
f50285e
Compare
b115ca2 to
7342824
Compare
| if (marker_tracker) { | ||
| marker_tracker->reset_need_retry(raw_key); | ||
| } | ||
| /* test-only: delay the fetch of a bucket.instance entry, so the fetch sees |
There was a problem hiding this comment.
This test-only block is a bit hard to read inline. Could the "should I hold this entry?" decision be pulled into a small helper, along with the two ..._hold_taken flags (as function-local statics rather than file-scope)? The yield/wait loop has to stay here since it's part of the coroutine, but moving just the predicate + flag bookkeeping out would make operate() read more clearly and both (including the below one) injection points (..._hold and ..._fetch_hold) could share the one helper.
There was a problem hiding this comment.
agreed. IMO its difficult to write tests for every single concurrency bug that we fix without the instrumentation code creep. and they should certainly not introduce new strings per test in the rgw codebase. while these are still useful in reproducing and verifying such bugs locally during development, they don't necessarily need to be checked in. i think its acceptable to just add a simple case to pause secondary, do both writes, then resume though it may not always execute in the order we want to test.
- turn off sync on secondary
- two user/metadata modifies (or two bucket links) on master
- turn sync back on
- checkpoint
- assert equal
you are welcome to share any other testing ideas you may have. cc @cbodley
There was a problem hiding this comment.
@BBoozmen I moved the hold decision and its flags into a shared helper,meta_sync_should_hold().
@smanjara as you noted, pause/resume may not hit the order we want.
I agree that adding instrumentation for every race condition type introduce code creep. A hold between fetch and apply is the best way I know to force that order, based on the existing code: RGWMetaSyncSingleEntryCR already has delay_meta_sync_bucket_instance_store/_entrypoint_store using the same rgw_inject_delay_* options.
I'm open to another approach if you have one in mind. cc @cbodley
There was a problem hiding this comment.
@SaravananPalanisamyRWTH, while Shilpa and Casey are still reviewing, would you mind running the tests in two extra configurations?
- without the skip commit (1+3+4): we'd expect
test_stale_metadata_applied_after_concurrent_updatesto pass andtest_redundant_metadata_apply_skipped_on_retryto fail with 2 applies - without either fix (3+4 only): we'd expect both tests to fail
The reason I'm asking: on the current base (before #71779) the objv_is_local gate is always false, so test_redundant_metadata_apply_skipped_on_retry only checks the final owner and passes even without the fix.
Rebasing onto main and asserting applies == 1 unconditionally should cover that.
The ordering also depends on a fixed sleep and a one-shot hold, so seeing each test fail consistently without its fix would confirm they really reproduce the issue rather than passing by accident.
There was a problem hiding this comment.
RGWMetaSyncSingleEntryCRalready hasdelay_meta_sync_bucket_instance_store/_entrypoint_storeusing the samergw_inject_delay_*options.
@SaravananPalanisamyRWTH I think the existing delay_meta_sync_bucket_instance_store sleep alone is enough to reproduce the race without the hold points. could you take a look at #73473 and see if that works for you?
the test does the same things - delay the first update, make a second update while it waits, and assert the secondary ends with the second owner. the difference is that it uses the existing fixed sleep instead of a hold, so rgw_sync doesn't need any additional test related code.
This mirrors commit e08eb9c ("rgw: don't spawn multiple concurrent object sync for same object") Concurrent RGWMetaSyncSingleEntryCR coroutines for the same key can apply mdlog entries out of order. Track each in-flight key by mapping key->marker in the shard's marker tracker. If sync receives another entry of the same key concurrently, set the retry flag instead of starting a new coroutine resulting in contention Fixes: https://tracker.ceph.com/issues/79311 Signed-off-by: Saravanan Palanisamy <[email protected]>
A retry for a key already in-flight can re-fetch the same remote state twice. Track the applied version and skip the redundant store when fetched obj version matches the incoming version. Fixes: https://tracker.ceph.com/issues/79311 Signed-off-by: Saravanan Palanisamy <[email protected]>
Add two test-only hold to metadata sync of a single entry. Both can be released by clearing rgw_inject_delay_pattern. delay_meta_sync_bucket_instance_fetch_hold - test a redundant update by delaying the inital fetch until a newer update for the same key is queued. The newer state is then applied, and the queued retry skips the store after version check find its already applied. delay_meta_sync_bucket_instance_hold - hold a fetched entry between fetch and apply, so that a test can have a later updated applied first and stale one lands on top. Tests: https://tracker.ceph.com/issues/79311 Signed-off-by: Saravanan Palanisamy <[email protected]>
1. tests stale metadata applied after concurrent update, such that newer update is applied first. It checks whether newer one persists 2. test queued retry fetching redundant metadata version is not applied again Tests: https://tracker.ceph.com/issues/79311 Signed-off-by: Saravanan Palanisamy <[email protected]>
7342824 to
101396b
Compare
Ceph PR triage — related open PRsQueried #71058 against KB snapshot
This comment is updated in place when the workflow re-runs (hidden HTML marker). Data: read-only GitHub + local git analysis; no labels or merges were changed. |
| @@ -1935,10 +2035,16 @@ class RGWMetaSyncShardCR : public RGWCoroutine { | |||
| continue; | |||
| } | |||
| tn->log(20, SSTR("log_entry: " << log_iter->id << ":" << log_iter->section << ":" << log_iter->name << ":" << log_iter->timestamp)); | |||
| if (!marker_tracker->start(log_iter->id, 0, log_iter->timestamp)) { | |||
| raw_key = log_iter->section + ":" + log_iter->name; | |||
| if (!marker_tracker->index_key_to_marker(raw_key, log_iter->id)) { | |||
There was a problem hiding this comment.
Should this only index COMPLETE entries (mdlog_entry.log_data.status == MDLOG_STATUS_COMPLETE && ...), same as bucket sync does before index_key_to_marker() (rgw_data_sync.cc ~5102)?
Non-COMPLETE entries return before the retry loop, so if a COMPLETE entry for the same key gets skipped while a non-COMPLETE one is in flight, its retry is cleared and the update never gets applied.
Incremental metadata sync spawns one coroutine per mdlog entry. This could cause race condition in two concurrent udpates on multisite sync.
`check_versions()` function is reintroduced (added in 4f9855e and removed in 8c56a23).- Incremental sync applies entries with
- Full sync currently keeps
- It also handles
- the unused
APPLY_UPDATES, soRGWMetadataManager::put()compares the incoming version against the one on disk and returnsSTATUS_NO_APPLYfor entries that are not newer.APPLY_ALWAYSAPPLY_NEWER, used by the admin REST metadata PUTAPPLY_EXCLUSIVEis dropped.Serialize metadata sync for each key within a shard (Similar to data sync commit e08eb9c), allowing one coroutine at a time. When more entries of same keys arrive concurrently, it trigger a retry of the coroutine, which will fetch master's latest update.
If the retry fetches the version already applied, the redudant apply is skipped.
Issue Tracker: https://tracker.ceph.com/issues/79311
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.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.