diff options
-rw-r--r-- | jstests/multiVersion/libs/multi_rs.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/jstests/multiVersion/libs/multi_rs.js b/jstests/multiVersion/libs/multi_rs.js index c7149599d4b..b817720e72f 100644 --- a/jstests/multiVersion/libs/multi_rs.js +++ b/jstests/multiVersion/libs/multi_rs.js @@ -14,8 +14,12 @@ ReplSetTest.prototype.upgradeSet = function(options, user, pwd) { this.upgradeSecondaries(primary, options, user, pwd); // Then upgrade the primary after stepping down. - this.upgradePrimary(primary, options, user, pwd); - + if (this.getPrimary() == primary) { + this.upgradePrimary(primary, Object.assign({}, options), user, pwd); + } else { + // An election occured during upgrade, old primary is now a secondary. + this.upgradeMembers([primary], Object.assign({}, options), user, pwd); + } }; ReplSetTest.prototype.upgradeSecondaries = function(primary, options, user, pwd) { |