nebula
nebula copied to clipboard
fix. raft follower will rollback itself when it misses a certain log
What type of PR is this?
- [x] bug
- [ ] feature
- [ ] enhancement
What problem(s) does this PR solve?
Issue(s) number:
Description:
if a leader fails to update its last_log_id_sent (maybe caused be
follower fail or network issue), it will then try to send some
duplicated logs in the next appendLog request.
```
commitId_: 99
|
v
local wal: |-------------------|
req.append_entries: |----------------|
```
in this case, follower will do rollback even if the logs are the same.
How do you solve it?
add a bool variable to track if the log is inconsistent and only do rollback if the log has a conflict.
Special notes for your reviewer, ex. impact of this fix, design document, etc:
with this fix, followers will not do unnecessary rollback in network issues.
raft rollback is not a lightweight operation, especially if we have a large number of parts, which may may lead to cascade problems.
Checklist:
Tests:
- [ ] Unit test(positive and negative cases)
- [ ] Function test
- [ ] Performance test
- [x] N/A
Affects:
- [ ] Documentation affected (Please add the label if documentation needs to be modified.)
- [ ] Incompatibility (If it breaks the compatibility, please describe it and add the label.)
- [ ] If it's needed to cherry-pick (If cherry-pick to some branches is required, please label the destination version(s).)
- [ ] Performance impacted: Consumes more CPU/Memory
Release notes:
Please confirm whether to be reflected in release notes and how to describe:
ex. Fixed the bug .....
Sorry that we are not working on this repo for a long time... Good job~
The CI workflow doesn't seem to work. Actually, I've some other PRs also failed in the build check. Will this be fixed or this repo will no longer be maintained. If so, let's just leave it here so that others can find a solution to this problem.