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

Add isPrimary to ReplSetMetadata and use it for sync source selection

    XMLWordPrintableJSON

Details

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 4.4.0-rc0, 4.7.0
    • None
    • Replication
    • None
    • Fully Compatible
    • v4.4
    • Repl 2020-04-06

    Description

      Consider a secondary Node 0 syncing from a member, Node 1.

      When Node 0 executes TopologyCoordinator::shouldChangeSyncSource, it checks whether Node 1 thinks the primary has changed. Node 0 uses unsafe logic for this purpose: it checks the OplogQueryMetadata.currentPrimaryIndex it received from Node 1, but Node 0 doesn't know if it has the same config as Node 1 or not, so it doesn't know what member currentPrimaryIndex refers to.

      Fortunately, all that Node 0 needs to know when it executes TopologyCoordinator::shouldChangeSyncSource is whether Node 1 itself is the primary. Add an isPrimary field to ReplSetMetadata, and deprecate currentPrimaryIndex.

      Before closing this ticket, open another ticket to remove OplogQueryMetadata.currentPrimaryIndex in the next release.

      (Discovered during the SERVER-46667 investigation.)

      Attachments

        Activity

          People

            jesse@mongodb.com A. Jesse Jiryu Davis
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: