Revert "SERVER-85851 Modify sharding test to add --upgradeBackCompat when necessary in mixed version clusters (#18460)"

This reverts commit eb787f9d1153b32deeefbf638969e0bc0530bb5d.

GitOrigin-RevId: 546a75a82c7a8119678617d19e9a24851338c8ac
This commit is contained in:
auto-revert-processor 2024-01-30 06:16:09 +00:00 committed by MongoDB Bot
parent 7cca036eb5
commit d8515d576f
3 changed files with 18 additions and 50 deletions

View File

@ -626,7 +626,7 @@ var ReplSetTest = function ReplSetTest(opts) {
*
* @param options - The options passed to {@link MongoRunner.runMongod}
*/
ReplSetTest.prototype.startSet = function(options, restart, isMixedVersionCluster) {
ReplSetTest.prototype.startSet = function(options, restart) {
// If the caller has explicitly specified 'waitForConnect:false', then we will start up all
// replica set nodes and return without waiting to connect to any of them.
const skipWaitingForAllConnections = (options && options.waitForConnect === false);
@ -635,7 +635,7 @@ var ReplSetTest = function ReplSetTest(opts) {
this.startSetOptions = options;
// Start up without waiting for connections.
this.startSetAsync(options, restart, isMixedVersionCluster);
this.startSetAsync(options, restart);
// Avoid waiting for connections to each node.
if (skipWaitingForAllConnections) {
@ -653,7 +653,7 @@ var ReplSetTest = function ReplSetTest(opts) {
*
* @param options - The options passed to {@link MongoRunner.runMongod}
*/
ReplSetTest.prototype.startSetAsync = function(options, restart, isMixedVersionCluster) {
ReplSetTest.prototype.startSetAsync = function(options, restart) {
print("ReplSetTest starting set '" + this.name + "'");
this.startSetStartTime = new Date(); // Measure the execution time of node startup.
@ -689,7 +689,7 @@ var ReplSetTest = function ReplSetTest(opts) {
options.waitForConnect = true;
}
this.start(n, options, restart, false, isMixedVersionCluster);
this.start(n, options, restart);
}
return this.nodes;
};
@ -3191,12 +3191,9 @@ var ReplSetTest = function ReplSetTest(opts) {
* before the server starts. Default: false.
* @param {boolean} [waitForHealth] If true, wait for the health indicator of the replica set
* node after waiting for a connection. Default: false.
* @param {boolean} [isMixedVersionCluster] If true, it tells mongorunner that this node is part
* of a mixed version cluster, and will add --upgradeBackCompat when appropriate.
* Default: false.
*/
ReplSetTest.prototype.start = _nodeParamToSingleNode(_nodeParamToId(function(
n, options, restart, waitForHealth, isMixedVersionCluster) {
n, options, restart, waitForHealth) {
print("ReplSetTest n is : " + n);
var defaults = {
@ -3268,17 +3265,10 @@ var ReplSetTest = function ReplSetTest(opts) {
// Our documented upgrade/downgrade paths for a sharded cluster lets us assume that
// config server nodes will always be fully upgraded before the shard nodes.
options.binVersion = "latest";
options.upgradeBackCompat = '';
} else {
if (Random.rand() < 0.5) {
options.binVersion = "latest";
options.upgradeBackCompat = '';
} else {
options.binVersion = jsTest.options().useRandomBinVersionsWithinReplicaSet;
options.removeOptions = (options.removeOptions ? options.removeOptions : [])
.concat("upgradeBackCompat");
delete options.upgradeBackCompat;
}
const rand = Random.rand();
options.binVersion =
rand < 0.5 ? "latest" : jsTest.options().useRandomBinVersionsWithinReplicaSet;
}
print("Randomly assigned binary version: " + options.binVersion + " to node: " + n);
}
@ -3373,7 +3363,7 @@ var ReplSetTest = function ReplSetTest(opts) {
// Never wait for a connection inside runMongod. We will do so below if needed.
options.waitForConnect = false;
var conn = MongoRunner.runMongod(options, isMixedVersionCluster === true);
var conn = MongoRunner.runMongod(options);
if (!conn) {
throw new Error("Failed to start node " + n);
}

View File

@ -1022,7 +1022,7 @@ MongoRunner.runningChildPids = function() {
*
* @see MongoRunner.arrOptions
*/
MongoRunner.runMongod = function(opts, isMixedVersionCluster = false) {
MongoRunner.runMongod = function(opts) {
opts = opts || {};
var env = undefined;
var useHostName = true;
@ -1034,11 +1034,6 @@ MongoRunner.runMongod = function(opts, isMixedVersionCluster = false) {
opts = MongoRunner.mongodOptions(opts);
fullOptions = opts;
if (isMixedVersionCluster &&
(!opts.binVersion || opts.binVersion == '' || opts.binVersion == shellVersion())) {
opts.upgradeBackCompat = '';
}
if (opts.useHostName != undefined) {
useHostName = opts.useHostName;
} else if (opts.useHostname != undefined) {
@ -1092,7 +1087,7 @@ MongoRunner.runMongod = function(opts, isMixedVersionCluster = false) {
return mongod;
};
MongoRunner.runMongos = function(opts, isMixedVersionCluster = false) {
MongoRunner.runMongos = function(opts) {
opts = opts || {};
var env = undefined;
@ -1109,10 +1104,6 @@ MongoRunner.runMongos = function(opts, isMixedVersionCluster = false) {
runId = opts.runId;
waitForConnect = opts.waitForConnect;
env = opts.env;
if (isMixedVersionCluster &&
(!opts.binVersion || opts.binVersion == '' || opts.binVersion == shellVersion())) {
opts.upgradeBackCompat = '';
}
opts = MongoRunner.arrOptions("mongos", opts);
}

View File

@ -1067,21 +1067,13 @@ var ShardingTest = function ShardingTest(params) {
// Must check shardMixedBinVersion because it causes shardOptions.binVersion to be an
// object (versionIterator) rather than a version string. Must check mongosBinVersion,
// as well, because it does not update mongosOptions.binVersion. Also check
// useRandomBinVersionsWithinReplicaSet, as it may cause some nodes within a replica set
// to be downgraded.
// as well, because it does not update mongosOptions.binVersion.
const isMixedVersionShard = jsTestOptions().shardMixedBinVersions &&
MongoRunner.areBinVersionsTheSame(binVersion,
jsTestOptions().shardMixedBinVersions);
const isMixedVersionMongos = jsTestOptions().mongosBinVersion &&
MongoRunner.areBinVersionsTheSame(binVersion, jsTestOptions().mongosBinVersion);
const isMixedVersionReplicaSet = jsTestOptions().useRandomBinVersionsWithinReplicaSet &&
MongoRunner.areBinVersionsTheSame(
binVersion, jsTestOptions().useRandomBinVersionsWithinReplicaSet);
if (isMixedVersionShard || isMixedVersionMongos || isMixedVersionReplicaSet) {
if (isMixedVersionShard || isMixedVersionMongos) {
return true;
}
@ -1362,8 +1354,6 @@ var ShardingTest = function ShardingTest(params) {
}
try {
const clusterVersionInfo = this.getClusterVersionInfo();
//
// Start each shard replica set.
//
@ -1473,12 +1463,8 @@ var ShardingTest = function ShardingTest(params) {
// Start up the replica set but don't wait for it to complete. This allows the startup
// of each shard to proceed in parallel.
this._rs[i] = {
setName: setName,
test: rs,
nodes: rs.startSetAsync(rsDefaults, false, clusterVersionInfo.isMixedVersion),
url: rs.getURL()
};
this._rs[i] =
{setName: setName, test: rs, nodes: rs.startSetAsync(rsDefaults), url: rs.getURL()};
}
if (isConfigShardMode) {
@ -1526,7 +1512,7 @@ var ShardingTest = function ShardingTest(params) {
// Start the config server's replica set without waiting for it to complete. This allows
// it to proceed in parallel with the startup of each shard.
this.configRS = new ReplSetTest(rstOptions);
this.configRS.startSetAsync(startOptions, false, clusterVersionInfo.isMixedVersion);
this.configRS.startSetAsync(startOptions);
}
//
@ -1747,6 +1733,7 @@ var ShardingTest = function ShardingTest(params) {
}
const configRS = this.configRS;
const clusterVersionInfo = this.getClusterVersionInfo();
if (_hasNewFeatureCompatibilityVersion() && clusterVersionInfo.isMixedVersion) {
const fcv = binVersionToFCV(clusterVersionInfo.oldestBinVersion);
function setFeatureCompatibilityVersion() {
@ -1817,7 +1804,7 @@ var ShardingTest = function ShardingTest(params) {
var bridge = new MongoBridge(bridgeOptions);
}
var conn = MongoRunner.runMongos(options, clusterVersionInfo.isMixedVersion);
var conn = MongoRunner.runMongos(options);
if (!conn) {
throw new Error("Failed to start mongos " + i);
}