summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildscripts/resmokeconfig/suites/multiversion.yml2
-rw-r--r--buildscripts/resmokeconfig/suites/multiversion_auth.yml2
-rw-r--r--etc/evergreen.yml2
-rw-r--r--jstests/concurrency/fsm_all_sharded_causal_consistency.js2
-rw-r--r--jstests/concurrency/fsm_all_sharded_causal_consistency_and_balancer.js2
-rw-r--r--jstests/concurrency/fsm_all_sharded_with_stepdowns.js2
-rw-r--r--jstests/concurrency/fsm_all_sharded_with_stepdowns_and_balancer.js2
-rw-r--r--jstests/concurrency/fsm_all_simultaneous.js1
-rw-r--r--jstests/concurrency/fsm_workloads/toggle_feature_compatibility.js64
-rw-r--r--jstests/core/user_management_helpers.js13
-rw-r--r--jstests/multiVersion/2_test_launching_cluster.js1
-rw-r--r--jstests/multiVersion/do_upgrade_downgrade.js32
-rw-r--r--jstests/multiVersion/downgrade_replset.js6
-rw-r--r--jstests/multiVersion/set_feature_compatibility_version.js70
-rw-r--r--jstests/noPassthrough/apply_ops_mode.js5
-rw-r--r--jstests/noPassthrough/apply_ops_overwrite_admin_system_version.js3
-rw-r--r--jstests/noPassthrough/feature_compatibility_version.js35
-rw-r--r--jstests/noPassthrough/unsupported_change_stream_deployments.js7
-rw-r--r--jstests/noPassthroughWithMongod/isMaster_feature_compatibility_version.js25
-rw-r--r--jstests/replsets/dbcheck.js24
-rw-r--r--jstests/replsets/initiate_replset_on_downgraded_standalone_node.js41
-rw-r--r--jstests/replsets/noop_writes_wait_for_write_concern_fcv.js9
-rw-r--r--jstests/sharding/auth_copydb.js8
-rw-r--r--jstests/sharding/autodiscover_config_rs_from_secondary.js8
-rw-r--r--jstests/sharding/config_rs_change.js8
-rw-r--r--jstests/sharding/max_time_ms_sharded_new_commands.js14
-rw-r--r--jstests/sharding/mongos_wait_csrs_initiate.js9
-rw-r--r--jstests/sharding/shard_aware_init.js10
-rw-r--r--jstests/sharding/shard_aware_init_secondaries.js8
-rw-r--r--jstests/sharding/shard_identity_rollback.js6
-rw-r--r--src/mongo/db/catalog/coll_mod.cpp2
-rw-r--r--src/mongo/db/catalog/database_impl.cpp7
-rw-r--r--src/mongo/db/catalog/index_spec_validate_test.cpp3
-rw-r--r--src/mongo/db/commands/dbcheck.cpp8
-rw-r--r--src/mongo/db/commands/feature_compatibility_version.cpp13
-rw-r--r--src/mongo/db/commands/feature_compatibility_version.h2
-rw-r--r--src/mongo/db/commands/feature_compatibility_version_command_parser.h2
-rw-r--r--src/mongo/db/commands/set_feature_compatibility_version_command.cpp2
-rw-r--r--src/mongo/db/commands/validate.cpp12
-rw-r--r--src/mongo/db/db.cpp6
-rw-r--r--src/mongo/db/repl/idempotency_test.cpp4
-rw-r--r--src/mongo/db/repl/initial_syncer.cpp6
-rw-r--r--src/mongo/db/repl/initial_syncer_test.cpp12
-rw-r--r--src/mongo/db/repl/sync_tail_test_fixture.cpp5
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp4
-rw-r--r--src/mongo/db/server_options.h12
-rw-r--r--src/mongo/dbtests/dbtests.cpp2
-rw-r--r--src/mongo/s/commands/cluster_set_feature_compatibility_version_cmd.cpp9
-rw-r--r--src/mongo/s/server.cpp11
-rw-r--r--src/mongo/shell/dbshell.cpp11
50 files changed, 155 insertions, 399 deletions
diff --git a/buildscripts/resmokeconfig/suites/multiversion.yml b/buildscripts/resmokeconfig/suites/multiversion.yml
index 89985950bfb..79bb90f45b8 100644
--- a/buildscripts/resmokeconfig/suites/multiversion.yml
+++ b/buildscripts/resmokeconfig/suites/multiversion.yml
@@ -20,6 +20,8 @@ selector:
# TODO: SERVER-31993
- jstests/multiVersion/add_invalid_shard.js
- jstests/multiVersion/new_mongos_old_mongod_wire_version_clash.js
+ # TODO: SERVER-32636
+ - jstests/multiVersion/feature_compatibility_version_lagging_secondary.js
# Multiversion tests start their own mongod's.
executor:
diff --git a/buildscripts/resmokeconfig/suites/multiversion_auth.yml b/buildscripts/resmokeconfig/suites/multiversion_auth.yml
index 66948a27368..5b1fecbe5b9 100644
--- a/buildscripts/resmokeconfig/suites/multiversion_auth.yml
+++ b/buildscripts/resmokeconfig/suites/multiversion_auth.yml
@@ -25,6 +25,8 @@ selector:
# TODO: SERVER-31993
- jstests/multiVersion/add_invalid_shard.js
- jstests/multiVersion/new_mongos_old_mongod_wire_version_clash.js
+ # TODO: SERVER-32636
+ - jstests/multiVersion/feature_compatibility_version_lagging_secondary.js
# Multiversion tests start their own mongod's.
executor:
diff --git a/etc/evergreen.yml b/etc/evergreen.yml
index 712e8c2e293..4cb74ca7b99 100644
--- a/etc/evergreen.yml
+++ b/etc/evergreen.yml
@@ -4044,7 +4044,7 @@ tasks:
- func: "run powercycle test"
vars:
<<: *powercycle_test
- client_options: --numCrudClients=20 --numFsmClients=20 --fsmWorkloadBlacklistFiles=toggle_feature_compatibility.js
+ client_options: --numCrudClients=20 --numFsmClients=20
mongod_options: --mongodUsablePorts ${standard_port} ${secret_port} --dbPath=${db_path} --logPath=${log_path} --fcv=3.4
mongod_extra_options: --mongodOptions=\"--setParameter enableTestCommands=1 --storageEngine wiredTiger\"
diff --git a/jstests/concurrency/fsm_all_sharded_causal_consistency.js b/jstests/concurrency/fsm_all_sharded_causal_consistency.js
index 742c3e2b5bd..4d5628716cf 100644
--- a/jstests/concurrency/fsm_all_sharded_causal_consistency.js
+++ b/jstests/concurrency/fsm_all_sharded_causal_consistency.js
@@ -85,8 +85,6 @@ var blacklist = [
'rename_collection_dbname_droptarget.js',
'rename_collection_droptarget.js',
- 'toggle_feature_compatibility.js', // Sets FCV to 3.4, which will cause session use to fail
-
'update_simple_eval.js', // eval doesn't work with sharded collections
'update_simple_eval_nolock.js', // eval doesn't work with sharded collections
'update_upsert_multi.js', // our update queries lack shard keys
diff --git a/jstests/concurrency/fsm_all_sharded_causal_consistency_and_balancer.js b/jstests/concurrency/fsm_all_sharded_causal_consistency_and_balancer.js
index 03ce5bda7fd..dbcad489bfa 100644
--- a/jstests/concurrency/fsm_all_sharded_causal_consistency_and_balancer.js
+++ b/jstests/concurrency/fsm_all_sharded_causal_consistency_and_balancer.js
@@ -91,8 +91,6 @@ var blacklist = [
'rename_collection_dbname_droptarget.js',
'rename_collection_droptarget.js',
- 'toggle_feature_compatibility.js', // Sets FCV to 3.4, which will cause session use to fail
-
'update_simple_eval.js', // eval doesn't work with sharded collections
'update_simple_eval_nolock.js', // eval doesn't work with sharded collections
'update_upsert_multi.js', // our update queries lack shard keys
diff --git a/jstests/concurrency/fsm_all_sharded_with_stepdowns.js b/jstests/concurrency/fsm_all_sharded_with_stepdowns.js
index 9dc4a28e97c..7557bfd6a34 100644
--- a/jstests/concurrency/fsm_all_sharded_with_stepdowns.js
+++ b/jstests/concurrency/fsm_all_sharded_with_stepdowns.js
@@ -108,8 +108,6 @@ var blacklist = [
'view_catalog_cycle_with_drop.js',
'view_catalog.js',
- 'toggle_feature_compatibility.js', // Sets FCV to 3.4, which will cause session use to fail.
-
// Use getmores.
'agg_base.js',
'create_index_background.js',
diff --git a/jstests/concurrency/fsm_all_sharded_with_stepdowns_and_balancer.js b/jstests/concurrency/fsm_all_sharded_with_stepdowns_and_balancer.js
index 07dc86a14f6..b2fab08eeaa 100644
--- a/jstests/concurrency/fsm_all_sharded_with_stepdowns_and_balancer.js
+++ b/jstests/concurrency/fsm_all_sharded_with_stepdowns_and_balancer.js
@@ -114,8 +114,6 @@ var blacklist = [
'view_catalog_cycle_with_drop.js',
'view_catalog.js',
- 'toggle_feature_compatibility.js', // Sets FCV to 3.4, which will cause session use to fail.
-
// Use getmores.
'agg_base.js',
'create_index_background.js',
diff --git a/jstests/concurrency/fsm_all_simultaneous.js b/jstests/concurrency/fsm_all_simultaneous.js
index 07cb9b8a8e7..60474cf18d0 100644
--- a/jstests/concurrency/fsm_all_simultaneous.js
+++ b/jstests/concurrency/fsm_all_simultaneous.js
@@ -16,7 +16,6 @@ var blacklist = [
'agg_group_external.js', // uses >100MB of data, which can overwhelm test hosts
'agg_sort_external.js', // uses >100MB of data, which can overwhelm test hosts
- 'toggle_feature_compatibility.js', // Sets FCV to 3.4, which could interefere with other tests.
].map(function(file) {
return dir + '/' + file;
});
diff --git a/jstests/concurrency/fsm_workloads/toggle_feature_compatibility.js b/jstests/concurrency/fsm_workloads/toggle_feature_compatibility.js
deleted file mode 100644
index 4b7567a362d..00000000000
--- a/jstests/concurrency/fsm_workloads/toggle_feature_compatibility.js
+++ /dev/null
@@ -1,64 +0,0 @@
-"use strict";
-
-/**
- * toggle_feature_compatibility.js
- *
- * Adds and updates documents in some threads while rapidly toggling the feature
- * compatibility version between 3.4 and 3.6 in other threads, triggering the
- * failure in SERVER-30705.
- */
-var $config = (function() {
-
- var states = (function() {
- function init(db, collName) {
- this.isInFeatureCompatibilityVersion36 = true;
- }
-
- function flipFeatureCompatibilityVersion(db, data) {
- data.isInFeatureCompatibilityVersion36 = !data.isInFeatureCompatibilityVersion36;
- const newFeatureCompatibilityVersion =
- data.isInFeatureCompatibilityVersion36 ? "3.6" : "3.4";
- assert.commandWorked(
- db.adminCommand({setFeatureCompatibilityVersion: newFeatureCompatibilityVersion}));
- }
-
- function insertAndUpdate(db, collName) {
- // The desired behavior is to have one thread constantly executing
- // flipFeatureCompatibilityVersion() and all the other threads
- // constantly executing insertAndUpdate(). Since we can't explicitly
- // set the state for each thread, we just have one transition
- // function that changes behavior based on which thread it is in.
- if (this.tid == 0) {
- flipFeatureCompatibilityVersion(db, this);
- return;
- }
-
- let insertID = Random.randInt(1000000000);
- let res = db[collName].insert({_id: insertID});
-
- // Fail the test on any write error, except for a duplicate key error, which can
- // (rarely) happen when we accidentally choose the same random key more than once.
- assert(!res.hasWriteError() || res.getWriteError().code == ErrorCodes.DuplicateKey,
- "Failed insert: " + tojson(res));
- assert.writeOK(db[collName].update({_id: insertID}, {$set: {b: 1, a: 1}}));
- }
-
- return {init: init, insertAndUpdate: insertAndUpdate};
-
- })();
-
- var transitions = {init: {insertAndUpdate: 1}, insertAndUpdate: {insertAndUpdate: 1}};
-
- function teardown(db, collName, cluster) {
- assert.commandWorked(db.adminCommand({setFeatureCompatibilityVersion: "3.6"}));
- }
-
- return {
- threadCount: 8,
- iterations: 300,
- data: null,
- states: states,
- transitions: transitions,
- teardown: teardown
- };
-})();
diff --git a/jstests/core/user_management_helpers.js b/jstests/core/user_management_helpers.js
index 59aba33e8c9..f383571d107 100644
--- a/jstests/core/user_management_helpers.js
+++ b/jstests/core/user_management_helpers.js
@@ -87,7 +87,16 @@ function runTest(db) {
db.createUser({user: 'user1', pwd: 'x', roles: [], passwordDigestor: 'foo'});
});
db.createUser({user: 'user1', pwd: 'x', roles: [], passwordDigestor: "server"});
- db.createUser({user: 'user2', pwd: 'x', roles: [], passwordDigestor: "client"});
+
+ // Note that as of SERVER-32974, client-side digestion is only permitted under the SCRAM-SHA-1
+ // mechanism.
+ db.createUser({
+ user: 'user2',
+ pwd: 'x',
+ roles: [],
+ mechanisms: ['SCRAM-SHA-1'],
+ passwordDigestor: "client"
+ });
assert(db.auth('user1', 'x'));
assert(db.auth('user2', 'x'));
@@ -101,7 +110,7 @@ function runTest(db) {
db.updateUser('user1', {pwd: 'y', passwordDigestor: 'foo'});
});
db.updateUser('user1', {pwd: 'y', passwordDigestor: 'server'});
- db.updateUser('user2', {pwd: 'y', passwordDigestor: 'client'});
+ db.updateUser('user2', {pwd: 'y', mechanisms: ['SCRAM-SHA-1'], passwordDigestor: 'client'});
assert(db.auth('user1', 'y'));
assert(db.auth('user2', 'y'));
diff --git a/jstests/multiVersion/2_test_launching_cluster.js b/jstests/multiVersion/2_test_launching_cluster.js
index 4e81fce3602..14ec9149172 100644
--- a/jstests/multiVersion/2_test_launching_cluster.js
+++ b/jstests/multiVersion/2_test_launching_cluster.js
@@ -7,6 +7,7 @@
// at initiation and the 3.6 node will refuse to initial sync from it. For 3.8, we will be able
// to send 'replSetInitiate' to the 3.6 node and it will write the document at initiate in fCV
// 3.6 (since this changed between 3.4 and 3.6), and the 3.8 node will initial sync from it.
+// TODO(SERVER-33180) update this test to use replica set shards.
//
load('./jstests/multiVersion/libs/verify_versions.js');
diff --git a/jstests/multiVersion/do_upgrade_downgrade.js b/jstests/multiVersion/do_upgrade_downgrade.js
index cb344d09728..75b9bb7c23f 100644
--- a/jstests/multiVersion/do_upgrade_downgrade.js
+++ b/jstests/multiVersion/do_upgrade_downgrade.js
@@ -9,9 +9,7 @@
load("jstests/libs/check_uuids.js");
const latestBinary = "latest";
- const lastStableBinary = "3.4";
- const latestFCV = "3.6";
- const lastStableFCV = "3.4";
+ const lastStableBinary = "last-stable";
let setFCV = function(adminDB, version) {
assert.commandWorked(adminDB.runCommand({setFeatureCompatibilityVersion: version}));
@@ -75,15 +73,10 @@
// Ensure all collections have UUIDs in latest featureCompatibilityVersion mode.
checkCollectionUUIDs(adminDB);
- // TODO(SERVER-31985) uncomment below code.
- /*
// Set featureCompatibilityVersion to last-stable.
setFCV(adminDB, lastStableFCV);
- */
}
- // TODO(SERVER-31985) uncomment below code.
- /*
// Ensure featureCompatibilityVersion is last-stable and all collections still have UUIDs.
checkFCV(adminDB, lastStableFCV);
checkCollectionUUIDs(adminDB);
@@ -100,7 +93,7 @@
checkFCV(lastStableAdminDB, lastStableFCV);
// Ensure all collections still have UUIDs on a last-stable mongod.
- checkCollectionUUIDs(adminDB);
+ checkCollectionUUIDs(lastStableAdminDB);
// Stop last-stable binary version mongod.
MongoRunner.stopMongod(lastStableConn);
@@ -114,7 +107,6 @@
setFCV(adminDB, latestFCV);
checkFCV(adminDB, latestFCV);
checkCollectionUUIDs(adminDB);
- */
// Stop latest binary version mongod for the last time
MongoRunner.stopMongod(conn);
@@ -162,16 +154,11 @@
checkCollectionUUIDs(secondaryAdminDB);
}
- // TODO(SERVER-31985) uncomment below code.
- /*
// Change featureCompatibilityVersion to last-stable.
setFCV(primaryAdminDB, lastStableFCV);
rst.awaitReplication();
- */
}
- // TODO(SERVER-31985) uncomment below code.
- /*
// Ensure featureCompatibilityVersion is last-stable and all collections still have UUIDs.
checkFCV(primaryAdminDB, lastStableFCV);
for (let j = 0; j < secondaries.length; j++) {
@@ -184,12 +171,10 @@
let secondaryAdminDB = secondaries[j].getDB("admin");
checkCollectionUUIDs(secondaryAdminDB);
}
- */
- // TODO(SERVER-31985) uncomment below code.
// Stop latest binary version replica set.
- // rst.stopSet(null /* signal */, true /* forRestart */);
- /*
+ rst.stopSet(null /* signal */, true /* forRestart */);
+
// Downgrade the ReplSetTest binaries and make sure everything is okay.
jsTest.log("Starting a last-stable binVersion ReplSetTest to test downgrade");
rst.startSet({restart: true, binVersion: lastStableBinary});
@@ -207,14 +192,12 @@
checkCollectionUUIDs(lastStablePrimaryAdminDB);
for (let j = 0; j < secondaries.length; j++) {
- let secondaryAdminDB = secondaries[j].getDB("admin");
+ let secondaryAdminDB = lastStableSecondaries[j].getDB("admin");
checkCollectionUUIDs(secondaryAdminDB);
}
- */
- // TODO(SERVER-31985) uncomment below code.
- // rst.stopSet(null /* signal */, true /* forRestart */);
- /*
+ rst.stopSet(null /* signal */, true /* forRestart */);
+
// Start latest binary version replica set again.
jsTest.log("Starting a latest binVersion ReplSetTest to test upgrade");
rst.startSet({restart: true, binVersion: latestBinary});
@@ -237,7 +220,6 @@
let secondaryAdminDB = secondaries[j].getDB("admin");
checkCollectionUUIDs(secondaryAdminDB);
}
- */
rst.stopSet();
};
diff --git a/jstests/multiVersion/downgrade_replset.js b/jstests/multiVersion/downgrade_replset.js
index 3f5ce944362..567c4bbf489 100644
--- a/jstests/multiVersion/downgrade_replset.js
+++ b/jstests/multiVersion/downgrade_replset.js
@@ -25,9 +25,9 @@ function runDowngradeTest(protocolVersion) {
let primary = rst.getPrimary();
let coll = "test.foo";
- // TODO(SERVER-32597) remove this when fCV 4.0 becomes the default on clean startup.
- assert.commandWorked(primary.adminCommand({setFeatureCompatibilityVersion: latestFCV}));
- rst.awaitReplication();
+ // The default FCV is latestFCV for non-shard replica sets.
+ let primaryAdminDB = rst.getPrimary().getDB("admin");
+ checkFCV(primaryAdminDB, latestFCV);
// We wait for the feature compatibility version to be set to lastStableFCV on all nodes of the
// replica set in order to ensure that all nodes can be successfully downgraded. This
diff --git a/jstests/multiVersion/set_feature_compatibility_version.js b/jstests/multiVersion/set_feature_compatibility_version.js
index 2b1b0d3531e..976e8b01acc 100644
--- a/jstests/multiVersion/set_feature_compatibility_version.js
+++ b/jstests/multiVersion/set_feature_compatibility_version.js
@@ -22,8 +22,6 @@ TestData.skipCheckDBHashes = true;
const latest = "latest";
const lastStable = "last-stable";
- const latestFCV = "4.0";
- const lastStableFCV = "3.6";
//
// Standalone tests.
@@ -37,11 +35,7 @@ TestData.skipCheckDBHashes = true;
assert.neq(
null, conn, "mongod was unable to start up with version=" + latest + " and no data files");
adminDB = conn.getDB("admin");
- checkFCV(adminDB,
- lastStableFCV); // TODO: make this 'latestFCV' when SERVER-32597 bumps default
-
- // TODO: remove this when SERVER-32597 bumps the default to 4.0.
- assert.commandWorked(adminDB.runCommand({setFeatureCompatibilityVersion: latestFCV}));
+ checkFCV(adminDB, latestFCV);
// featureCompatibilityVersion cannot be set to invalid value.
assert.commandFailed(adminDB.runCommand({setFeatureCompatibilityVersion: 5}));
@@ -97,44 +91,25 @@ TestData.skipCheckDBHashes = true;
assert.commandWorked(adminDB.runCommand({setFeatureCompatibilityVersion: latestFCV}));
checkFCV(adminDB, latestFCV);
- // TODO: remove these FCV 3.4 / 4.0 tests when FCV 3.4 is removed (SERVER-32597).
- // ----------------------------------------------------------------------------------
-
- // Cannot jump down two FCVs from 4.0 to 3.4
- assert.commandFailed(adminDB.runCommand({setFeatureCompatibilityVersion: "3.4"}));
- checkFCV(adminDB, latestFCV);
-
- assert.commandWorked(adminDB.runCommand({setFeatureCompatibilityVersion: lastStableFCV}));
- assert.commandWorked(adminDB.runCommand({setFeatureCompatibilityVersion: "3.4"}));
- checkFCV(adminDB, "3.4");
-
- // Cannot jump up two FCVs from 3.4 to 4.0
- assert.commandFailed(adminDB.runCommand({setFeatureCompatibilityVersion: latestFCV}));
- checkFCV(adminDB, "3.4");
-
- // ------------------ end FCV 3.4/4.0 testing ---------------------------------------
-
MongoRunner.stopMongod(conn);
// featureCompatibilityVersion is durable.
- // TODO: update this to use 'latestFCV' and 'lastStableFCV', rather than 'lastStableFCV' and
- // '3.4', respectively, when SERVER-32597 bumps the default to 4.0.
conn = MongoRunner.runMongod({dbpath: dbpath, binVersion: latest});
assert.neq(
null, conn, "mongod was unable to start up with version=" + latest + " and no data files");
adminDB = conn.getDB("admin");
+ checkFCV(adminDB, latestFCV);
+ assert.commandWorked(adminDB.runCommand({setFeatureCompatibilityVersion: lastStableFCV}));
checkFCV(adminDB, lastStableFCV);
- assert.commandWorked(adminDB.runCommand({setFeatureCompatibilityVersion: "3.4"}));
- checkFCV(adminDB, "3.4");
MongoRunner.stopMongod(conn);
conn = MongoRunner.runMongod({dbpath: dbpath, binVersion: latest, noCleanData: true});
assert.neq(null,
conn,
"mongod was unable to start up with binary version=" + latest +
- " and featureCompatibilityVersion=3.4");
+ " and last-stable featureCompatibilityVersion");
adminDB = conn.getDB("admin");
- checkFCV(adminDB, "3.4");
+ checkFCV(adminDB, lastStableFCV);
MongoRunner.stopMongod(conn);
// If you upgrade from 'lastStable' binary to 'latest' binary and have non-local databases, FCV
@@ -184,22 +159,19 @@ TestData.skipCheckDBHashes = true;
secondaryAdminDB = rst.getSecondary().getDB("admin");
// FCV should default to 'latestFCV' on primary and secondary in a 'latest' binary replica set.
- // TODO: update these to 'latestFCV' when SERVER-32597 bumps the FCV default.
- checkFCV(primaryAdminDB, lastStableFCV);
+ checkFCV(primaryAdminDB, latestFCV);
rst.awaitReplication();
- checkFCV(secondaryAdminDB, lastStableFCV);
+ checkFCV(secondaryAdminDB, latestFCV);
// featureCompatibilityVersion propagates to secondary.
- // TODO: update these to 'lastStableFCV' when SERVER-32597 bumps the FCV default.
- assert.commandWorked(primaryAdminDB.runCommand({setFeatureCompatibilityVersion: "3.4"}));
- checkFCV(primaryAdminDB, "3.4");
+ assert.commandWorked(
+ primaryAdminDB.runCommand({setFeatureCompatibilityVersion: lastStableFCV}));
+ checkFCV(primaryAdminDB, lastStableFCV);
rst.awaitReplication();
- checkFCV(secondaryAdminDB, "3.4");
+ checkFCV(secondaryAdminDB, lastStableFCV);
// setFeatureCompatibilityVersion cannot be run on secondary.
- // TODO: update this to 'latestFCV' when SERVER-32597 bumps the FCV default.
- assert.commandFailed(
- secondaryAdminDB.runCommand({setFeatureCompatibilityVersion: lastStableFCV}));
+ assert.commandFailed(secondaryAdminDB.runCommand({setFeatureCompatibilityVersion: latestFCV}));
rst.stopSet();
@@ -224,6 +196,8 @@ TestData.skipCheckDBHashes = true;
let primary = rst.getPrimary();
primaryAdminDB = primary.getDB("admin");
+ assert.commandWorked(primary.adminCommand({setFeatureCompatibilityVersion: lastStableFCV}));
+
let secondary = rst.add({binVersion: lastStable});
secondaryAdminDB = secondary.getDB("admin");
@@ -289,12 +263,8 @@ TestData.skipCheckDBHashes = true;
configPrimaryAdminDB = st.configRS.getPrimary().getDB("admin");
shardPrimaryAdminDB = st.rs0.getPrimary().getDB("admin");
- // TODO: update this to 'latestFCV' when SERVER-32597 bumps the FCV default.
- checkFCV(configPrimaryAdminDB, lastStableFCV);
- checkFCV(shardPrimaryAdminDB, lastStableFCV);
-
- // TODO: remove this when SERVER-32597 bumps the FCV default ot 4.0.
- assert.commandWorked(mongosAdminDB.runCommand({setFeatureCompatibilityVersion: latestFCV}));
+ checkFCV(configPrimaryAdminDB, latestFCV);
+ checkFCV(shardPrimaryAdminDB, latestFCV);
// featureCompatibilityVersion cannot be set to invalid value on mongos.
assert.commandFailed(mongosAdminDB.runCommand({setFeatureCompatibilityVersion: 5}));
@@ -392,12 +362,8 @@ TestData.skipCheckDBHashes = true;
mongosAdminDB = st.s.getDB("admin");
configPrimaryAdminDB = st.configRS.getPrimary().getDB("admin");
shardPrimaryAdminDB = st.shard0.getDB("admin");
- // TODO: update this to 'latestFCV' when SERVER-32597 updates the FCV defaults.
- checkFCV(configPrimaryAdminDB, lastStableFCV);
- checkFCV(shardPrimaryAdminDB, lastStableFCV);
-
- // TODO: remove this when SERVER-32597 updates the FCV defaults.
- assert.commandWorked(mongosAdminDB.runCommand({setFeatureCompatibilityVersion: latestFCV}));
+ checkFCV(configPrimaryAdminDB, latestFCV);
+ checkFCV(shardPrimaryAdminDB, latestFCV);
// Ensure that a 'lastStable' binary mongos can be added to a 'lastStableFCV' cluster.
diff --git a/jstests/noPassthrough/apply_ops_mode.js b/jstests/noPassthrough/apply_ops_mode.js
index bd21665cef1..a4a6e5a838f 100644
--- a/jstests/noPassthrough/apply_ops_mode.js
+++ b/jstests/noPassthrough/apply_ops_mode.js
@@ -6,6 +6,7 @@
(function() {
'use strict';
+ load('jstests/libs/feature_compatibility_version.js');
var standalone = MongoRunner.runMongod();
var db = standalone.getDB("test");
@@ -56,7 +57,7 @@
updateOp = {
op: 'u',
ns: systemVersionColl.getFullName(),
- o: {_id: "featureCompatibilityVersion", version: "3.4"},
+ o: {_id: "featureCompatibilityVersion", version: lastStableFCV},
o2: {_id: "featureCompatibilityVersion"}
};
assert.commandFailed(
@@ -65,7 +66,7 @@
assert.commandWorked(db.adminCommand({applyOps: [updateOp], oplogApplicationMode: "ApplyOps"}));
// Test default succeeds.
- updateOp.o.targetVersion = "3.6";
+ updateOp.o.targetVersion = latestFCV;
assert.commandWorked(db.adminCommand({
applyOps: [updateOp],
}));
diff --git a/jstests/noPassthrough/apply_ops_overwrite_admin_system_version.js b/jstests/noPassthrough/apply_ops_overwrite_admin_system_version.js
index 33dd8afd219..f02fad241d3 100644
--- a/jstests/noPassthrough/apply_ops_overwrite_admin_system_version.js
+++ b/jstests/noPassthrough/apply_ops_overwrite_admin_system_version.js
@@ -1,5 +1,6 @@
(function() {
"use strict";
+ load("jstests/libs/feature_compatibility_version.js");
var standalone = MongoRunner.runMongod();
var adminDB = standalone.getDB("admin");
@@ -17,7 +18,7 @@
var insertFCVDocument = {
op: "i",
ns: "admin.system.version",
- o: {_id: "featureCompatibilityVersion", version: "3.6"}
+ o: {_id: "featureCompatibilityVersion", version: latestFCV}
};
var dropOriginalAdminSystemVersionCollection =
{op: "c", ns: "admin.$cmd", ui: originalUUID, o: {drop: "admin.tmp_system_version"}};
diff --git a/jstests/noPassthrough/feature_compatibility_version.js b/jstests/noPassthrough/feature_compatibility_version.js
index d82092e450c..64cd6a3a5f7 100644
--- a/jstests/noPassthrough/feature_compatibility_version.js
+++ b/jstests/noPassthrough/feature_compatibility_version.js
@@ -6,23 +6,11 @@
load("jstests/libs/feature_compatibility_version.js");
- // Skip collection validation since this test leaves collections in an invalid state, where
- // FCV=3.4 but UUIDs exist. (Modifying the FCV document directly does not perform
- // upgrade/downgrade with UUID addition/removal, but merely modifies the in-memory variable.)
- // TODO: remove this in SERVER-32597, when FCV 3.4 is removed and UUIDs always exist.
- TestData.skipCollectionAndIndexValidation = true;
-
- let latestFCV = "4.0";
- let lastStableFCV = "3.6";
-
const conn = MongoRunner.runMongod({});
assert.neq(null, conn, "mongod was unable to start up");
let adminDB = conn.getDB("admin");
- // TODO: remove this when the FCV default is bumped (SERVER-32597).
- assert.commandWorked(adminDB.runCommand({setFeatureCompatibilityVersion: latestFCV}));
-
// Initially the featureCompatibilityVersion is latestFCV.
checkFCV(adminDB, latestFCV);
@@ -64,28 +52,5 @@
ErrorCodes.BadValue);
checkFCV(adminDB, latestFCV);
- // TODO: remove these FCV 3.4 / 4.0 tests when FCV 3.4 is removed (SERVER-32597).
- // ----------------------------------------------------------------------------------
-
- // Cannot be in FCV 4.0 and target 3.4.
- assert.writeErrorWithCode(adminDB.system.version.update({_id: "featureCompatibilityVersion"},
- {$set: {targetVersion: "3.4"}}),
- ErrorCodes.BadValue);
- checkFCV(adminDB, latestFCV);
-
- assert.writeOK(adminDB.system.version.update({_id: "featureCompatibilityVersion"},
- {$set: {version: lastStableFCV}}));
- checkFCV(adminDB, lastStableFCV);
- assert.writeOK(adminDB.system.version.update({_id: "featureCompatibilityVersion"},
- {$set: {version: "3.4"}}));
- checkFCV(adminDB, "3.4");
-
- // Cannot be in FCV 3.4 and target 4.0.
- assert.writeErrorWithCode(adminDB.system.version.update({_id: "featureCompatibilityVersion"},
- {$set: {targetVersion: latestFCV}}),
- ErrorCodes.BadValue);
- checkFCV(adminDB, "3.4");
- // ------------------ end FCV 3.4/4.0 testing ---------------------------------------
-
MongoRunner.stopMongod(conn);
}());
diff --git a/jstests/noPassthrough/unsupported_change_stream_deployments.js b/jstests/noPassthrough/unsupported_change_stream_deployments.js
index 0f5ea72768f..023b124a1b0 100644
--- a/jstests/noPassthrough/unsupported_change_stream_deployments.js
+++ b/jstests/noPassthrough/unsupported_change_stream_deployments.js
@@ -32,13 +32,6 @@
const master = masterSlaveFixture.start(true, {enableMajorityReadConcern: ""});
assert.writeOK(master.getDB("test").ensure_db_exists.insert({}));
assertChangeStreamNotSupportedOnConnection(master);
-
- const slave = masterSlaveFixture.start(false);
- // Slaves start in FCV 3.4; we need to wait for it to sync the FCV document from the master
- // before trying a change stream, or the change stream will fail for the wrong reason.
- assert.soonNoExcept(() => checkFCV(slave.getDB("admin"), "3.6") || true);
- assert.soonNoExcept(() => slave.getDB("test").ensure_db_exists.exists());
- assertChangeStreamNotSupportedOnConnection(slave);
masterSlaveFixture.stop();
// Test a sharded cluster with standalone shards.
diff --git a/jstests/noPassthroughWithMongod/isMaster_feature_compatibility_version.js b/jstests/noPassthroughWithMongod/isMaster_feature_compatibility_version.js
index 2d70d7c6508..0c6fc4de768 100644
--- a/jstests/noPassthroughWithMongod/isMaster_feature_compatibility_version.js
+++ b/jstests/noPassthroughWithMongod/isMaster_feature_compatibility_version.js
@@ -3,34 +3,28 @@
// ensures that an older version mongod/mongos will fail to connect to the node when it is upgraded,
// upgrading, or downgrading.
//
-// TODO: remove FCV 3.4 isMaster testing when we finally remove FCV 3.4. (SERVER-32597)
(function() {
"use strict";
+ load('./jstests/libs/feature_compatibility_version.js');
const adminDB = db.getSiblingDB("admin");
const isMasterCommand = {
isMaster: 1,
internalClient: {minWireVersion: NumberInt(0), maxWireVersion: NumberInt(7)}
};
- const upgradeVersion = "4.0";
- const downgradeVersion = "3.6";
- const deprecatedDowngradeVersion = "3.4";
-
- // TODO: remove this setFCV when SERVER-32597 bumps the default FCV from 3.4 to 3.6.
- assert.commandWorked(adminDB.runCommand({setFeatureCompatibilityVersion: downgradeVersion}));
// When the featureCompatibilityVersion is equal to the upgrade version, running isMaster with
// internalClient returns minWireVersion == maxWireVersion.
- assert.commandWorked(adminDB.runCommand({setFeatureCompatibilityVersion: upgradeVersion}));
+ checkFCV(adminDB, latestFCV);
let res = adminDB.runCommand(isMasterCommand);
assert.commandWorked(res);
assert.eq(res.minWireVersion, res.maxWireVersion, tojson(res));
// When the featureCompatibilityVersion is upgrading, running isMaster with internalClient
// returns minWireVersion == maxWireVersion.
- assert.writeOK(adminDB.system.version.update(
- {_id: "featureCompatibilityVersion"},
- {$set: {version: downgradeVersion, targetVersion: upgradeVersion}}));
+ assert.writeOK(
+ adminDB.system.version.update({_id: "featureCompatibilityVersion"},
+ {$set: {version: lastStableFCV, targetVersion: latestFCV}}));
res = adminDB.runCommand(isMasterCommand);
assert.commandWorked(res);
assert.eq(res.minWireVersion, res.maxWireVersion, tojson(res));
@@ -39,14 +33,14 @@
// returns minWireVersion == maxWireVersion.
assert.writeOK(adminDB.system.version.update(
{_id: "featureCompatibilityVersion"},
- {$set: {version: downgradeVersion, targetVersion: downgradeVersion}}));
+ {$set: {version: lastStableFCV, targetVersion: lastStableFCV}}));
res = adminDB.runCommand(isMasterCommand);
assert.commandWorked(res);
assert.eq(res.minWireVersion, res.maxWireVersion, tojson(res));
// When the featureCompatibilityVersion is equal to the downgrade version, running isMaster with
// internalClient returns minWireVersion + 1 == maxWireVersion.
- assert.commandWorked(adminDB.runCommand({setFeatureCompatibilityVersion: downgradeVersion}));
+ assert.commandWorked(adminDB.runCommand({setFeatureCompatibilityVersion: lastStableFCV}));
res = adminDB.runCommand(isMasterCommand);
assert.commandWorked(res);
assert.eq(res.minWireVersion + 1, res.maxWireVersion, tojson(res));
@@ -54,7 +48,7 @@
// When the internalClient field is missing from the isMaster command, the response returns the
// full wire version range from minWireVersion == 0 to maxWireVersion == latest version, even if
// the featureCompatibilityVersion is equal to the upgrade version.
- assert.commandWorked(adminDB.runCommand({setFeatureCompatibilityVersion: upgradeVersion}));
+ assert.commandWorked(adminDB.runCommand({setFeatureCompatibilityVersion: latestFCV}));
res = adminDB.runCommand({isMaster: 1});
assert.commandWorked(res);
assert.eq(res.minWireVersion, 0, tojson(res));
@@ -62,6 +56,9 @@
// When the featureCompatibilityVersion is equal to the deprecated downgrade version, running
// isMaster with internalClient returns minWireVersion + 1 == maxWireVersion.
+ // TODO(SERVER-33179) remove this section once fCV 3.4 is removed.
+ const downgradeVersion = "3.6";
+ const deprecatedDowngradeVersion = "3.4";
assert.commandWorked(adminDB.runCommand({setFeatureCompatibilityVersion: downgradeVersion}));
assert.commandWorked(
adminDB.runCommand({setFeatureCompatibilityVersion: deprecatedDowngradeVersion}));
diff --git a/jstests/replsets/dbcheck.js b/jstests/replsets/dbcheck.js
index 1ad59645c0a..c574e42a5a6 100644
--- a/jstests/replsets/dbcheck.js
+++ b/jstests/replsets/dbcheck.js
@@ -344,30 +344,6 @@
testSucceedsOnStepdown();
- function testFailsOnWrongFCV() {
- let master = replSet.getPrimary();
- let db = master.getDB(dbName);
-
- assert.commandWorked(db.runCommand({dbCheck: multiBatchSimpleCollName}));
- assert.commandWorked(
- master.getDB("admin").adminCommand({setFeatureCompatibilityVersion: "3.4"}));
-
- // Check that the server is still responding.
- try {
- assert.commandWorked(db.runCommand({ping: 1}),
- "ping failed after FCV change during dbCheck");
- } catch (e) {
- doassert("dbCheck with FCV change crashed server");
- }
-
- assert.commandFailed(db.runCommand({dbCheck: multiBatchSimpleCollName}));
-
- assert.commandWorked(
- master.getDB("admin").adminCommand({setFeatureCompatibilityVersion: "3.6"}));
- }
-
- testFailsOnWrongFCV();
-
function collectionUuid(db, collName) {
return db.getCollectionInfos().filter(coll => coll.name === collName)[0].info.uuid;
}
diff --git a/jstests/replsets/initiate_replset_on_downgraded_standalone_node.js b/jstests/replsets/initiate_replset_on_downgraded_standalone_node.js
deleted file mode 100644
index 309a9cfd207..00000000000
--- a/jstests/replsets/initiate_replset_on_downgraded_standalone_node.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Restarting a downgraded standalone node as a replset node
- * shouldn't assign UUID for collections.
- *
- * @tags: [requires_persistence]
- */
-(function() {
- "use strict";
-
- load("jstests/libs/feature_compatibility_version.js");
- load("jstests/libs/uuid_util.js");
- load("jstests/replsets/rslib.js");
-
- let dbpath = MongoRunner.dataPath + "initiate_replset_on_downgraded_standalone_node";
- let conn = MongoRunner.runMongod({dbpath: dbpath});
- assert.neq(null, conn, "mongod was unable to start up");
- let adminDB = conn.getDB("admin");
-
- // Downgrade the server.
- let versionWithoutUUIDSupport = "3.4";
- assert.commandWorked(
- adminDB.runCommand({setFeatureCompatibilityVersion: versionWithoutUUIDSupport}));
- checkFCV(adminDB, versionWithoutUUIDSupport);
-
- MongoRunner.stopMongod(conn);
-
- // Restart the mongod but with --replSet this time.
- conn = MongoRunner.runMongod({dbpath: dbpath, "replSet": "rs0", noCleanData: true});
- assert.neq(null, conn, "mongod was unable to start up");
- adminDB = conn.getDB("admin");
- let replSetConfig = {_id: "rs0", members: [{_id: 0, host: conn.host}]};
- let cmd = {replSetInitiate: replSetConfig};
- assert.commandWorked(adminDB.runCommand(cmd), tojson(cmd));
-
- // Wait until the node becomes the primary.
- waitForState(conn, ReplSetTest.State.PRIMARY);
-
- // Check an arbitrary collection's uuid field.
- assert.eq(undefined, getUUIDFromListCollections(conn.getDB("local"), "startup_log"));
- MongoRunner.stopMongod(conn);
-}());
diff --git a/jstests/replsets/noop_writes_wait_for_write_concern_fcv.js b/jstests/replsets/noop_writes_wait_for_write_concern_fcv.js
index cb02860aad2..539e4b113d5 100644
--- a/jstests/replsets/noop_writes_wait_for_write_concern_fcv.js
+++ b/jstests/replsets/noop_writes_wait_for_write_concern_fcv.js
@@ -4,8 +4,9 @@
(function() {
"use strict";
- load("jstests/libs/write_concern_util.js"); // assertWriteConcernError
- load("jstests/replsets/rslib.js"); // reconfig
+ load("jstests/libs/write_concern_util.js"); // assertWriteConcernError
+ load("jstests/replsets/rslib.js"); // reconfig
+ load("jstests/libs/feature_compatibility_version.js"); // latestFCV/lastStableFCV
// Start a two node replica set and set its FCV to the given version, then take down one
// node so majority write concern can no longer be satisfied and verify that a noop setFCV
@@ -65,6 +66,6 @@
replTest.stopSet();
}
- testFCVNoop("3.4");
- testFCVNoop("3.6");
+ testFCVNoop(lastStableFCV);
+ testFCVNoop(latestFCV);
})();
diff --git a/jstests/sharding/auth_copydb.js b/jstests/sharding/auth_copydb.js
index 47bffce9059..35f5295d0d3 100644
--- a/jstests/sharding/auth_copydb.js
+++ b/jstests/sharding/auth_copydb.js
@@ -1,6 +1,7 @@
// Tests the copydb command on mongos with auth
(function() {
'use strict';
+ load('jstests/libs/feature_compatibility_version.js');
var st = new ShardingTest({shards: 1, mongos: 1, other: {keyFile: 'jstests/libs/key1'}});
var mongos = st.s0;
@@ -10,9 +11,10 @@
var sourceMongodConn = MongoRunner.runMongod({});
var sourceTestDB = sourceMongodConn.getDB('test');
- // Ensure sourceMongodConn has featureCompatibilityVersion=3.6, so that the sharded cluster can
- // communicate with it if it has featureCompatibilityVersion=3.6.
- assert.commandWorked(sourceMongodConn.adminCommand({setFeatureCompatibilityVersion: "3.6"}));
+ // Ensure sourceMongodConn has featureCompatibilityVersion=lastStableFCV so that the sharded
+ // cluster can communicate with it if it has featureCompatibilityVersion=lastStableFCV
+ assert.commandWorked(
+ sourceMongodConn.adminCommand({setFeatureCompatibilityVersion: lastStableFCV}));
sourceTestDB.foo.insert({a: 1});
diff --git a/jstests/sharding/autodiscover_config_rs_from_secondary.js b/jstests/sharding/autodiscover_config_rs_from_secondary.js
index d2f58f2ac5c..a0f927f67c3 100644
--- a/jstests/sharding/autodiscover_config_rs_from_secondary.js
+++ b/jstests/sharding/autodiscover_config_rs_from_secondary.js
@@ -4,6 +4,7 @@
(function() {
'use strict';
+ load('jstests/libs/feature_compatibility_version.js');
var rst = new ReplSetTest(
{name: "configRS", nodes: 3, nodeOptions: {configsvr: "", storageEngine: "wiredTiger"}});
@@ -14,9 +15,10 @@
conf.writeConcernMajorityJournalDefault = true;
rst.initiate(conf);
- // Ensure the featureCompatibilityVersion is 3.6 so that the mongos can connect if it is version
- // 3.6.
- assert.commandWorked(rst.getPrimary().adminCommand({setFeatureCompatibilityVersion: "3.6"}));
+ // Ensure the featureCompatibilityVersion is lastStableFCV so that the mongos can connect if it
+ // is binary version last-stable.
+ assert.commandWorked(
+ rst.getPrimary().adminCommand({setFeatureCompatibilityVersion: lastStableFCV}));
var seedList = rst.name + "/" + rst.nodes[1].host; // node 1 is guaranteed to not be primary
{
diff --git a/jstests/sharding/config_rs_change.js b/jstests/sharding/config_rs_change.js
index 219e37b751b..9291c45976e 100644
--- a/jstests/sharding/config_rs_change.js
+++ b/jstests/sharding/config_rs_change.js
@@ -2,15 +2,17 @@
// match the replset config on the config servers, and that it can successfully update it's view
// of the config replset config during startup.
+load("jstests/libs/feature_compatibility_version.js");
var configRS = new ReplSetTest({name: "configRS", nodes: 1, useHostName: true});
configRS.startSet({configsvr: '', journal: "", storageEngine: 'wiredTiger'});
var replConfig = configRS.getReplSetConfig();
replConfig.configsvr = true;
configRS.initiate(replConfig);
-// Ensure the featureCompatibilityVersion is 3.4 so that the mongos can connect if it is version
-// 3.4.
-assert.commandWorked(configRS.getPrimary().adminCommand({setFeatureCompatibilityVersion: "3.4"}));
+// Ensure the featureCompatibilityVersion is lastStableFCV so that the mongos can connect if its
+// binary version is lastStable.
+assert.commandWorked(
+ configRS.getPrimary().adminCommand({setFeatureCompatibilityVersion: lastStableFCV}));
// Build a seed list for the config servers to pass to mongos that uses "localhost" for the
// hostnames even though the replica set config uses the hostname.
diff --git a/jstests/sharding/max_time_ms_sharded_new_commands.js b/jstests/sharding/max_time_ms_sharded_new_commands.js
index 3b4bec81551..2084f1b711d 100644
--- a/jstests/sharding/max_time_ms_sharded_new_commands.js
+++ b/jstests/sharding/max_time_ms_sharded_new_commands.js
@@ -1,8 +1,7 @@
-// Continuation of max_time_ms.js, but only contains commands which are not present in a previous
-// version
+// Make sure the setFeatureCompatibilityVersion command respects maxTimeMs.
(function() {
'use strict';
-
+ load("./jstests/libs/feature_compatibility_version.js");
var st = new ShardingTest({shards: 2});
var mongos = st.s0;
@@ -25,18 +24,21 @@
// Positive test for "setFeatureCompatibilityVersion"
configureMaxTimeAlwaysTimeOut("alwaysOn");
assert.commandFailedWithCode(
- admin.runCommand({setFeatureCompatibilityVersion: '3.4', maxTimeMS: 1000 * 60 * 60 * 24}),
+ admin.runCommand(
+ {setFeatureCompatibilityVersion: lastStableFCV, maxTimeMS: 1000 * 60 * 60 * 24}),
ErrorCodes.ExceededTimeLimit,
"expected setFeatureCompatibilityVersion to fail due to maxTimeAlwaysTimeOut fail point");
// Negative test for "setFeatureCompatibilityVersion"
configureMaxTimeAlwaysTimeOut("off");
assert.commandWorked(
- admin.runCommand({setFeatureCompatibilityVersion: '3.4', maxTimeMS: 1000 * 60 * 60 * 24}),
+ admin.runCommand(
+ {setFeatureCompatibilityVersion: lastStableFCV, maxTimeMS: 1000 * 60 * 60 * 24}),
"expected setFeatureCompatibilityVersion to not hit time limit in mongod");
assert.commandWorked(
- admin.runCommand({setFeatureCompatibilityVersion: '3.6', maxTimeMS: 1000 * 60 * 60 * 24}),
+ admin.runCommand(
+ {setFeatureCompatibilityVersion: latestFCV, maxTimeMS: 1000 * 60 * 60 * 24}),
"expected setFeatureCompatibilityVersion to not hit time limit in mongod");
st.stop();
diff --git a/jstests/sharding/mongos_wait_csrs_initiate.js b/jstests/sharding/mongos_wait_csrs_initiate.js
index 6dbd71a1427..315d87eadc4 100644
--- a/jstests/sharding/mongos_wait_csrs_initiate.js
+++ b/jstests/sharding/mongos_wait_csrs_initiate.js
@@ -1,5 +1,7 @@
// Tests that mongos will wait for CSRS replica set to initiate.
+load("jstests/libs/feature_compatibility_version.js");
+
var configRS = new ReplSetTest({name: "configRS", nodes: 1, useHostName: true});
configRS.startSet({configsvr: '', journal: "", storageEngine: 'wiredTiger'});
var replConfig = configRS.getReplSetConfig();
@@ -13,9 +15,10 @@ assert.throws(function() {
jsTestLog("Initiating CSRS");
configRS.initiate(replConfig);
-// Ensure the featureCompatibilityVersion is 3.6 so that the mongos can connect if it is version
-// 3.6.
-assert.commandWorked(configRS.getPrimary().adminCommand({setFeatureCompatibilityVersion: "3.6"}));
+// Ensure the featureCompatibilityVersion is lastStableFCV so that the mongos can connect if it is
+// binary version last-stable.
+assert.commandWorked(
+ configRS.getPrimary().adminCommand({setFeatureCompatibilityVersion: lastStableFCV}));
jsTestLog("getting mongos");
var e;
diff --git a/jstests/sharding/shard_aware_init.js b/jstests/sharding/shard_aware_init.js
index 8a0cf9cb217..386755dd9b2 100644
--- a/jstests/sharding/shard_aware_init.js
+++ b/jstests/sharding/shard_aware_init.js
@@ -138,12 +138,6 @@
var mongod = MongoRunner.runMongod({shardsvr: ''});
- // This mongod is started with --shardsvr and terminated prior to addShard being called,
- // hence before the featureCompatibilityVersion document is created, so we need to manually
- // call setFeatureCompatibilityVersion because SERVER-29452 causes mongod to fail to start up
- // without such a document.
- assert.commandWorked(mongod.getDB("admin").runCommand({setFeatureCompatibilityVersion: "3.6"}));
-
runTest(mongod, st.configRS.getURL());
MongoRunner.stopMongod(mongod);
@@ -151,10 +145,6 @@
var replTest = new ReplSetTest({nodes: 1});
replTest.startSet({shardsvr: ''});
replTest.initiate();
- // Again, we need to manually call setFeatureCompatibilityVersion because of SERVER-29452.
- assert.commandWorked(
- replTest.getPrimary().getDB("admin").runCommand({setFeatureCompatibilityVersion: "3.6"}));
- replTest.awaitReplication();
runTest(replTest.getPrimary(), st.configRS.getURL());
diff --git a/jstests/sharding/shard_aware_init_secondaries.js b/jstests/sharding/shard_aware_init_secondaries.js
index b20d87b2d17..009610f47a6 100644
--- a/jstests/sharding/shard_aware_init_secondaries.js
+++ b/jstests/sharding/shard_aware_init_secondaries.js
@@ -20,14 +20,6 @@
var priConn = replTest.getPrimary();
- // This replica set is started with --shardsvr and terminated prior to addShard being called,
- // hence before the featureCompatibilityVersion document is created, so we need to manually
- // call setFeatureCompatibilityVersion because SERVER-29452 causes mongod to fail to start up
- // without such a document.
- assert.commandWorked(
- priConn.getDB("admin").runCommand({setFeatureCompatibilityVersion: "3.6"}));
- replTest.awaitReplication();
-
var configConnStr = st.configRS.getURL();
var shardIdentityDoc = {
diff --git a/jstests/sharding/shard_identity_rollback.js b/jstests/sharding/shard_identity_rollback.js
index 3e64b120ad8..ca862e22fd7 100644
--- a/jstests/sharding/shard_identity_rollback.js
+++ b/jstests/sharding/shard_identity_rollback.js
@@ -24,12 +24,6 @@
// the other nodes once the primary is killed.
replTest.awaitSecondaryNodes();
- // This replica set is started with --shardsvr and terminated prior to addShard being called,
- // hence before the featureCompatibilityVersion document is created, so we need to manually
- // call setFeatureCompatibilityVersion because SERVER-29452 causes mongod to fail to start up
- // without such a document.
- assert.commandWorked(
- priConn.getDB("admin").runCommand({setFeatureCompatibilityVersion: "3.6"}));
replTest.awaitReplication();
stopServerReplication(secondaries);
diff --git a/src/mongo/db/catalog/coll_mod.cpp b/src/mongo/db/catalog/coll_mod.cpp
index 5775c04d4e1..4ef185fde2c 100644
--- a/src/mongo/db/catalog/coll_mod.cpp
+++ b/src/mongo/db/catalog/coll_mod.cpp
@@ -416,7 +416,7 @@ Status _collModInternal(OperationContext* opCtx,
cce->addUUID(opCtx, uuid.get(), coll);
} else if (!uuid && coll->uuid() &&
serverGlobalParams.featureCompatibility.getVersion() <
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) {
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36) {
log() << "Removing UUID " << coll->uuid().get().toString() << " from collection "
<< coll->ns();
CollectionCatalogEntry* cce = coll->getCatalogEntry();
diff --git a/src/mongo/db/catalog/database_impl.cpp b/src/mongo/db/catalog/database_impl.cpp
index d81fcef249e..7206621a5f5 100644
--- a/src/mongo/db/catalog/database_impl.cpp
+++ b/src/mongo/db/catalog/database_impl.cpp
@@ -772,16 +772,13 @@ Collection* DatabaseImpl::createCollection(OperationContext* opCtx,
CollectionOptions optionsWithUUID = options;
bool generatedUUID = false;
- if (enableCollectionUUIDs && !optionsWithUUID.uuid &&
- serverGlobalParams.featureCompatibility.isSchemaVersion36()) {
+ if (!optionsWithUUID.uuid) {
auto coordinator = repl::ReplicationCoordinator::get(opCtx);
- bool fullyUpgraded = serverGlobalParams.featureCompatibility.getVersion() >=
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36;
bool canGenerateUUID =
(coordinator->getReplicationMode() != repl::ReplicationCoordinator::modeReplSet) ||
coordinator->canAcceptWritesForDatabase(opCtx, nss.db()) || nss.isSystemDotProfile();
- if (fullyUpgraded && !canGenerateUUID) {
+ if (!canGenerateUUID) {
std::string msg = str::stream() << "Attempted to create a new collection " << nss.ns()
<< " without a UUID";
severe() << msg;
diff --git a/src/mongo/db/catalog/index_spec_validate_test.cpp b/src/mongo/db/catalog/index_spec_validate_test.cpp
index 471f1a525ca..9af8fa54b01 100644
--- a/src/mongo/db/catalog/index_spec_validate_test.cpp
+++ b/src/mongo/db/catalog/index_spec_validate_test.cpp
@@ -401,7 +401,7 @@ TEST(IndexSpecValidateTest, AcceptsIndexVersionV1) {
TEST(IndexSpecValidateTest, AcceptsIndexVersionV2Unique) {
ServerGlobalParams::FeatureCompatibility featureCompatibility;
featureCompatibility.setVersion(
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36);
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40);
auto result = validateIndexSpec(kDefaultOpCtx,
BSON("key" << BSON("field" << 1) << "name"
@@ -420,6 +420,7 @@ TEST(IndexSpecValidateTest, AcceptsIndexVersionV2Unique) {
<< "v"
<< 3)),
sorted(result.getValue()));
+ featureCompatibility.reset();
}
TEST(IndexSpecValidateTest, ReturnsAnErrorIfCollationIsNotAnObject) {
ASSERT_EQ(ErrorCodes::TypeMismatch,
diff --git a/src/mongo/db/commands/dbcheck.cpp b/src/mongo/db/commands/dbcheck.cpp
index 08b062718d7..d0c1ee0673e 100644
--- a/src/mongo/db/commands/dbcheck.cpp
+++ b/src/mongo/db/commands/dbcheck.cpp
@@ -534,8 +534,6 @@ public:
const std::string& dbname,
const BSONObj& cmdObj,
BSONObjBuilder& result) {
- uassert(40614, "dbCheck requires FeatureCompatibilityVersion >= 3.6", _hasCorrectFCV());
-
auto job = getRun(opCtx, dbname, cmdObj);
try {
(new DbCheckJob(dbname, std::move(job)))->go();
@@ -547,12 +545,6 @@ public:
result.append("ok", true);
return true;
}
-
-private:
- bool _hasCorrectFCV(void) {
- return serverGlobalParams.featureCompatibility.getVersion() >=
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36;
- }
};
MONGO_INITIALIZER(RegisterDbCheckCmd)(InitializerContext* context) {
diff --git a/src/mongo/db/commands/feature_compatibility_version.cpp b/src/mongo/db/commands/feature_compatibility_version.cpp
index e8147b511fc..60014e63785 100644
--- a/src/mongo/db/commands/feature_compatibility_version.cpp
+++ b/src/mongo/db/commands/feature_compatibility_version.cpp
@@ -166,7 +166,7 @@ StatusWith<ServerGlobalParams::FeatureCompatibility::Version> FeatureCompatibili
<< feature_compatibility_version::kDochubLink
<< ".");
} else {
- version = ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36;
+ version = ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36;
}
} else if (versionString == FeatureCompatibilityVersionCommandParser::kVersion40) {
if (targetVersionString == FeatureCompatibilityVersionCommandParser::kVersion40 ||
@@ -276,7 +276,6 @@ void FeatureCompatibilityVersion::setIfCleanStartup(OperationContext* opCtx,
// We then insert the featureCompatibilityVersion document into the "admin.system.version"
// collection. The server parameter will be updated on commit by the op observer.
- // TODO(SERVER-32597): If storeUpgradeVersion is true, kVersion38 should be stored.
uassertStatusOK(storageInterface->insertDocument(
opCtx,
nss,
@@ -284,7 +283,7 @@ void FeatureCompatibilityVersion::setIfCleanStartup(OperationContext* opCtx,
BSON("_id" << FeatureCompatibilityVersion::kParameterName
<< FeatureCompatibilityVersion::kVersionField
<< (storeUpgradeVersion
- ? FeatureCompatibilityVersionCommandParser::kVersion36
+ ? FeatureCompatibilityVersionCommandParser::kVersion40
: FeatureCompatibilityVersionCommandParser::kVersion36)),
Timestamp()},
repl::OpTime::kUninitializedTerm)); // No timestamp or term because this write is not
@@ -328,7 +327,7 @@ void FeatureCompatibilityVersion::onInsertOrUpdate(OperationContext* opCtx, cons
// Close all incoming connections from internal clients with binary versions lower than
// ours. It would be desirable to close all outgoing connections to servers with lower
// binary version, but it is not currently possible.
- if (newVersion != ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo34) {
+ if (newVersion != ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36) {
opCtx->getServiceContext()->getServiceEntryPoint()->endAllSessions(
transport::Session::kLatestVersionInternalClientKeepOpen |
transport::Session::kExternalClientKeepOpen);
@@ -357,7 +356,7 @@ void FeatureCompatibilityVersion::onDropCollection(OperationContext* opCtx) {
<< FeatureCompatibilityVersionCommandParser::kVersion36;
opCtx->recoveryUnit()->onCommit([]() {
serverGlobalParams.featureCompatibility.setVersion(
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36);
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36);
updateMinWireVersion();
});
}
@@ -372,7 +371,7 @@ void FeatureCompatibilityVersion::updateMinWireVersion() {
spec.incomingInternalClient.minWireVersion = LATEST_WIRE_VERSION;
spec.outgoing.minWireVersion = LATEST_WIRE_VERSION;
return;
- case ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36:
+ case ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36:
case ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo36:
case ServerGlobalParams::FeatureCompatibility::Version::kDowngradingTo34:
spec.incomingInternalClient.minWireVersion = LATEST_WIRE_VERSION - 1;
@@ -471,7 +470,7 @@ public:
FeatureCompatibilityVersion::kTargetVersionField,
FeatureCompatibilityVersionCommandParser::kVersion36);
return;
- case ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36:
+ case ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36:
featureCompatibilityVersionBuilder.append(
FeatureCompatibilityVersion::kVersionField,
FeatureCompatibilityVersionCommandParser::kVersion36);
diff --git a/src/mongo/db/commands/feature_compatibility_version.h b/src/mongo/db/commands/feature_compatibility_version.h
index 45a020c4762..aab764f7ea9 100644
--- a/src/mongo/db/commands/feature_compatibility_version.h
+++ b/src/mongo/db/commands/feature_compatibility_version.h
@@ -81,7 +81,7 @@ public:
return FeatureCompatibilityVersionCommandParser::kVersionUpgradingTo36;
case ServerGlobalParams::FeatureCompatibility::Version::kDowngradingTo34:
return FeatureCompatibilityVersionCommandParser::kVersionDowngradingTo34;
- case ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36:
+ case ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36:
return FeatureCompatibilityVersionCommandParser::kVersion36;
case ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo40:
return FeatureCompatibilityVersionCommandParser::kVersionUpgradingTo40;
diff --git a/src/mongo/db/commands/feature_compatibility_version_command_parser.h b/src/mongo/db/commands/feature_compatibility_version_command_parser.h
index 9097f16385e..0f19576765e 100644
--- a/src/mongo/db/commands/feature_compatibility_version_command_parser.h
+++ b/src/mongo/db/commands/feature_compatibility_version_command_parser.h
@@ -39,7 +39,7 @@ template <typename T>
class StatusWith;
namespace feature_compatibility_version {
-constexpr StringData kDochubLink = "http://dochub.mongodb.org/core/3.6-feature-compatibility"_sd;
+constexpr StringData kDochubLink = "http://dochub.mongodb.org/core/4.0-feature-compatibility"_sd;
} // namespace feature_compatibility_version
class FeatureCompatibilityVersionCommandParser {
diff --git a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
index ca26df5dcff..e9b510d4120 100644
--- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
+++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
@@ -198,7 +198,7 @@ public:
ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo40);
if (actualVersion ==
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) {
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36) {
// Set the client's last opTime to the system last opTime so no-ops wait for
// writeConcern.
repl::ReplClientInfo::forClient(opCtx->getClient())
diff --git a/src/mongo/db/commands/validate.cpp b/src/mongo/db/commands/validate.cpp
index 7e021018029..eb7a3175ee9 100644
--- a/src/mongo/db/commands/validate.cpp
+++ b/src/mongo/db/commands/validate.cpp
@@ -210,7 +210,8 @@ public:
ServerGlobalParams::FeatureCompatibility::Version version =
serverGlobalParams.featureCompatibility.getVersion();
- if (version >= ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) {
+ if (version >=
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36) {
// All collections must have a UUID.
if (!opts.uuid) {
results.errors.push_back(str::stream() << "UUID missing on collection "
@@ -218,15 +219,6 @@ public:
<< " but SchemaVersion=3.6");
results.valid = false;
}
- } else if (version ==
- ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo34) {
- // All collections must not have a UUID.
- if (opts.uuid) {
- results.errors.push_back(str::stream() << "UUID present in collection "
- << nss.ns()
- << " but SchemaVersion=3.4");
- results.valid = false;
- }
}
}
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index e50cf0ecfc8..24a7ef71828 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -830,11 +830,9 @@ void shutdownTask() {
opCtx = uniqueOpCtx.get();
}
- // TODO: Upgrade this check so that this block only runs when (FCV != kFullyUpgradedTo38).
- // See SERVER-32589.
if (serverGlobalParams.featureCompatibility.getVersion() !=
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) {
- // If we are in fCV 3.6, drop the 'checkpointTimestamp' collection so if we downgrade
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40) {
+ // If we are in latest fCV, drop the 'checkpointTimestamp' collection so if we downgrade
// and then upgrade again, we do not trust a stale 'checkpointTimestamp'.
log(LogComponent::kReplication)
<< "shutdown: removing checkpointTimestamp collection...";
diff --git a/src/mongo/db/repl/idempotency_test.cpp b/src/mongo/db/repl/idempotency_test.cpp
index 56866630784..a1e2eb215c2 100644
--- a/src/mongo/db/repl/idempotency_test.cpp
+++ b/src/mongo/db/repl/idempotency_test.cpp
@@ -192,9 +192,7 @@ void RandomizedIdempotencyTest::runIdempotencyTestCase() {
}
}
-TEST_F(RandomizedIdempotencyTest, CheckUpdateSequencesAreIdempotentWhenFCV36) {
- serverGlobalParams.featureCompatibility.setVersion(
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36);
+TEST_F(RandomizedIdempotencyTest, CheckUpdateSequencesAreIdempotent) {
runIdempotencyTestCase();
}
diff --git a/src/mongo/db/repl/initial_syncer.cpp b/src/mongo/db/repl/initial_syncer.cpp
index ed6a2086060..5e5cb8635c7 100644
--- a/src/mongo/db/repl/initial_syncer.cpp
+++ b/src/mongo/db/repl/initial_syncer.cpp
@@ -680,8 +680,10 @@ void InitialSyncer::_fcvFetcherCallback(const StatusWith<Fetcher::QueryResponse>
}
auto version = fCVParseSW.getValue();
- if (version > ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo34 &&
- version < ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) {
+
+ // Changing the featureCompatibilityVersion during initial sync is unsafe.
+ if (version > ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36 &&
+ version < ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40) {
onCompletionGuard->setResultAndCancelRemainingWork_inlock(
lock,
Status(ErrorCodes::IncompatibleServerVersion,
diff --git a/src/mongo/db/repl/initial_syncer_test.cpp b/src/mongo/db/repl/initial_syncer_test.cpp
index 2d959fb8a5c..91d79e87e72 100644
--- a/src/mongo/db/repl/initial_syncer_test.cpp
+++ b/src/mongo/db/repl/initial_syncer_test.cpp
@@ -1542,24 +1542,24 @@ TEST_F(InitialSyncerTest,
TEST_F(InitialSyncerTest,
InitialSyncerReturnsIncompatibleServerVersionWhenFCVFetcherReturnsUpgradeTargetVersion) {
auto docs = {BSON("_id" << FeatureCompatibilityVersion::kParameterName << "version"
- << FeatureCompatibilityVersionCommandParser::kVersion34
+ << FeatureCompatibilityVersionCommandParser::kVersion36
<< "targetVersion"
- << FeatureCompatibilityVersionCommandParser::kVersion36)};
+ << FeatureCompatibilityVersionCommandParser::kVersion40)};
runInitialSyncWithBadFCVResponse(docs, ErrorCodes::IncompatibleServerVersion);
}
TEST_F(InitialSyncerTest,
InitialSyncerReturnsIncompatibleServerVersionWhenFCVFetcherReturnsDowngradeTargetVersion) {
auto docs = {BSON("_id" << FeatureCompatibilityVersion::kParameterName << "version"
- << FeatureCompatibilityVersionCommandParser::kVersion34
+ << FeatureCompatibilityVersionCommandParser::kVersion36
<< "targetVersion"
- << FeatureCompatibilityVersionCommandParser::kVersion34)};
+ << FeatureCompatibilityVersionCommandParser::kVersion36)};
runInitialSyncWithBadFCVResponse(docs, ErrorCodes::IncompatibleServerVersion);
}
TEST_F(InitialSyncerTest, InitialSyncerReturnsBadValueWhenFCVFetcherReturnsNoVersion) {
auto docs = {BSON("_id" << FeatureCompatibilityVersion::kParameterName << "targetVersion"
- << FeatureCompatibilityVersionCommandParser::kVersion34)};
+ << FeatureCompatibilityVersionCommandParser::kVersion36)};
runInitialSyncWithBadFCVResponse(docs, ErrorCodes::BadValue);
}
@@ -1582,7 +1582,7 @@ TEST_F(InitialSyncerTest, InitialSyncerSucceedsWhenFCVFetcherReturnsOldVersion)
processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)});
auto docs = {BSON("_id" << FeatureCompatibilityVersion::kParameterName << "version"
- << FeatureCompatibilityVersionCommandParser::kVersion34)};
+ << FeatureCompatibilityVersionCommandParser::kVersion36)};
processSuccessfulFCVFetcherResponse(docs);
ASSERT_TRUE(net->hasReadyRequests());
}
diff --git a/src/mongo/db/repl/sync_tail_test_fixture.cpp b/src/mongo/db/repl/sync_tail_test_fixture.cpp
index 4953a93ec41..3109ff4da05 100644
--- a/src/mongo/db/repl/sync_tail_test_fixture.cpp
+++ b/src/mongo/db/repl/sync_tail_test_fixture.cpp
@@ -94,8 +94,11 @@ void SyncTailTest::setUp() {
OplogApplication::Mode oplogApplicationMode) { return Status::OK(); };
_incOps = [this]() { _opsApplied++; };
+ // Initialize the featureCompatibilityVersion server parameter. This is necessary because this
+ // test fixture does not create a featureCompatibilityVersion document from which to initialize
+ // the server parameter.
serverGlobalParams.featureCompatibility.setVersion(
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36);
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40);
}
void SyncTailTest::tearDown() {
diff --git a/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp b/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp
index 7988dd87cdc..ec37ae9e83e 100644
--- a/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp
@@ -339,13 +339,13 @@ StatusWith<ShardType> ShardingCatalogManager::_validateHostAsShard(
<< " as a shard");
}
if (serverGlobalParams.featureCompatibility.getVersion() >
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) {
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36) {
// If FCV 4.0, or upgrading to / downgrading from, wire version must be LATEST.
invariant(maxWireVersion == WireVersion::LATEST_WIRE_VERSION);
} else if (serverGlobalParams.featureCompatibility.getVersion() >
ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo34 &&
serverGlobalParams.featureCompatibility.getVersion() <=
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) {
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36) {
// If FCV 3.6, or upgrading to / downgrading from, wire version must be v3.6
// LATEST_WIRE_VERSION or greater.
invariant(maxWireVersion >= WireVersion::LATEST_WIRE_VERSION - 1);
diff --git a/src/mongo/db/server_options.h b/src/mongo/db/server_options.h
index 478fdbab935..e0a34ddb39c 100644
--- a/src/mongo/db/server_options.h
+++ b/src/mongo/db/server_options.h
@@ -163,7 +163,7 @@ struct ServerGlobalParams {
* use the 3.6 format, and existing entries may have either the
* 3.4 or 3.6 format
*
- * kFullyUpgradedTo36
+ * kFullyDowngradedTo36
* (3.6, Unset): 3.6 features are available, and new and existing storage
* engine entries use the 3.6 format
*
@@ -176,9 +176,9 @@ struct ServerGlobalParams {
* (Unset, Unset): This is the case on startup before the fCV document is
* loaded into memory. isVersionInitialized() will return
* false, and getVersion() will return the default
- * (kFullyUpgradedTo36).
+ * (kFullyDowngradedTo36).
*
- * TODO: update this comment to 3.6/4.0 when FCV 3.4 is removed (SERVER-32597).
+ * TODO: update this comment to 3.6/4.0 when FCV 3.4 is removed (SERVER-33179).
*/
enum class Version {
// The order of these enums matter, higher upgrades having higher values, so that
@@ -188,7 +188,7 @@ struct ServerGlobalParams {
kFullyDowngradedTo34 = 1,
kDowngradingTo34 = 2,
kUpgradingTo36 = 3,
- kFullyUpgradedTo36 = 4,
+ kFullyDowngradedTo36 = 4,
kDowngradingTo36 = 5,
kUpgradingTo40 = 6,
kFullyUpgradedTo40 = 7,
@@ -208,7 +208,7 @@ struct ServerGlobalParams {
*/
const Version getVersion() const {
Version v = _version.load();
- return (v == Version::kUnsetDefault36Behavior) ? Version::kFullyUpgradedTo36 : v;
+ return (v == Version::kUnsetDefault36Behavior) ? Version::kFullyDowngradedTo36 : v;
}
void reset() {
@@ -221,7 +221,7 @@ struct ServerGlobalParams {
// This determines whether to give Collections UUIDs upon creation.
const bool isSchemaVersion36() {
- return (getVersion() >= Version::kFullyUpgradedTo36 ||
+ return (getVersion() >= Version::kFullyDowngradedTo36 ||
getVersion() == Version::kUpgradingTo36);
}
diff --git a/src/mongo/dbtests/dbtests.cpp b/src/mongo/dbtests/dbtests.cpp
index 77e1e4f5a48..3cf58407b53 100644
--- a/src/mongo/dbtests/dbtests.cpp
+++ b/src/mongo/dbtests/dbtests.cpp
@@ -130,7 +130,7 @@ int dbtestsMain(int argc, char** argv, char** envp) {
mongo::dbtests::initWireSpec();
mongo::runGlobalInitializersOrDie(argc, argv, envp);
serverGlobalParams.featureCompatibility.setVersion(
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36);
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40);
repl::ReplSettings replSettings;
replSettings.setOplogSizeBytes(10 * 1024 * 1024);
ServiceContext* service = getGlobalServiceContext();
diff --git a/src/mongo/s/commands/cluster_set_feature_compatibility_version_cmd.cpp b/src/mongo/s/commands/cluster_set_feature_compatibility_version_cmd.cpp
index 6897d50c498..ff753df8c69 100644
--- a/src/mongo/s/commands/cluster_set_feature_compatibility_version_cmd.cpp
+++ b/src/mongo/s/commands/cluster_set_feature_compatibility_version_cmd.cpp
@@ -41,15 +41,14 @@ namespace mongo {
namespace {
/**
- * Sets the minimum allowed version for the cluster. If it is 3.4, then shards should not use 3.6
- * features. Similarly, if 3.6, shards will not use 4.0 features.
+ * Sets the minimum allowed version for the cluster. If it is the last stable
+ * featureCompatibilityVersion, then shards will not use latest featureCompatibilityVersion
+ * features.
*
* Format:
* {
* setFeatureCompatibilityVersion: <string version>
* }
- *
- * TODO: update this comment when FCV 3.4 is removed (SERVER-32597).
*/
class SetFeatureCompatibilityVersionCmd : public BasicCommand {
public:
@@ -68,7 +67,7 @@ public:
}
std::string help() const override {
- // TODO: update this comment when FCV 3.4 is removed (SERVER-32597).
+ // TODO: update this comment when FCV 3.4 is removed (SERVER-33179).
return str::stream()
<< "Set the API version for the cluster. If set to \""
<< FeatureCompatibilityVersionCommandParser::kVersion34
diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp
index d4673afd1cc..c03b7a920df 100644
--- a/src/mongo/s/server.cpp
+++ b/src/mongo/s/server.cpp
@@ -524,12 +524,15 @@ MONGO_INITIALIZER_GENERAL(ForkServer, ("EndStartupOptionHandling"), ("default"))
return Status::OK();
}
-// We set the featureCompatibilityVersion to 3.6 in the mongos and rely on the shards to reject
-// usages of new features if their featureCompatibilityVersion is lower.
-MONGO_INITIALIZER_WITH_PREREQUISITES(SetFeatureCompatibilityVersion36, ("EndStartupOptionStorage"))
+// Initialize the featureCompatibilityVersion server parameter since mongos does not have a
+// featureCompatibilityVersion document from which to initialize the parameter. The parameter is set
+// to the latest version because there is no feature gating that currently occurs at the mongos
+// level. The shards are responsible for rejecting usages of new features if their
+// featureCompatibilityVersion is lower.
+MONGO_INITIALIZER_WITH_PREREQUISITES(SetFeatureCompatibilityVersion40, ("EndStartupOptionStorage"))
(InitializerContext* context) {
serverGlobalParams.featureCompatibility.setVersion(
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36);
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40);
return Status::OK();
}
diff --git a/src/mongo/shell/dbshell.cpp b/src/mongo/shell/dbshell.cpp
index fea0aefc995..eef4859804a 100644
--- a/src/mongo/shell/dbshell.cpp
+++ b/src/mongo/shell/dbshell.cpp
@@ -92,12 +92,15 @@ static AtomicBool atPrompt(false); // can eval before getting to prompt
namespace {
const auto kDefaultMongoURL = "mongodb://127.0.0.1:27017"_sd;
-// We set the featureCompatibilityVersion to 3.6 in the mongo shell and rely on the server to reject
-// usages of new features if its featureCompatibilityVersion is lower.
-MONGO_INITIALIZER_WITH_PREREQUISITES(SetFeatureCompatibilityVersion36, ("EndStartupOptionSetup"))
+// Initialize the featureCompatibilityVersion server parameter since the mongo shell does not have a
+// featureCompatibilityVersion document from which to initialize the parameter. The parameter is set
+// to the latest version because there is no feature gating that currently occurs at the mongo shell
+// level. The server is responsible for rejecting usages of new features if its
+// featureCompatibilityVersion is lower.
+MONGO_INITIALIZER_WITH_PREREQUISITES(SetFeatureCompatibilityVersion40, ("EndStartupOptionSetup"))
(InitializerContext* context) {
mongo::serverGlobalParams.featureCompatibility.setVersion(
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36);
+ ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40);
return Status::OK();
}
const auto kAuthParam = "authSource"s;