diff options
| author | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-11 15:07:35 -0300 |
|---|---|---|
| committer | Lucas de Castro Borges <lucas@gnuabordo.com.br> | 2025-02-11 15:07:35 -0300 |
| commit | 4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch) | |
| tree | 1682a647d4463397c119183369ae6f750d5fdcff /src/mongo/shell/replsettest.js | |
| parent | aa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff) | |
| parent | 8f0827553e09872941945a093b647a4211a9db7f (diff) | |
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0'
with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
Diffstat (limited to 'src/mongo/shell/replsettest.js')
| -rw-r--r-- | src/mongo/shell/replsettest.js | 53 |
1 files changed, 9 insertions, 44 deletions
diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js index a22c5142419..827691f822d 100644 --- a/src/mongo/shell/replsettest.js +++ b/src/mongo/shell/replsettest.js @@ -656,9 +656,6 @@ var ReplSetTest = function(opts) { // replica set nodes and return without waiting to connect to any of them. const skipWaitingForAllConnections = (options && options.waitForConnect === false); - // Keep a copy of these options - self.startSetOptions = options; - // Start up without waiting for connections. this.startSetAsync(options, restart); @@ -733,8 +730,8 @@ var ReplSetTest = function(opts) { /** * Blocks until the secondary nodes have completed recovery and their roles are known. Blocks on - * all secondary nodes or just 'secondaries', if specified. Does not wait for all 'newlyAdded' - * fields to be removed by default. + * all secondary nodes or just 'secondaries', if specified. Waits for all 'newlyAdded' fields to + * be removed by default. */ this.awaitSecondaryNodes = function( timeout, secondaries, retryIntervalMS, waitForNewlyAddedRemoval) { @@ -1364,28 +1361,6 @@ var ReplSetTest = function(opts) { cmd[cmdKey] = config; - // If this ReplSet is started using this.startSet and binVersions (ie: - // rst.startSet({binVersion: [...]}) we need to make sure the binVersion combination is - // valid. - if (typeof (this.startSetOptions) === "object" && - this.startSetOptions.hasOwnProperty("binVersion") && - typeof (this.startSetOptions.binVersion) === "object") { - let lastLTSSpecified = false; - let lastContinuousSpecified = false; - this.startSetOptions.binVersion.forEach(function(binVersion, _) { - if (lastLTSSpecified === false) { - lastLTSSpecified = MongoRunner.areBinVersionsTheSame(binVersion, lastLTSFCV); - } - if ((lastContinuousSpecified === false) && (lastLTSFCV !== lastContinuousFCV)) { - lastContinuousSpecified = - MongoRunner.areBinVersionsTheSame(binVersion, lastContinuousFCV); - } - }); - if (lastLTSSpecified && lastContinuousSpecified) { - throw new Error("Can only specify one of 'last-lts' and 'last-continuous' " + - "in binVersion, not both."); - } - } // Initiating a replica set with a single node will use "latest" FCV. This will // cause IncompatibleServerVersion errors if additional "last-lts"/"last-continuous" binary // version nodes are subsequently added to the set, since such nodes cannot set their FCV to @@ -1397,15 +1372,11 @@ var ReplSetTest = function(opts) { Object.keys(this.nodeOptions).forEach(function(key, index) { let val = self.nodeOptions[key]; if (typeof (val) === "object" && val.hasOwnProperty("binVersion")) { - if (lastLTSBinVersionWasSpecifiedForSomeNode === false) { - lastLTSBinVersionWasSpecifiedForSomeNode = - MongoRunner.areBinVersionsTheSame(val.binVersion, lastLTSFCV); - } - if ((lastContinuousBinVersionWasSpecifiedForSomeNode === false) && - (lastLTSFCV !== lastContinuousFCV)) { - lastContinuousBinVersionWasSpecifiedForSomeNode = - MongoRunner.areBinVersionsTheSame(val.binVersion, lastContinuousFCV); - } + lastLTSBinVersionWasSpecifiedForSomeNode = + MongoRunner.areBinVersionsTheSame(val.binVersion, lastLTSFCV); + lastContinuousBinVersionWasSpecifiedForSomeNode = + (lastLTSFCV !== lastContinuousFCV) && + MongoRunner.areBinVersionsTheSame(val.binVersion, lastContinuousFCV); explicitBinVersionWasSpecifiedForSomeNode = true; } }); @@ -1835,19 +1806,13 @@ var ReplSetTest = function(opts) { const timeout = 60 * 1000; this.awaitNodesAgreeOnPrimary(timeout, this.nodes, node); - if (!awaitWritablePrimary) { - return true; - } - // getPrimary() guarantees that there will be only one writable primary for a replica // set. - const newPrimary = this.getPrimary(); - if (newPrimary.host === node.host) { + if (!awaitWritablePrimary || this.getPrimary() === node) { return true; } - jsTest.log(node.host + ' is not primary after stepUp command, ' + newPrimary.host + - ' is the primary'); + jsTest.log(node.host + ' is not primary after stepUp command'); return false; }, "Timed out while waiting for stepUp to succeed on node in port: " + node.port); |
