-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix a node can't accept more logs after receiving snapshot #3909
Conversation
wal_->lastLogId() < req.get_last_log_id_sent() || | ||
wal_->getLogTerm(req.get_last_log_id_sent()) != req.get_last_log_term_sent()) { | ||
wal_->lastLogId() < req.get_last_log_id_sent()) { | ||
// case 1 and case 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so case 1
is last_log_id < committedLogId_ and case 2
is wal_->lastLogId() < get_last_log_id_sent ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, see the comment above in line 1539
Don't merge plz, test is still on-going |
Ready to go |
What type of PR is this?
What problem(s) does this PR solve?
Issue(s) number:
Description:
See the logs below, logs unrelated has been ignored:
committedLogId_ 14958, committedLogTerm_ 27
,lastLogId_
is 14959 nowlastLogIdSent = 14965
(line 7), we will return LOG_GAP, and ask leader send logs from committedLogId_ (14958)Since out first log id of wal is 14959, we don't have the log of 14958, so the condition below always is true:
wal_->getLogTerm(req.get_last_log_id_sent()) != req.get_last_log_term_sent()
, so we ask leader send logs from committedLogId_(14958) againHow do you solve it?
When we failed to get a log from wal (for example, we pull snapshot), we could use
committedLogId_
andcommittedLogTerm_
to do raft log matching.Special notes for your reviewer, ex. impact of this fix, design document, etc:
Checklist:
Tests:
Affects:
Release notes:
Please confirm whether to be reflected in release notes and how to describe:
Fix a node can't accept more logs after receiving snapshot