Skip to content

Commit d8515d5

Browse files
auto-revert-processorMongoDB Bot
auto-revert-processor
authored and
MongoDB Bot
committed
Revert "SERVER-85851 Modify sharding test to add --upgradeBackCompat when necessary in mixed version clusters (#18460)"
This reverts commit eb787f9d1153b32deeefbf638969e0bc0530bb5d. GitOrigin-RevId: 546a75a82c7a8119678617d19e9a24851338c8ac
1 parent 7cca036 commit d8515d5

File tree

3 files changed

+18
-50
lines changed

3 files changed

+18
-50
lines changed

Diff for: src/mongo/shell/replsettest.js

+9-19
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ var ReplSetTest = function ReplSetTest(opts) {
626626
*
627627
* @param options - The options passed to {@link MongoRunner.runMongod}
628628
*/
629-
ReplSetTest.prototype.startSet = function(options, restart, isMixedVersionCluster) {
629+
ReplSetTest.prototype.startSet = function(options, restart) {
630630
// If the caller has explicitly specified 'waitForConnect:false', then we will start up all
631631
// replica set nodes and return without waiting to connect to any of them.
632632
const skipWaitingForAllConnections = (options && options.waitForConnect === false);
@@ -635,7 +635,7 @@ var ReplSetTest = function ReplSetTest(opts) {
635635
this.startSetOptions = options;
636636

637637
// Start up without waiting for connections.
638-
this.startSetAsync(options, restart, isMixedVersionCluster);
638+
this.startSetAsync(options, restart);
639639

640640
// Avoid waiting for connections to each node.
641641
if (skipWaitingForAllConnections) {
@@ -653,7 +653,7 @@ var ReplSetTest = function ReplSetTest(opts) {
653653
*
654654
* @param options - The options passed to {@link MongoRunner.runMongod}
655655
*/
656-
ReplSetTest.prototype.startSetAsync = function(options, restart, isMixedVersionCluster) {
656+
ReplSetTest.prototype.startSetAsync = function(options, restart) {
657657
print("ReplSetTest starting set '" + this.name + "'");
658658
this.startSetStartTime = new Date(); // Measure the execution time of node startup.
659659

@@ -689,7 +689,7 @@ var ReplSetTest = function ReplSetTest(opts) {
689689
options.waitForConnect = true;
690690
}
691691

692-
this.start(n, options, restart, false, isMixedVersionCluster);
692+
this.start(n, options, restart);
693693
}
694694
return this.nodes;
695695
};
@@ -3191,12 +3191,9 @@ var ReplSetTest = function ReplSetTest(opts) {
31913191
* before the server starts. Default: false.
31923192
* @param {boolean} [waitForHealth] If true, wait for the health indicator of the replica set
31933193
* node after waiting for a connection. Default: false.
3194-
* @param {boolean} [isMixedVersionCluster] If true, it tells mongorunner that this node is part
3195-
* of a mixed version cluster, and will add --upgradeBackCompat when appropriate.
3196-
* Default: false.
31973194
*/
31983195
ReplSetTest.prototype.start = _nodeParamToSingleNode(_nodeParamToId(function(
3199-
n, options, restart, waitForHealth, isMixedVersionCluster) {
3196+
n, options, restart, waitForHealth) {
32003197
print("ReplSetTest n is : " + n);
32013198

32023199
var defaults = {
@@ -3268,17 +3265,10 @@ var ReplSetTest = function ReplSetTest(opts) {
32683265
// Our documented upgrade/downgrade paths for a sharded cluster lets us assume that
32693266
// config server nodes will always be fully upgraded before the shard nodes.
32703267
options.binVersion = "latest";
3271-
options.upgradeBackCompat = '';
32723268
} else {
3273-
if (Random.rand() < 0.5) {
3274-
options.binVersion = "latest";
3275-
options.upgradeBackCompat = '';
3276-
} else {
3277-
options.binVersion = jsTest.options().useRandomBinVersionsWithinReplicaSet;
3278-
options.removeOptions = (options.removeOptions ? options.removeOptions : [])
3279-
.concat("upgradeBackCompat");
3280-
delete options.upgradeBackCompat;
3281-
}
3269+
const rand = Random.rand();
3270+
options.binVersion =
3271+
rand < 0.5 ? "latest" : jsTest.options().useRandomBinVersionsWithinReplicaSet;
32823272
}
32833273
print("Randomly assigned binary version: " + options.binVersion + " to node: " + n);
32843274
}
@@ -3373,7 +3363,7 @@ var ReplSetTest = function ReplSetTest(opts) {
33733363

33743364
// Never wait for a connection inside runMongod. We will do so below if needed.
33753365
options.waitForConnect = false;
3376-
var conn = MongoRunner.runMongod(options, isMixedVersionCluster === true);
3366+
var conn = MongoRunner.runMongod(options);
33773367
if (!conn) {
33783368
throw new Error("Failed to start node " + n);
33793369
}

Diff for: src/mongo/shell/servers.js

+2-11
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ MongoRunner.runningChildPids = function() {
10221022
*
10231023
* @see MongoRunner.arrOptions
10241024
*/
1025-
MongoRunner.runMongod = function(opts, isMixedVersionCluster = false) {
1025+
MongoRunner.runMongod = function(opts) {
10261026
opts = opts || {};
10271027
var env = undefined;
10281028
var useHostName = true;
@@ -1034,11 +1034,6 @@ MongoRunner.runMongod = function(opts, isMixedVersionCluster = false) {
10341034
opts = MongoRunner.mongodOptions(opts);
10351035
fullOptions = opts;
10361036

1037-
if (isMixedVersionCluster &&
1038-
(!opts.binVersion || opts.binVersion == '' || opts.binVersion == shellVersion())) {
1039-
opts.upgradeBackCompat = '';
1040-
}
1041-
10421037
if (opts.useHostName != undefined) {
10431038
useHostName = opts.useHostName;
10441039
} else if (opts.useHostname != undefined) {
@@ -1092,7 +1087,7 @@ MongoRunner.runMongod = function(opts, isMixedVersionCluster = false) {
10921087
return mongod;
10931088
};
10941089

1095-
MongoRunner.runMongos = function(opts, isMixedVersionCluster = false) {
1090+
MongoRunner.runMongos = function(opts) {
10961091
opts = opts || {};
10971092

10981093
var env = undefined;
@@ -1109,10 +1104,6 @@ MongoRunner.runMongos = function(opts, isMixedVersionCluster = false) {
11091104
runId = opts.runId;
11101105
waitForConnect = opts.waitForConnect;
11111106
env = opts.env;
1112-
if (isMixedVersionCluster &&
1113-
(!opts.binVersion || opts.binVersion == '' || opts.binVersion == shellVersion())) {
1114-
opts.upgradeBackCompat = '';
1115-
}
11161107
opts = MongoRunner.arrOptions("mongos", opts);
11171108
}
11181109

Diff for: src/mongo/shell/shardingtest.js

+7-20
Original file line numberDiff line numberDiff line change
@@ -1067,21 +1067,13 @@ var ShardingTest = function ShardingTest(params) {
10671067

10681068
// Must check shardMixedBinVersion because it causes shardOptions.binVersion to be an
10691069
// object (versionIterator) rather than a version string. Must check mongosBinVersion,
1070-
// as well, because it does not update mongosOptions.binVersion. Also check
1071-
// useRandomBinVersionsWithinReplicaSet, as it may cause some nodes within a replica set
1072-
// to be downgraded.
1070+
// as well, because it does not update mongosOptions.binVersion.
10731071
const isMixedVersionShard = jsTestOptions().shardMixedBinVersions &&
10741072
MongoRunner.areBinVersionsTheSame(binVersion,
10751073
jsTestOptions().shardMixedBinVersions);
1076-
10771074
const isMixedVersionMongos = jsTestOptions().mongosBinVersion &&
10781075
MongoRunner.areBinVersionsTheSame(binVersion, jsTestOptions().mongosBinVersion);
1079-
1080-
const isMixedVersionReplicaSet = jsTestOptions().useRandomBinVersionsWithinReplicaSet &&
1081-
MongoRunner.areBinVersionsTheSame(
1082-
binVersion, jsTestOptions().useRandomBinVersionsWithinReplicaSet);
1083-
1084-
if (isMixedVersionShard || isMixedVersionMongos || isMixedVersionReplicaSet) {
1076+
if (isMixedVersionShard || isMixedVersionMongos) {
10851077
return true;
10861078
}
10871079

@@ -1362,8 +1354,6 @@ var ShardingTest = function ShardingTest(params) {
13621354
}
13631355

13641356
try {
1365-
const clusterVersionInfo = this.getClusterVersionInfo();
1366-
13671357
//
13681358
// Start each shard replica set.
13691359
//
@@ -1473,12 +1463,8 @@ var ShardingTest = function ShardingTest(params) {
14731463

14741464
// Start up the replica set but don't wait for it to complete. This allows the startup
14751465
// of each shard to proceed in parallel.
1476-
this._rs[i] = {
1477-
setName: setName,
1478-
test: rs,
1479-
nodes: rs.startSetAsync(rsDefaults, false, clusterVersionInfo.isMixedVersion),
1480-
url: rs.getURL()
1481-
};
1466+
this._rs[i] =
1467+
{setName: setName, test: rs, nodes: rs.startSetAsync(rsDefaults), url: rs.getURL()};
14821468
}
14831469

14841470
if (isConfigShardMode) {
@@ -1526,7 +1512,7 @@ var ShardingTest = function ShardingTest(params) {
15261512
// Start the config server's replica set without waiting for it to complete. This allows
15271513
// it to proceed in parallel with the startup of each shard.
15281514
this.configRS = new ReplSetTest(rstOptions);
1529-
this.configRS.startSetAsync(startOptions, false, clusterVersionInfo.isMixedVersion);
1515+
this.configRS.startSetAsync(startOptions);
15301516
}
15311517

15321518
//
@@ -1747,6 +1733,7 @@ var ShardingTest = function ShardingTest(params) {
17471733
}
17481734

17491735
const configRS = this.configRS;
1736+
const clusterVersionInfo = this.getClusterVersionInfo();
17501737
if (_hasNewFeatureCompatibilityVersion() && clusterVersionInfo.isMixedVersion) {
17511738
const fcv = binVersionToFCV(clusterVersionInfo.oldestBinVersion);
17521739
function setFeatureCompatibilityVersion() {
@@ -1817,7 +1804,7 @@ var ShardingTest = function ShardingTest(params) {
18171804
var bridge = new MongoBridge(bridgeOptions);
18181805
}
18191806

1820-
var conn = MongoRunner.runMongos(options, clusterVersionInfo.isMixedVersion);
1807+
var conn = MongoRunner.runMongos(options);
18211808
if (!conn) {
18221809
throw new Error("Failed to start mongos " + i);
18231810
}

0 commit comments

Comments
 (0)