-
Notifications
You must be signed in to change notification settings - Fork 83
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
Taking snapshot and committing log are not atomic operations for each other #300
Comments
I've noticed the Also, I am handwaving that |
Snapshot requires the latest state of the state machine and the commit index, if taking the snapshot in a separated thread, although
RAFT.snapshot()
is synchronized butRAFT.commitLogTo(long, boolean)
is not, if snapshot has the latest state but commit index is not updated, then wrong commit index will be saved in log as the first appended, and duplicated logs will be applied when state machine initial from the snapshot.I think making
RAFT.commitLogTo(long, boolean)
synchronized could solve the problem and don't need to make the methods of state machine to be thread safe.The text was updated successfully, but these errors were encountered: