Skip to content
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

Raft needs to update last_idx and truncate log after rollback #519

Closed
olgavrou opened this issue Nov 5, 2019 · 1 comment · Fixed by #503
Closed

Raft needs to update last_idx and truncate log after rollback #519

olgavrou opened this issue Nov 5, 2019 · 1 comment · Fixed by #503

Comments

@olgavrou
Copy link
Contributor

olgavrou commented Nov 5, 2019

Original Raft implementation does not have rollbacks. Therefore when there is a change in the leader (primary) there is no need to update last_idx (which tells us the local un-committed index).

This can lead to nodes thinking that they are further ahead than they actually are after an election with last_idx being ahead of commit_idx. The fact that the ledger is not being truncated on rollback makes the newly elected leader able to communicate entries that are, in fact, rolled back.

@achamayou
Copy link
Member

Our current logic will not retransmit these old entries though, the fact that the ledger isn't truncated is theoretical, the old entries will be overwritten, and there's no impact on integrity.

The impact of using the log_idx is that the election selects a ledger on irrelevant grounds, since it will be rolled back to the last commit idx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants