[SERVER-31672] Cancel election if the last vote has a higher term than mine Created: 21/Oct/17 Updated: 27/Oct/23 Resolved: 24/Oct/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Replication |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Siyuan Zhou | Assignee: | Backlog - Replication Team |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Replication
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Linked BF Score: | 15 | ||||||||
| Description |
|
If the term of last vote on the disk is higher than the vote the candidate is about to write, the candidate should cancel the election, not continue silently. |
| Comments |
| Comment by Siyuan Zhou [ 24/Oct/17 ] |
|
Correctness (only vote once in a term) is guaranteed by updating the term while holding the repl mutex. Only if the term in election is higher than the voter's current one, the voter votes "yes". This is true for both voting for the node itself or another node. As a result, we may allow writing last vote with lower term to succeed as if the write happened before the current last vote. |