Skip to content

feature: validate term value#513

Open
GuyLewin wants to merge 3 commits into
tikv:masterfrom
GuyLewin:feature/check-term-value
Open

feature: validate term value#513
GuyLewin wants to merge 3 commits into
tikv:masterfrom
GuyLewin:feature/check-term-value

Conversation

@GuyLewin

@GuyLewin GuyLewin commented Jul 3, 2023

Copy link
Copy Markdown

Fixes #511

Signed-off-by: GuyLewin <Guy@lewin.co.il>
Signed-off-by: GuyLewin <Guy@lewin.co.il>
Comment thread src/raft.rs Outdated
Signed-off-by: GuyLewin <Guy@lewin.co.il>
@GuyLewin

GuyLewin commented Jul 4, 2023

Copy link
Copy Markdown
Author

@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

BusyJay commented Jul 5, 2023

Copy link
Copy Markdown
Member

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