summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorMaria van Keulen <maria@mongodb.com>2018-02-08 18:15:57 -0500
committerMaria van Keulen <maria@mongodb.com>2018-02-21 10:28:45 -0500
commit6df7ca5841e2ffa40354975323e410796d952382 (patch)
treeec090fec1d80dc979b4e8439a848d932c4a5b4e9 /src/mongo
parenta3f077342401e97df986c66792eb099978301631 (diff)
downloadmongo-6df7ca5841e2ffa40354975323e410796d952382.tar.gz
SERVER-32597 Bump generic fCV references
Diffstat (limited to 'src/mongo')
-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
20 files changed, 60 insertions, 73 deletions
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;