v0.9.19
Summary:
- Improved:
- 9bfd517f tolerate leader state reversion upon restart.
Detail:
Improved:
-
Improved: 9bfd517f tolerate leader state reversion upon restart; by Zhang Yanpo; 2025-06-10
When a leader restarted and its log reverted, and tried to re-elect
itself as leader:And when vote request is rejected and see a greater vote,
it should only update to the non-committed version of the responded vote
to its local state:This prevents a dangerous scenario when state reversion is allowed:
- A node was a leader but its state reverted to a previous version;
- The node restarts and begins election;
- It receives a vote response containing its own previous leader vote;
- Without this protection, it would update to that committed vote and
become leader again; - However, it lacks the necessary logs, causing committed entries to be
lost or inconsistent;
By using the non-committed version, we prevent this reverted node from
becoming leader while still allowing proper vote updates for legitimate
cases.