Repository navigation
Ignore BALANCED/LOCALIZE READS flags for watch/notify/notify_ack and pg ops - #70629
Conversation
JonBailey1993
left a comment
There was a problem hiding this comment.
Just one comment after reviewing
| // that Objecter does not route this to a non-primary replica. | ||
| int flags = extra_op_flags & | ||
| ~(CEPH_OSD_FLAG_BALANCE_READS | CEPH_OSD_FLAG_LOCALIZE_READS); | ||
| objecter->read(oid, oloc, rd, snap_seq, (bufferlist*)NULL, flags, 0, 0); |
There was a problem hiding this comment.
This method calls objecter->read(...), which calls prepare_read_op(...), which calls get_read_flags(flags) passing in these flags.
int get_read_flags(int flags) {
int ret = flags | global_op_flags |
extra_read_flags.load(std::memory_order_relaxed) |
CEPH_OSD_FLAG_READ;
// If the op is rwordered or a PG op, strip out the balanced and localized
// flags since those ops must be handled by the primary OSD.
if (flags & (CEPH_OSD_FLAG_RWORDERED | CEPH_OSD_FLAG_PGOP)) {
ret &= ~(CEPH_OSD_FLAG_BALANCE_READS | CEPH_OSD_FLAG_LOCALIZE_READS);
}
return ret;
}
extra_read_flags is used to store CEPH_OSD_FLAG_BALANCE_READS and CEPH_OSD_FLAG_LOCALIZE_READS when they get set.
I believe currently we can still see balanced notify_ack's and need to find a way to ensure they are not added back by get_read_flags(...).
|
Pushed fixes - add read_primary methods to objecter that always route the read request to the primary OSD by clearing the balanced/localized read flags. Modified notify_ack to use these new methods. Tested with ceph_test_rados from the pool migration branch which has fixes for watch/notify/notify_ack testing and confirmed all these requests were always sent to the primary. |
There was a problem hiding this comment.
Pull request overview
Prevents primary-only RADOS operations from being routed to replica OSDs.
Changes:
- Strips replica-read flags from PG and watch/notify requests.
- Adds primary-only operation classification and OSD-side
EAGAINhandling. - Routes notify acknowledgements through new primary-read helpers.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/osdc/Objecter.h |
Adds primary-read helpers and PG flag filtering. |
src/osdc/Objecter.cc |
Strips replica-read flags from linger operations. |
src/osd/PrimaryLogPG.cc |
Rejects primary-only replica requests. |
src/osd/osd_types.h |
Defines the primary-only internal flag. |
src/osd/osd_op_util.h |
Declares primary-only metadata helpers. |
src/osd/osd_op_util.cc |
Classifies PG and watch/notify operations. |
src/osd/OpRequest.h |
Exposes primary-only classification. |
src/neorados/RADOS.cc |
Routes notify acknowledgements to primaries. |
src/librados/IoCtxImpl.cc |
Routes legacy notify acknowledgements to primaries. |
JonBailey1993
left a comment
There was a problem hiding this comment.
LGTM, one question on if we can simplify/deduplicate the new read_primary functions
24b80af to
e277bbd
Compare
JonBailey1993
left a comment
There was a problem hiding this comment.
Couple tiny nits that can be ignored if you like, but LGTM
The conf setting rados_replica_read_policy can be used to enable balance or localize reads, these flags get added to all client requests. However not all ops work if sent to a non-primary OSD. This commit fixes watch, notify and notify_ack ops so that the client ignores the balance and localize read flag and always sends these to the primary OSD. Updating clients is hard, so update the OSD to police this as well and fail requests with EAGAIN (which will force downlevel client to resubmit to the primary). Fixes: https://tracker.ceph.com/issues/76955 Signed-off-by: Bill Scales <[email protected]> Assisted-by: IBM Bob 2.0.1
The conf setting rados_replica_read_policy can be used to enable balance or localize reads, these flags get added to all client requests. However not all ops work if sent to a non-primary OSD. This commit fixes pg ops such as scrubls and pgnls so that they are always sent to the primary OSD. Updating clients is hard, so update the OSD to police this as well and fail requests with EAGAIN (which will force downlevel client to resubmit to the primary). Fixes: https://tracker.ceph.com/issues/76954 Signed-off-by: Bill Scales <[email protected]> Assisted-by: IBM Bob 2.0.1
The CEPH_OSD_FLAG_PGOP was getting set in various different places as PG ops were constructed. Tidy this up so that the flag is set when pg_read or prepare_pg_read_op are called. This makes it safe to change pg_read to call get_read_flags and ensures PG ops cannot have the balanced or localize read flags set. Signed-off-by: Bill Scales <[email protected]>
e277bbd to
938dbbf
Compare
|
Force push to just fix whitespace issue, not going to delete pg_ls even if it is unused. |
|
This PR has been added to wip-bharath29-testing-20260924.231744-main. |
|
This is an automated message by src/script/redmine-upkeep.py. I have resolved the following tracker ticket due to the merge of this PR: No backports are pending for the ticket. If this is incorrect, please update the tracker |
|
This is an automated message by src/script/redmine-upkeep.py. I have resolved the following tracker ticket due to the merge of this PR: No backports are pending for the ticket. If this is incorrect, please update the tracker |
The conf setting setting rados_replica_read_policy can be used to enable balance or localize reads, these flags get added to all client requests by librados/objecter.
However there are some ops which can only be processed by the primary OSD and do not work correctly if issued to a non-primary.
One subclass of ops which must be sent to the primary are the watch, notify and notify_ack ops. This is because a watch op sets up volatile state in the OSD which is then used by the subsequent notify and notify_ack ops.
A second subclass of ops which must be sent to the primary are the pg ops such as pgnls and scrubls. These pg level ops rely on state that is only maintained on the primary.
The whole rationale for balanced and localized reads is to improve performance, in particular for I/O requests transferring a lot of data. Neither watch/notify/notify_ack or pg ops are issued frequently or have large enough data payloads to be worthwhile optimizing.
The fixes are implemented in two halves:
Either half of the fixes is sufficient, so just upgrading the OSDs will be sufficient to fix the issue
Fixes: https://tracker.ceph.com/issues/76954
Fixes: https://tracker.ceph.com/issues/76955
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.