Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-19738

Restore current term at startup

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 3.1.7
    • None
    • Replication
    • None
    • Fully Compatible
    • ALL
    • RPL 7 08/10/15

    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.

      Attachments

        Activity

          People

            siyuan.zhou@mongodb.com Siyuan Zhou
            siyuan.zhou@mongodb.com Siyuan Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: