[SERVER-28487] upgradePrimary should call awaitNodesAgreeOnPrimary() before it gets the primary Created: 24/Mar/17  Updated: 06/Dec/17  Resolved: 04/May/17

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

Type: Bug Priority: Major - P3
Reporter: Judah Schvimer Assignee: Spencer Brody (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Repl 2017-05-08
Participants:
Linked BF Score: 0

 Description   

getPrimary() gets the primary, but does not wait for the primary to be "stable". If two nodes decide to run for primary around the same time, they could both win in quick succession, and the first getPrimary() could return the first winner and the second getPrimary() could return the second winner. awaitNodesAgreeOnPrimary() is designed for precisely this situation, waiting for the nodes to agree on a primary to avoid this race.

    let oldPrimary = this.stepdown(primary);
    primary = this.getPrimary();
 
    this.upgradeNode(oldPrimary, options, user, pwd);
 
    let newPrimary = this.getPrimary();
 
    if (noDowntimePossible)
        assert.eq(newPrimary, primary);



 Comments   
Comment by Githook User [ 04/May/17 ]

Author:

{u'username': u'stbrody', u'name': u'Spencer T Brody', u'email': u'spencer@mongodb.com'}

Message: SERVER-28487 call awaitNodesAgreeOnPrimary in upgradePrimary helper in multi_rs.js
Branch: master
https://github.com/mongodb/mongo/commit/765d5393f604dafccec883e2e36e734d7719557c

Generated at Thu Feb 08 04:18:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.