Repository navigation
rados: Add API to disable version querying with reads in librados - #66162
Conversation
|
I will tidy this up and address the relevant parts of the co-pilot review if you think this is a decide idea in principle. While only required initially for the EC direct reads testing, I think this sounds like a good addition overall to librados. |
I think this is fine. This is a performance improvement for clients that do not need to know the version from a read. It is not intended to be switched on/off in a multithreaded environment (indeed, even with an atomic, this would not work correctly). A client which needs such fine-grained multi-threaded control should either put up with the performance impact that leaving versions on has, or switch to using NEORADOS which implements such an API properly. |
|
I'll take a look at this on Monday. |
|
My understanding of the rados_get_last_version API is that it is primarily intended to be used in conjunction with the rados_write_op_assert_version API to implement an atomic read-modify-write. There is also rados_read_op_assert_version and possibly rados_watch (although the docs suggest version doesn't work on watch). I'd expect there to be two classes of rados application - ones that don't do any atomic updates which don't need the version number and one that do occasional atomic updates which therefore occasionally need the version number. Your API change caters for the first type of application (although they need to know to opt in to get the benefit), it only helps the 2nd type of application if it wants to repeatedly adjusts the setting. TBH I don't see any application using this API and modern code is hopefully more likely to use neorados which provides more control over when to get the version and deals with all the multi-threading/concurrency issues that the rados_get_last_version API has. So perhaps the question becomes is it an appropriate change to the API to facilitate testing and should the change just be made to C/C++ version of librados or does it need to be implemented in the wrappers (e.g. python) as well? |
|
This seems like a reasonable change to the api. At present, it doesn't actually impact the MOSDOpReply you get back from the OSD. Presumably, the plan is to include a primary user_version query if the user wants a user_version, so the user needs to be able to signal whether they want it. Seems reasonable to me. Looks like in neorados, you pass nullptr to execute. If we wanted a non-ioctx switch, I suppose a param to operate/aio_operate would be the analogue. Setting it on the ioctx is convenient to implement and use in tests, I think it's fine for now. We can add it elsewhere if someone wants it. |
|
ceph test api |
|
jenkins test api |
|
jenkins test windows |
| @@ -683,6 +683,21 @@ int librados::IoCtxImpl::operate(const object_t& oid, ::ObjectOperation *o, | |||
| return r; | |||
| } | |||
|
|
|||
| version_t *librados::IoCtxImpl::get_objver_for_read(version_t *objver_p) { | |||
There was a problem hiding this comment.
I am not sure I understand the nature of the returned value: sometimes it's a pointer, and sometimes that pointer is assigned to. Can you add a comment to the .h explaining both the parameter and the returned value?
There was a problem hiding this comment.
Will do. Although note that this is supposed to be private. Which I will update soon.
The intent is:
- If the version is wanted, then we return the pointer that is passed to the function.
- If the version is not wanted, we intentionally invalidate it and pass back a null pointer to indicate that the op should not request a version.
|
ok for rgw as long as read versions are enabled by default. last year in #59998 i summarized where rgw depends on version_t, and that does include some read operations |
Thankyou. That is a really useful summary. I don't think we want to turn off the user version in RGW as partial reads which hit the non-primary shard are going to be fairly rare. The optimisation in split ops is mainly aimed at RBD, where a very high proportion of ops will be submitted to the the non-primary OSDs |
a8d477d to
e2f3c4d
Compare
|
jenkins test windows |
|
jenkins test windows |
librados will always request a "user version". Until EC direct reads are implemented this is a cheap operation and so librados always requests the user version, even if the client does not need it. With EC direct reads, requesting the user version requires an extra op to the primary in some scenarios. The non-primary OSDs do not contain an up to date user version. NEORADOS already allows for such optimisations, due to a how the API is organised. librados is not heavily used by ceph-maintained clients, but this API will still be useful for testing of EC direct reads, since the test clients will use librados, due to it simpler nature and performance not being critical in the tests. Signed-off-by: Alex Ainscow <[email protected]>
|
@aainscow I see a related failure in teuthology here: Teuthology Run and QA Tracker:
Test Logs: Relevant Log Snippet: |
Thankyou for running this. This is a failed unit test only and I have already fixed it, as it is also tested as part of windows tests (surprisingly). Can we run this one test again as the fix is test harness only? |
@SrinivasaBharath Can you please include this PR in another batch and test again? |
|
@aainscow pls merge when it's approved |
| uint64_t assert_ver = 0; | ||
| version_t last_objver = 0; | ||
| uint32_t notify_timeout = 30; | ||
| bool no_version_on_read = false; |
|
|
||
| void set_no_version_on_read(bool _val); | ||
| private: | ||
| version_t *get_objver_for_read(version_t *objver_p) const; |
|
|
||
| version_t *librados::IoCtxImpl::get_objver_for_read(version_t *objver_p) const { | ||
| if (!no_version_on_read) { | ||
| return objver_p; |
There was a problem hiding this comment.
ACK. Pass-through by defualt.
| ASSERT_EQ(0, memcmp(bl.c_str(), "ceph", 4)); | ||
|
|
||
| // last version should now have been corrected. | ||
| ASSERT_EQ(version, ioctx.get_last_version()); |
| } | ||
|
|
||
| if (objver_p) { | ||
| *objver_p = std::numeric_limits<version_t>::max(); |
There was a problem hiding this comment.
Modifying the AioCompletionImpl::objver here is a bit surprising but overall saves tons of repetition. Fine.
librados will always request a "user version". Until EC direct reads are implemented this is a cheap operation and so librados always requests the user version, even if the client does not need it.
With EC direct reads, requesting the user version requires an extra op to the primary in some scenarios. The non-primary OSDs do not contain an up to date user version.
NEORADOS already allows for such optimisations, due to a how the API is organised.
librados is not heavily used by ceph-maintained clients, but this API will still be useful for testing of EC direct reads, since the test clients will use librados, due to it simpler nature and performance not being critical in the tests.
I am making this change in its own PR as it changes the externally visible API. Please review carefully!
I have only added to the _cxx API so far, as the _c API is not needed for direct reads testing. I can add if deemed appropriate.
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.