-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Notify caller when apply has finished #4424
Conversation
Signed-off-by: zhangjinpeng1987 <zhangjinpeng@pingcap.com>
cb_ctx: CbContext, | ||
snapshot: EngineResult<E::Snap>, | ||
task: Task, | ||
storage_cb: Arc<Mutex<Option<StorageCb>>>, |
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.
em, seem we can use crossbeam AtomicOption
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.
Good, i will have a try.
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.
crossbeam 0.5 abandoned AtomicOption.
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.
oh, bad news, AtomicOptino looks better...
@brson do you have any other suggestion?
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.
You could use AtomicCell<Option<T>>
in place of AtomicOption<T>
(see crossbeam-rs/crossbeam#186)
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.
AtomicCell looks like the right choice. I'd also assert that AtomicCell::is_lock_free, to make sure that Option<StorageCb>
stays under a word long.
I think we will remove the single thread scheduler later, maybe you can let @hicqu benchmark in his PR. |
Signed-off-by: zhangjinpeng1987 zhangjinpeng@pingcap.com
What have you changed? (mandatory)
Previous behavior for prewrite/commit request:
This branch change step 5, raftstore notify the caller and send a message to scheduler after modifications has been applied. So the latency for prewrite/commit can be reduced.
What are the type of the changes? (mandatory)
The currently defined types are listed below, please pick one of the types for this PR by removing the others:
How has this PR been tested? (mandatory)
Unit tests
Does this PR affect documentation (docs) update? (mandatory)
No
Does this PR affect tidb-ansible update? (mandatory)
No
As showed above: