diff options
author | Sara Golemon <sara.golemon@mongodb.com> | 2021-05-26 20:46:27 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-06-22 17:00:15 +0000 |
commit | d56295623aa2999b3919a3af3ddd6341560af513 (patch) | |
tree | af5178f71c7549baa36dc9d8d7d37de4cb3351a4 | |
parent | c6b2b1d14a7b52f16e048068d85180bdb5da142e (diff) | |
download | mongo-d56295623aa2999b3919a3af3ddd6341560af513.tar.gz |
SERVER-57328 Make ReplSetTest.upgradeSet() tolerant of reelections
(cherry picked from commit 5ef956df508b16cbc15cd4360f74cdea0cab34d3)
-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) { |