[SERVER-31671] Cancel running elections if the term changes after writing my last vote Created: 21/Oct/17 Updated: 30/Oct/23 Resolved: 07/Nov/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Replication |
| Affects Version/s: | None |
| Fix Version/s: | 3.4.14, 3.6.0-rc4 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Siyuan Zhou | Assignee: | Siyuan Zhou |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Operating System: | ALL | ||||||||||||
| Backport Requested: |
v3.4
|
||||||||||||
| Sprint: | Repl 2017-11-13 | ||||||||||||
| Participants: | |||||||||||||
| Linked BF Score: | 15 | ||||||||||||
| Description |
|
In the real election, the term of dry run election should be used rather than the term in topology coordinator because the latter can be updated if another node is also running election. It should be the same one we pass into _onVoteRequestComplete(). Alternatively, we can double check the term is the still same before the real election. |
| Comments |
| Comment by Githook User [ 24/Feb/18 ] |
|
Author: {'email': 'siyuan.zhou@mongodb.com', 'name': 'Siyuan Zhou', 'username': 'visualzhou'}Message: (cherry picked from commit c8fbc9a23152d707541a5c03c6af0eedb9a83bf9) |
| Comment by Githook User [ 07/Nov/17 ] |
|
Author: {'name': 'Siyuan Zhou', 'username': 'visualzhou', 'email': 'siyuan.zhou@mongodb.com'}Message: |
| Comment by Siyuan Zhou [ 23/Oct/17 ] |
|
It's more of a bug in my opinion, but not a harmful one according to how we handle term change. The candidate may run the real election in a higher term (the term used by VoteRequestor) but want to become primary in a lower term (the term passed in _onVoteRequestComplete). We have a safe guard in _onVoteRequestComplete to check the term change, which masked this issue. |
| Comment by Andy Schwerin [ 22/Oct/17 ] |
|
This is a performance optimization, based on the assumption that the term change indicates another candidate has arrived, and that said candidate is likely to win? |