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

Update expectedPrimaryNodeId parameter in awaitNodesAgreeOnPrimary

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.7.0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • ALL
    • Repl 2020-07-13, Repl 2020-07-27
    • 18

      In the function awaitNodesAgreeOnPrimary in replsettest.js, we pass in a parameter expectedPrimaryNodeId. This refers to the node we expect to become primary. However, we use this parameter to index into the list of nodes passed in, and so it is misleading to name this variable as the nodeId when in fact it is the index of the expected primary in the nodes list parameter. Here is an instance in the codebase where we are misusing this parameter. We try to pass in 1 as the expectedPrimaryNodeId, as we expect node1 to become primary (shown in the previous line), but because we index into the passed in nodes list, we set the expected primary to be node 2. 

      A possible solution to this problem would be to change the parameter in awaitNodesAgreeOnPrimary to actually take in a unique nodeId. There are only a few places in the codebase where we use this third parameter, so changing it should cause minimal disruption to existing tests.

            Assignee:
            ali.mir@mongodb.com Ali Mir
            Reporter:
            ali.mir@mongodb.com Ali Mir
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: