-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Async POC #6317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Async POC #6317
Conversation
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
src/server/string_family.cc
Outdated
| boost::intrusive_ptr<Transaction> keepalive{cmnd_cntx->tx}; | ||
| auto replier = [mget_results, mget_resp, cmnd_cntx, keepalive](SinkReplyBuilder* builder) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issues:
- Use a move-only functor so we can use unique_ptr
- Automatically implement a keepalive mechanism for the transaction
| return (prev_state & ASYNC_REPLY_DONE) != 0; | ||
| } | ||
| bool IsReady() const; // If deferred is ready | ||
| bool OnCompletion(util::fb2::detail::Waiter* waiter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does it return?
|
|
||
| // Update head state and subscribe to updates if its not ready | ||
| if (parsed_head_ && parsed_head_ != parsed_to_execute_ && !head_ready) | ||
| head_ready |= parsed_head_->OnCompletion(&head_waiter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write explanation here what exactly we do here. It's gentle, so I prefer we have comments than going through low-level code to understand
| task.blocker->OnCompletion(waiter); | ||
| return false; | ||
| }}; | ||
| return visit(ov, reply_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how the access to reply_ is synchronized between threads?
before, with state_ one a single thread could access reply_payload.
now I see OnCompletion is called from the io thread but you also write into reply_ from the shard thread
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I never write into reply from the shard thread, its either assigned to the return value of the handler or set to the callback that will reply
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will need to see SET command I guess - how it propagates the Stored reply from the shard thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it won't propagate from the shard thread, it will work via a replier
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
Related to #6314