Repository navigation
osd: Support for Synchronous Reads in EC - #67079
Conversation
aainscow
left a comment
There was a problem hiding this comment.
Looks good.
I think the state_guard code is probably unnecessary. Have you found code paths which cause any of:
- read_async to complete synchronously.
- on_change calls the finisher callback.
?
The code looks like it has been written to cope with these scenarios, which suggests you hit them in testing?
06e5c33 to
9433d58
Compare
| if (active_coro_op) { | ||
| requeue_op(active_coro_op); | ||
| active_coro_op = nullptr; | ||
| } |
There was a problem hiding this comment.
The ordering of the requeues looks a bit suspect, but I think its ok:
- Its only possible for there to be a ops on waiting_for_coro_op if there is an active_coro_op which is suspended (inside EC waiting for an async read to complete). In particular this means the op being processed by the coroutine has not managed to get added to waiting_for_readable, or any of the other lists considered by the code below. These ops need to be requeued before the active_coro_op so they are retried later.
- For the I/O to have got this far it means there can't be anything on the waiting_for_readable list, so ordering versus this list doesn't matter
- Waiting for peered, flush, active all happen before do_op so this ordering is correct.
|
jenkins test api |
3 similar comments
|
jenkins test api |
|
jenkins test api |
|
jenkins test api |
9433d58 to
9f02ad1
Compare
|
jenkins test make check |
4 similar comments
|
jenkins test make check |
|
jenkins test make check |
|
jenkins test make check |
|
jenkins test make check |
9f02ad1 to
51c53c1
Compare
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
51c53c1 to
208b387
Compare
e5b3e43 to
d8230dd
Compare
bill-scales
left a comment
There was a problem hiding this comment.
Happy with the changes, but I think the change in PrimaryLogPG::get_rw_locks deserves its own commit with more explanation about the scenario it is fixing and justification as to why it will still be very unusual to take a RWEXCL lock.
| return result; | ||
| } | ||
|
|
||
| int ECBackend::objects_read_local( |
There was a problem hiding this comment.
ACK: You are introducing a new objects_read_sync method that can be used by a stackfull coroutine and will issue an async read and block until it completes.
The old objects_read_async method has been renamed to objects_read_local (it takes different arguments so you would get compile errors if you failed to update one of the references)
| dout(20) << __func__ << ": op " << *m << dendl; | ||
| for (const auto& osd_op : m->ops) { | ||
| if (osd_op.op.op == CEPH_OSD_OP_CALL) { | ||
| return true; |
There was a problem hiding this comment.
ACK: Only FastEC pools that receive Ops with a OP_CALL Class call will use a coroutine
| if (coro_op_in_flight) { | ||
| dout(20) << __func__ << ": coroutine op in flight, queuing " << op << dendl; | ||
| waiting_for_coro_op.push_back(op); | ||
| return; |
There was a problem hiding this comment.
ACK - This only happens when an co-routine handling a CALL OP issues an asynchronous read and blocks waiting for the read to complete. The PG lock is released so it is possible for new Ops to be scheduled, these will get queued here. The SubOpReadReply/SubOpWriteReply messages are processed (these don't get as far as do_op so aren't blocked) which allows the async read to complete and the co-routine will be resumed. When the co-routine finishes this queue is kicked.
d8230dd to
1ad7dd2
Compare
All writes in EC are asynchronous (even if they are only updating metadata), so Cls reads in EC must use the RWEXCL lock to eliminate the possibility of race conditions. This resolves failures with Cls queue tests on EC pools where read operations were observed overtaking in-flight writes. Fixes: https://tracker.ceph.com/issues/74531 Signed-off-by: Matty Williams <[email protected]>
…ng any threads Coroutines.h file added containing type and struct definitions. Coroutine spawned in PrimaryLogPG::do_op if the message contains a CEPH_OSD_OP_CALL op. ECBackend::objects_read_sync yields while running ECBackend::objects_read_async. Coroutine is resumed once the read is complete. When a coroutine op is being processed, all other ops to the same PG are blocked. Fixes: https://tracker.ceph.com/issues/74531 Signed-off-by: Matty Williams <[email protected]>
1ad7dd2 to
52f862c
Compare
aainscow
left a comment
There was a problem hiding this comment.
I don't have any comments beyond those which Bill had.
| if (m->finish_decode()) { | ||
| op->reset_desc(); // for TrackedOp | ||
| m->clear_payload(); | ||
| if (!pool.info.allows_ecoptimizations()) { |
There was a problem hiding this comment.
Supported only for the new, FastEC code paths. OK!
| dout(20) << __func__ << ": op " << *m << dendl; | ||
| for (const auto& osd_op : m->ops) { | ||
| if (osd_op.op.op == CEPH_OSD_OP_CALL) { | ||
| return true; |
There was a problem hiding this comment.
... and only executing for a ceph class' method – as it should. OK.
| @@ -376,6 +376,8 @@ enum { | |||
| CEPH_OSD_RMW_FLAG_RETURNVEC = (1 << 11), | |||
| CEPH_OSD_RMW_FLAG_READ_DATA = (1 << 12), | |||
| CEPH_OSD_RMW_FLAG_EC_DIRECT_READ = (1 << 13), | |||
| CEPH_OSD_RMW_FLAG_EC_SYNC_READ = (1 << 14), | |||
There was a problem hiding this comment.
nit: first use of this flag is in the next commit.
| // Callback for the async read | ||
| Context *on_finish = new LambdaContext([&, coro](int r) { | ||
| result = r; | ||
| done = true; | ||
|
|
||
| if (waiting) { | ||
| coro.resume(); | ||
| } | ||
| }); | ||
|
|
||
| objects_read_async(hoid, object_size, to_read, on_finish, true); | ||
|
|
||
| // If the async read is not yet complete, yield and wait for it to complete | ||
| if (!done) { | ||
| waiting = true; | ||
| coro.yield(); | ||
| } |
There was a problem hiding this comment.
Conceptually we're either executing a request immediately (if none is being executed at the time) or chaining.
| it != in_progress_async_reads.end(); ++it) { | ||
| if (it->second == active_coro_ctx) { | ||
| in_progress_async_reads.erase(it); | ||
| break; |
There was a problem hiding this comment.
This break means you we aren't referencing it (for it++) after it has been erase()d. OK.
|
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 test was talking about testing invalid ops, however with the inclusion of sync reads in EC (ceph#67079), it is valid to perform class reads in EC. In addition, work was done around illegal ops here: ceph#66258 and the existance of TEST(ClsHello, BadMethods) in test_cls_hello.cc covers illegal ops in that PR leading me to think this is unneccisairy. Because of these reasons, I think its better this test is removed as it is incorrect and also not working. Signed-off-by: Jon Bailey <[email protected]>
|
@MattyWilliams22 FYI somehow the API check didn't catch this compile-time error: https://tracker.ceph.com/issues/77618 Can you see if it's related to this PR? |
This test was talking about testing invalid ops, however with the inclusion of sync reads in EC (#67079), it is valid to perform class reads in EC. In addition, work was done around illegal ops here: #66258 and the existance of TEST(ClsHello, BadMethods) in test_cls_hello.cc covers illegal ops in that PR leading me to think this is unneccisairy. Because of these reasons, I think its better this test is removed as it is incorrect and also not working. Signed-off-by: Jon Bailey <[email protected]> (cherry picked from commit b05cfd1)
This test was talking about testing invalid ops, however with the inclusion of sync reads in EC (ceph#67079), it is valid to perform class reads in EC. In addition, work was done around illegal ops here: ceph#66258 and the existance of TEST(ClsHello, BadMethods) in test_cls_hello.cc covers illegal ops in that PR leading me to think this is unneccisairy. Because of these reasons, I think its better this test is removed as it is incorrect and also not working. Signed-off-by: Jon Bailey <[email protected]>
Use boost pull-type coroutines to perform synchronous reads in EC without blocking any threads. This functionality enables the use of class (cls) methods in EC pools.
https://tracker.ceph.com/issues/74531
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.