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

feature: validate term value #513

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

GuyLewin
Copy link

@GuyLewin GuyLewin commented Jul 3, 2023

Fixes #511

Signed-off-by: GuyLewin <[email protected]>
src/raft.rs Outdated Show resolved Hide resolved
Signed-off-by: GuyLewin <[email protected]>
@GuyLewin
Copy link
Author

GuyLewin commented Jul 4, 2023

@BusyJay do you agree with my change in src/storage.rs?:

raft-rs/src/storage.rs

Lines 422 to 423 in b0a3740

// Initialize term with a valid value (anything except 0)
core.raft_state.hard_state.term = 1;
?

If so - it breaks a lot of tests but I can go over them and fix them. I just don't want to do it if it's the incorrect fix since it'll require some manual work.

@BusyJay
Copy link
Member

BusyJay commented Jul 5, 2023

MemStorage is supposed to be used for tests, change it or not are OK to me.

@tisonkun tisonkun self-requested a review July 5, 2023 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Initialization with term=0 shouldn't be allowed
2 participants