-
Notifications
You must be signed in to change notification settings - Fork 248
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
Inconsistent log #293
Comments
I'm trying to understand the issue:
Am I understanding it correctly? |
|
Ok, the outcome is the same in either way. This is really a great catch, thanks! |
I think we should make |
#294 is already doing that. Note that NuRaft/src/handle_snapshot_sync.cxx Lines 241 to 243 in 4b3e752
so setting a term should not be a part of become_follower .
|
bool raft_server::update_term(ulong term) {
if (term > state_->get_term()) {
{
...
std::lock_guard<std::mutex> ll(cli_lock_);
role_ = srv_role::follower;
state_->set_term(term);
}
|
Sorry I missed |
Case Description
NuRaft commit 0073f55 2021.11.19
To reproduce the issue make short hb interval and election timeout.
About 2022.02.25 12:26 node 13's data are different with 14 and 15. We make a tool checked the log and found that log of 13 were different with the others. The different log is [989286-989299].
Analysis
Near 2022.02.25 12:26 there were 3 leader switches : 13(Term=41, ), 14(Term=42, idx=989286), 13(Term=43,idx=989300), 14 (Term=44,idx =989303).
The following is the server log of 13: When 14 (Term=44, idx=989303) is leader, 13 receives the append log request from 14, and it accepts the request from index 989299.
13 accepted the request of 14, indicating that 13 thinks that the logs of the two are the same with idx=989299. They have same term 42, but have different content.
Let's see the 3 leader switches.
13 reject all append log request of term 42, so 989299's term should be 41, but actually is 42.
Below is 13 writting log 989299
We see 13 updated its term to 42 by
append_entries_response
and it should become follower. And then it use 42 as 989299's term which leading wrong term of log 989299.So
update_term
method should putstate->set_term()
undercli_lick_
.The text was updated successfully, but these errors were encountered: