[SERVER-19738] Restore current term at startup Created: 03/Aug/15  Updated: 25/Jan/17  Resolved: 06/Aug/15

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 3.1.7

Type: Bug Priority: Major - P3
Reporter: Siyuan Zhou Assignee: Siyuan Zhou
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-19704 Store the current term in persistent ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: RPL 7 08/10/15
Participants:

 Description   

When one-node replica sets go right to state Primary, it wasn't choosing the correct startup term. We can restore the startup term from the last entry in oplog and the last vote document, whichever is greater.

The term in the last oplog entry guarantees that the terms in oplog never go backwards. The last vote's term guarantees that a stale primary won't commit an operation on the majority once a new primary wins an election, even if some nodes (including voters of the new primary) restart at the meantime. Terms on the minority secondaries that didn't participate the last vote may go backwards for a short time after a restart, but it should be harmless.

Curren term should always be greater than or equal to the term of its last vote.



 Comments   
Comment by Githook User [ 06/Aug/15 ]

Author:

{u'username': u'visualzhou', u'name': u'Siyuan Zhou', u'email': u'siyuan.zhou@mongodb.com'}

Message: SERVER-19738 Restore current term at startup
Branch: master
https://github.com/mongodb/mongo/commit/2432b512eff8bfdcd5d678d61d7775686ee4b523

Generated at Thu Feb 08 03:51:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.