-
Notifications
You must be signed in to change notification settings - Fork 157
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
Add an API that blocks until logs replay is done if save_committed()
is implemented
#1249
Comments
👋 Thanks for opening this issue! Get help or engage by:
|
|
We did it by simply awaiting until the node becomes the leader in a separate task and then await until applied index reaches the committed index (via the watch on Raft state). Only then it's clear that the (leader's) log is replayed and we can serve further requests. This is basically the same that @SteveLauC describes above. Is there something wrong with this approach? Also, if the restarted node became a follower, then no one really cares how far the apply went, since it can't really serve requests anyway. And, if the leader dies and the follower becomes leader, again, the leader awaiting task on the former follower now leader will get notified and the process repeats on the follower. But, we don't need to wait until |
This approach aligns with my suggestion. Currently, only the caller of |
Thanks for the replys, also thanks for the code link so that I can dig it further, close as the feature is not needed. |
Is your feature request related to a problem? Please describe.
Hi, I would like to know is there any API that can be used to wait for a node to replay its logs upon restart. This is something a user can implement with
committed_id
(RaftState.committed
) andapplied_id
(RaftStateMachine.applied
), but maybe we can add it if it is a common request (Well, it does not seem to be as searching for "replay log" gives me nothing😁)Describe the solution you'd like
We can:
Describe alternatives you've considered
I have noticed the
Raft::ensure_linearizable()
method, which does something similar under the hood, but considering that it invokesRaft::get_read_log_id()
, looks like it is only suitable for the leader node.Additional context
No
The text was updated successfully, but these errors were encountered: