diff options
author | Blake Oler <blake.oler@mongodb.com> | 2018-06-21 14:55:01 -0400 |
---|---|---|
committer | Blake Oler <blake.oler@mongodb.com> | 2018-07-02 10:50:53 -0400 |
commit | 53a34c4f01d6b18df4c4800df9a72b1eff07fb6a (patch) | |
tree | 59dcf1abafee02e14dc8d1d51c43c0965bcaf29d /src/mongo | |
parent | b3a542545c7367f96d57cab5e89dc389748c0e2c (diff) | |
download | mongo-53a34c4f01d6b18df4c4800df9a72b1eff07fb6a.tar.gz |
SERVER-35655 Update FCV constants throughout server code.
SERVER-35169 Bump wire protocol version for 4.2.
SERVER-35752 Ensure tests that rely on FCV pass after updating FCV constants.
SERVER-35163 Unblacklist tests that expect FCV version to differ between "last-stable" and "latest."
SERVER-34984 Update major_version_upgrade.js to call setFCV to the latest FCV.
SERVER-35656 Ensure a 4.0 mongos crashes upon attempting to connect to an FCV 4.2 cluster.
SERVER-35404 Re-enable the sharding_last_stable_mongos_and_mixed_shards suite.
Diffstat (limited to 'src/mongo')
32 files changed, 228 insertions, 304 deletions
diff --git a/src/mongo/client/dbclient_connection.cpp b/src/mongo/client/dbclient_connection.cpp index 62bfe45726d..dbabb5ebc82 100644 --- a/src/mongo/client/dbclient_connection.cpp +++ b/src/mongo/client/dbclient_connection.cpp @@ -58,7 +58,6 @@ #include "mongo/executor/remote_command_response.h" #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/rpc/metadata/client_metadata.h" -#include "mongo/s/is_mongos.h" #include "mongo/s/stale_exception.h" #include "mongo/stdx/functional.h" #include "mongo/stdx/memory.h" @@ -66,7 +65,6 @@ #include "mongo/util/assert_util.h" #include "mongo/util/concurrency/mutex.h" #include "mongo/util/debug_util.h" -#include "mongo/util/fail_point_service.h" #include "mongo/util/log.h" #include "mongo/util/net/socket_exception.h" #include "mongo/util/net/socket_utils.h" @@ -85,8 +83,6 @@ using std::string; namespace { -MONGO_FAIL_POINT_DEFINE(turnOffDBClientIncompatibleWithUpgradedServerCheck); - /** * RAII class to force usage of OP_QUERY on a connection. */ @@ -248,16 +244,6 @@ Status DBClientConnection::connect(const HostAndPort& serverAddress, StringData auto validateStatus = rpc::validateWireVersion(WireSpec::instance().outgoing, swProtocolSet.getValue().version); if (!validateStatus.isOK()) { - if (mongo::isMongos() && validateStatus == ErrorCodes::IncompatibleWithUpgradedServer && - !MONGO_FAIL_POINT(turnOffDBClientIncompatibleWithUpgradedServerCheck)) { - severe() << "This mongos server must be upgraded. It is attempting to communicate with " - "an upgraded cluster with which it is incompatible. Error: '" - << validateStatus.toString() - << "' Crashing in order to bring attention to the incompatibility, rather " - "than erroring endlessly."; - fassertNoTrace(50709, false); - } - warning() << "remote host has incompatible wire version: " << validateStatus; return validateStatus; diff --git a/src/mongo/db/catalog/coll_mod.cpp b/src/mongo/db/catalog/coll_mod.cpp index 86e955af2a8..14c1ba4f3c3 100644 --- a/src/mongo/db/catalog/coll_mod.cpp +++ b/src/mongo/db/catalog/coll_mod.cpp @@ -178,14 +178,14 @@ StatusWith<CollModRequest> parseCollModRequest(OperationContext* opCtx, // Save this to a variable to avoid reading the atomic variable multiple times. const auto currentFCV = serverGlobalParams.featureCompatibility.getVersion(); - // If the feature compatibility version is not 4.0, and we are validating features as - // master, ban the use of new agg features introduced in 4.0 to prevent them from being + // If the feature compatibility version is not 4.2, and we are validating features as + // master, ban the use of new agg features introduced in 4.2 to prevent them from being // persisted in the catalog. boost::optional<ServerGlobalParams::FeatureCompatibility::Version> maxFeatureCompatibilityVersion; if (serverGlobalParams.validateFeaturesAsMaster.load() && currentFCV != - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40) { + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42) { maxFeatureCompatibilityVersion = currentFCV; } auto statusW = coll->parseValidator(opCtx, diff --git a/src/mongo/db/catalog/database_impl.cpp b/src/mongo/db/catalog/database_impl.cpp index 6d5ea4b0552..5d4ed394e7c 100644 --- a/src/mongo/db/catalog/database_impl.cpp +++ b/src/mongo/db/catalog/database_impl.cpp @@ -1000,11 +1000,11 @@ MONGO_REGISTER_SHIM(Database::userCreateNS) // Save this to a variable to avoid reading the atomic variable multiple times. const auto currentFCV = serverGlobalParams.featureCompatibility.getVersion(); - // If the feature compatibility version is not 4.0, and we are validating features as - // master, ban the use of new agg features introduced in 4.0 to prevent them from being + // If the feature compatibility version is not 4.2, and we are validating features as + // master, ban the use of new agg features introduced in 4.2 to prevent them from being // persisted in the catalog. if (serverGlobalParams.validateFeaturesAsMaster.load() && - currentFCV != ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40) { + currentFCV != ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42) { expCtx->maxFeatureCompatibilityVersion = currentFCV; } auto statusWithMatcher = diff --git a/src/mongo/db/commands/feature_compatibility_version.cpp b/src/mongo/db/commands/feature_compatibility_version.cpp index c185504b6cc..740105a05e7 100644 --- a/src/mongo/db/commands/feature_compatibility_version.cpp +++ b/src/mongo/db/commands/feature_compatibility_version.cpp @@ -66,9 +66,9 @@ void FeatureCompatibilityVersion::setTargetUpgrade(OperationContext* opCtx) { // Sets both 'version' and 'targetVersion' fields. _runUpdateCommand(opCtx, [](auto updateMods) { updateMods.append(FeatureCompatibilityVersionParser::kVersionField, - FeatureCompatibilityVersionParser::kVersion36); - updateMods.append(FeatureCompatibilityVersionParser::kTargetVersionField, FeatureCompatibilityVersionParser::kVersion40); + updateMods.append(FeatureCompatibilityVersionParser::kTargetVersionField, + FeatureCompatibilityVersionParser::kVersion42); }); } @@ -76,9 +76,9 @@ void FeatureCompatibilityVersion::setTargetDowngrade(OperationContext* opCtx) { // Sets both 'version' and 'targetVersion' fields. _runUpdateCommand(opCtx, [](auto updateMods) { updateMods.append(FeatureCompatibilityVersionParser::kVersionField, - FeatureCompatibilityVersionParser::kVersion36); + FeatureCompatibilityVersionParser::kVersion40); updateMods.append(FeatureCompatibilityVersionParser::kTargetVersionField, - FeatureCompatibilityVersionParser::kVersion36); + FeatureCompatibilityVersionParser::kVersion40); }); } @@ -121,8 +121,8 @@ void FeatureCompatibilityVersion::setIfCleanStartup(OperationContext* opCtx, repl::TimestampedBSONObj{ BSON("_id" << FeatureCompatibilityVersionParser::kParameterName << FeatureCompatibilityVersionParser::kVersionField - << (storeUpgradeVersion ? FeatureCompatibilityVersionParser::kVersion40 - : FeatureCompatibilityVersionParser::kVersion36)), + << (storeUpgradeVersion ? FeatureCompatibilityVersionParser::kVersion42 + : FeatureCompatibilityVersionParser::kVersion40)), Timestamp()}, repl::OpTime::kUninitializedTerm)); // No timestamp or term because this write is not // replicated. @@ -163,7 +163,7 @@ void FeatureCompatibilityVersion::onInsertOrUpdate(OperationContext* opCtx, cons serverGlobalParams.featureCompatibility.setVersion(newVersion); updateMinWireVersion(); - if (newVersion != ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36) { + if (newVersion != ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo40) { // Close all incoming connections from internal clients with binary versions lower than // ours. opCtx->getServiceContext()->getServiceEntryPoint()->endAllSessions( @@ -174,9 +174,8 @@ void FeatureCompatibilityVersion::onInsertOrUpdate(OperationContext* opCtx, cons .dropConnections(transport::Session::kKeepOpen); } - if (newVersion != ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40) { - // Transactions are only allowed when the featureCompatibilityVersion is 4.0, so abort - // any open transactions when downgrading featureCompatibilityVersion. + if (newVersion != ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42) { + // Abort all open transactions when downgrading the featureCompatibilityVersion. SessionKiller::Matcher matcherAllSessions( KillAllSessionsByPatternSet{makeKillAllSessionsByPattern(opCtx)}); killSessionsLocalKillTransactions(opCtx, matcherAllSessions); @@ -188,17 +187,17 @@ void FeatureCompatibilityVersion::updateMinWireVersion() { WireSpec& spec = WireSpec::instance(); switch (serverGlobalParams.featureCompatibility.getVersion()) { - case ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40: - case ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo40: - case ServerGlobalParams::FeatureCompatibility::Version::kDowngradingTo36: + case ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42: + case ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo42: + case ServerGlobalParams::FeatureCompatibility::Version::kDowngradingTo40: spec.incomingInternalClient.minWireVersion = LATEST_WIRE_VERSION; spec.outgoing.minWireVersion = LATEST_WIRE_VERSION; return; - case ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36: + case ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo40: spec.incomingInternalClient.minWireVersion = LATEST_WIRE_VERSION - 1; spec.outgoing.minWireVersion = LATEST_WIRE_VERSION - 1; return; - case ServerGlobalParams::FeatureCompatibility::Version::kUnsetDefault36Behavior: + case ServerGlobalParams::FeatureCompatibility::Version::kUnsetDefault40Behavior: // getVersion() does not return this value. MONGO_UNREACHABLE; } @@ -207,14 +206,14 @@ void FeatureCompatibilityVersion::updateMinWireVersion() { void FeatureCompatibilityVersion::_validateVersion(StringData version) { uassert(40284, str::stream() << "featureCompatibilityVersion must be '" - << FeatureCompatibilityVersionParser::kVersion40 + << FeatureCompatibilityVersionParser::kVersion42 << "' or '" - << FeatureCompatibilityVersionParser::kVersion36 + << FeatureCompatibilityVersionParser::kVersion40 << "'. See " << feature_compatibility_version_documentation::kCompatibilityLink << ".", - version == FeatureCompatibilityVersionParser::kVersion40 || - version == FeatureCompatibilityVersionParser::kVersion36); + version == FeatureCompatibilityVersionParser::kVersion42 || + version == FeatureCompatibilityVersionParser::kVersion40); } void FeatureCompatibilityVersion::_runUpdateCommand(OperationContext* opCtx, @@ -267,33 +266,33 @@ public: << " is not yet known.", serverGlobalParams.featureCompatibility.isVersionInitialized()); switch (serverGlobalParams.featureCompatibility.getVersion()) { - case ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40: + case ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42: featureCompatibilityVersionBuilder.append( FeatureCompatibilityVersionParser::kVersionField, - FeatureCompatibilityVersionParser::kVersion40); + FeatureCompatibilityVersionParser::kVersion42); return; - case ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo40: + case ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo42: featureCompatibilityVersionBuilder.append( FeatureCompatibilityVersionParser::kVersionField, - FeatureCompatibilityVersionParser::kVersion36); + FeatureCompatibilityVersionParser::kVersion40); featureCompatibilityVersionBuilder.append( FeatureCompatibilityVersionParser::kTargetVersionField, - FeatureCompatibilityVersionParser::kVersion40); + FeatureCompatibilityVersionParser::kVersion42); return; - case ServerGlobalParams::FeatureCompatibility::Version::kDowngradingTo36: + case ServerGlobalParams::FeatureCompatibility::Version::kDowngradingTo40: featureCompatibilityVersionBuilder.append( FeatureCompatibilityVersionParser::kVersionField, - FeatureCompatibilityVersionParser::kVersion36); + FeatureCompatibilityVersionParser::kVersion40); featureCompatibilityVersionBuilder.append( FeatureCompatibilityVersionParser::kTargetVersionField, - FeatureCompatibilityVersionParser::kVersion36); + FeatureCompatibilityVersionParser::kVersion40); return; - case ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36: + case ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo40: featureCompatibilityVersionBuilder.append( FeatureCompatibilityVersionParser::kVersionField, - FeatureCompatibilityVersionParser::kVersion36); + FeatureCompatibilityVersionParser::kVersion40); return; - case ServerGlobalParams::FeatureCompatibility::Version::kUnsetDefault36Behavior: + case ServerGlobalParams::FeatureCompatibility::Version::kUnsetDefault40Behavior: // getVersion() does not return this value. MONGO_UNREACHABLE; } diff --git a/src/mongo/db/commands/feature_compatibility_version.h b/src/mongo/db/commands/feature_compatibility_version.h index e41530edddd..bf6ffab1dbe 100644 --- a/src/mongo/db/commands/feature_compatibility_version.h +++ b/src/mongo/db/commands/feature_compatibility_version.h @@ -57,21 +57,21 @@ public: static Lock::ResourceMutex fcvLock; /** - * Records intent to perform a 3.6 -> 4.0 upgrade by updating the on-disk feature - * compatibility version document to have 'version'=3.6, 'targetVersion'=4.0. + * Records intent to perform a 4.0 -> 4.2 upgrade by updating the on-disk feature + * compatibility version document to have 'version'=4.0, 'targetVersion'=4.2. * Should be called before schemas are modified. */ static void setTargetUpgrade(OperationContext* opCtx); /** - * Records intent to perform a 4.0 -> 3.6 downgrade by updating the on-disk feature - * compatibility version document to have 'version'=3.6, 'targetVersion'=3.6. + * Records intent to perform a 4.2 -> 4.0 downgrade by updating the on-disk feature + * compatibility version document to have 'version'=4.0, 'targetVersion'=4.0. * Should be called before schemas are modified. */ static void setTargetDowngrade(OperationContext* opCtx); /** - * Records the completion of a 3.6 <-> 4.0 upgrade or downgrade by updating the on-disk feature + * Records the completion of a 4.0 <-> 4.2 upgrade or downgrade by updating the on-disk feature * compatibility version document to have 'version'=version and unsetting the 'targetVersion' * field. * Should be called after schemas are modified. diff --git a/src/mongo/db/commands/feature_compatibility_version_command_parser.cpp b/src/mongo/db/commands/feature_compatibility_version_command_parser.cpp index 2e15ce22a91..65ca5652552 100644 --- a/src/mongo/db/commands/feature_compatibility_version_command_parser.cpp +++ b/src/mongo/db/commands/feature_compatibility_version_command_parser.cpp @@ -81,13 +81,13 @@ StatusWith<std::string> FeatureCompatibilityVersionCommandParser::extractVersion const std::string version = versionElem.String(); - if (version != FeatureCompatibilityVersionParser::kVersion40 && - version != FeatureCompatibilityVersionParser::kVersion36) { + if (version != FeatureCompatibilityVersionParser::kVersion42 && + version != FeatureCompatibilityVersionParser::kVersion40) { return {ErrorCodes::BadValue, str::stream() << "Invalid command argument. Expected '" - << FeatureCompatibilityVersionParser::kVersion40 + << FeatureCompatibilityVersionParser::kVersion42 << "' or '" - << FeatureCompatibilityVersionParser::kVersion36 + << FeatureCompatibilityVersionParser::kVersion40 << "', found " << version << " in: " diff --git a/src/mongo/db/commands/feature_compatibility_version_parser.cpp b/src/mongo/db/commands/feature_compatibility_version_parser.cpp index 30eeca1bf4c..49b72b0ffc7 100644 --- a/src/mongo/db/commands/feature_compatibility_version_parser.cpp +++ b/src/mongo/db/commands/feature_compatibility_version_parser.cpp @@ -37,10 +37,10 @@ namespace mongo { -constexpr StringData FeatureCompatibilityVersionParser::kVersion36; constexpr StringData FeatureCompatibilityVersionParser::kVersion40; -constexpr StringData FeatureCompatibilityVersionParser::kVersionDowngradingTo36; -constexpr StringData FeatureCompatibilityVersionParser::kVersionUpgradingTo40; +constexpr StringData FeatureCompatibilityVersionParser::kVersion42; +constexpr StringData FeatureCompatibilityVersionParser::kVersionDowngradingTo40; +constexpr StringData FeatureCompatibilityVersionParser::kVersionUpgradingTo42; constexpr StringData FeatureCompatibilityVersionParser::kVersionUnset; constexpr StringData FeatureCompatibilityVersionParser::kParameterName; @@ -50,7 +50,7 @@ constexpr StringData FeatureCompatibilityVersionParser::kTargetVersionField; StatusWith<ServerGlobalParams::FeatureCompatibility::Version> FeatureCompatibilityVersionParser::parse(const BSONObj& featureCompatibilityVersionDoc) { ServerGlobalParams::FeatureCompatibility::Version version = - ServerGlobalParams::FeatureCompatibility::Version::kUnsetDefault36Behavior; + ServerGlobalParams::FeatureCompatibility::Version::kUnsetDefault40Behavior; std::string versionString; std::string targetVersionString; @@ -75,15 +75,15 @@ FeatureCompatibilityVersionParser::parse(const BSONObj& featureCompatibilityVers << "."); } - if (elem.String() != kVersion40 && elem.String() != kVersion36) { + if (elem.String() != kVersion42 && elem.String() != kVersion40) { return Status( ErrorCodes::BadValue, str::stream() << "Invalid value for " << fieldName << ", found " << elem.String() << ", expected '" - << kVersion40 + << kVersion42 << "' or '" - << kVersion36 + << kVersion40 << "'. Contents of " << kParameterName << " document in " @@ -115,16 +115,16 @@ FeatureCompatibilityVersionParser::parse(const BSONObj& featureCompatibilityVers } } - if (versionString == kVersion36) { - if (targetVersionString == kVersion40) { - version = ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo40; - } else if (targetVersionString == kVersion36) { - version = ServerGlobalParams::FeatureCompatibility::Version::kDowngradingTo36; + if (versionString == kVersion40) { + if (targetVersionString == kVersion42) { + version = ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo42; + } else if (targetVersionString == kVersion40) { + version = ServerGlobalParams::FeatureCompatibility::Version::kDowngradingTo40; } else { - version = ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36; + version = ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo40; } - } else if (versionString == kVersion40) { - if (targetVersionString == kVersion40 || targetVersionString == kVersion36) { + } else if (versionString == kVersion42) { + if (targetVersionString == kVersion42 || targetVersionString == kVersion40) { return Status( ErrorCodes::BadValue, str::stream() << "Invalid state for " << kParameterName << " document in " @@ -135,7 +135,7 @@ FeatureCompatibilityVersionParser::parse(const BSONObj& featureCompatibilityVers << feature_compatibility_version_documentation::kCompatibilityLink << "."); } else { - version = ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40; + version = ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42; } } else { return Status( diff --git a/src/mongo/db/commands/feature_compatibility_version_parser.h b/src/mongo/db/commands/feature_compatibility_version_parser.h index ac36f73556a..672a6fdc229 100644 --- a/src/mongo/db/commands/feature_compatibility_version_parser.h +++ b/src/mongo/db/commands/feature_compatibility_version_parser.h @@ -39,10 +39,10 @@ namespace mongo { */ class FeatureCompatibilityVersionParser { public: - static constexpr StringData kVersion36 = "3.6"_sd; static constexpr StringData kVersion40 = "4.0"_sd; - static constexpr StringData kVersionDowngradingTo36 = "downgrading to 3.6"_sd; - static constexpr StringData kVersionUpgradingTo40 = "upgrading to 4.0"_sd; + static constexpr StringData kVersion42 = "4.2"_sd; + static constexpr StringData kVersionDowngradingTo40 = "downgrading to 4.0"_sd; + static constexpr StringData kVersionUpgradingTo42 = "upgrading to 4.2"_sd; static constexpr StringData kVersionUnset = "Unset"_sd; static constexpr StringData kParameterName = "featureCompatibilityVersion"_sd; @@ -62,16 +62,16 @@ public: */ static StringData toString(ServerGlobalParams::FeatureCompatibility::Version version) { switch (version) { - case ServerGlobalParams::FeatureCompatibility::Version::kUnsetDefault36Behavior: + case ServerGlobalParams::FeatureCompatibility::Version::kUnsetDefault40Behavior: return kVersionUnset; - case ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36: - return kVersion36; - case ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo40: - return kVersionUpgradingTo40; - case ServerGlobalParams::FeatureCompatibility::Version::kDowngradingTo36: - return kVersionDowngradingTo36; - case ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40: + case ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo40: return kVersion40; + case ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo42: + return kVersionUpgradingTo42; + case ServerGlobalParams::FeatureCompatibility::Version::kDowngradingTo40: + return kVersionDowngradingTo40; + case ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42: + return kVersion42; default: MONGO_UNREACHABLE; } 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 92ef3d07a7c..e751532068b 100644 --- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp +++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp @@ -57,7 +57,7 @@ namespace { MONGO_FAIL_POINT_DEFINE(featureCompatibilityDowngrade); MONGO_FAIL_POINT_DEFINE(featureCompatibilityUpgrade); /** - * Sets the minimum allowed version for the cluster. If it is 3.4, then the node should not use 3.6 + * Sets the minimum allowed version for the cluster. If it is 4.0, then the node should not use 4.2 * features. * * Format: @@ -85,11 +85,11 @@ public: std::string help() const override { std::stringstream h; h << "Set the API version exposed by this node. If set to \"" - << FeatureCompatibilityVersionParser::kVersion36 - << "\", then 4.0 features are disabled. If \"" << FeatureCompatibilityVersionParser::kVersion40 - << "\", then 4.0 features are enabled, and all nodes in the cluster must be binary " - "version 4.0. See " + << "\", then 4.2 features are disabled. If \"" + << FeatureCompatibilityVersionParser::kVersion42 + << "\", then 4.2 features are enabled, and all nodes in the cluster must be binary " + "version 4.2. See " << feature_compatibility_version_documentation::kCompatibilityLink << "."; return h.str(); } @@ -138,16 +138,16 @@ public: ServerGlobalParams::FeatureCompatibility::Version actualVersion = serverGlobalParams.featureCompatibility.getVersion(); - if (requestedVersion == FeatureCompatibilityVersionParser::kVersion40) { + if (requestedVersion == FeatureCompatibilityVersionParser::kVersion42) { uassert(ErrorCodes::IllegalOperation, - "cannot initiate featureCompatibilityVersion upgrade to 4.0 while a previous " - "featureCompatibilityVersion downgrade to 3.6 has not completed. Finish " - "downgrade to 3.6, then upgrade to 4.0.", + "cannot initiate featureCompatibilityVersion upgrade to 4.2 while a previous " + "featureCompatibilityVersion downgrade to 4.0 has not completed. Finish " + "downgrade to 4.0, then upgrade to 4.2.", actualVersion != - ServerGlobalParams::FeatureCompatibility::Version::kDowngradingTo36); + ServerGlobalParams::FeatureCompatibility::Version::kDowngradingTo40); if (actualVersion == - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40) { + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42) { // Set the client's last opTime to the system last opTime so no-ops wait for // writeConcern. repl::ReplClientInfo::forClient(opCtx->getClient()) @@ -161,7 +161,7 @@ public: // Take the global lock in S mode to create a barrier for operations taking the // global IX or X locks. This ensures that either // - The global IX/X locked operation will start after the FCV change, see the - // upgrading to 4.0 FCV and act accordingly. + // upgrading to 4.2 FCV and act accordingly. // - The global IX/X locked operation began prior to the FCV change, is acting on // that assumption and will finish before upgrade procedures begin right after // this. @@ -183,15 +183,15 @@ public: } FeatureCompatibilityVersion::unsetTargetUpgradeOrDowngrade(opCtx, requestedVersion); - } else if (requestedVersion == FeatureCompatibilityVersionParser::kVersion36) { + } else if (requestedVersion == FeatureCompatibilityVersionParser::kVersion40) { uassert(ErrorCodes::IllegalOperation, - "cannot initiate setting featureCompatibilityVersion to 3.6 while a previous " - "featureCompatibilityVersion upgrade to 4.0 has not completed.", + "cannot initiate setting featureCompatibilityVersion to 4.0 while a previous " + "featureCompatibilityVersion upgrade to 4.2 has not completed.", actualVersion != - ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo40); + ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo42); if (actualVersion == - ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36) { + ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo40) { // Set the client's last opTime to the system last opTime so no-ops wait for // writeConcern. repl::ReplClientInfo::forClient(opCtx->getClient()) @@ -205,7 +205,7 @@ public: // Take the global lock in S mode to create a barrier for operations taking the // global IX or X locks. This ensures that either // - The global IX/X locked operation will start after the FCV change, see the - // downgrading to 3.6 FCV and act accordingly. + // downgrading to 4.0 FCV and act accordingly. // - The global IX/X locked operation began prior to the FCV change, is acting on // that assumption and will finish before downgrade procedures begin right after // this. diff --git a/src/mongo/db/pipeline/expression.cpp b/src/mongo/db/pipeline/expression.cpp index 5cb0122f565..200792ac734 100644 --- a/src/mongo/db/pipeline/expression.cpp +++ b/src/mongo/db/pipeline/expression.cpp @@ -1343,34 +1343,6 @@ intrusive_ptr<Expression> ExpressionDateFromString::parse( } } - // The 'format', 'onNull' and 'onError' options were introduced in 4.0, and should not be - // allowed in contexts where the maximum feature version is <= 4.0. - if (expCtx->maxFeatureCompatibilityVersion && - *expCtx->maxFeatureCompatibilityVersion < - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40) { - uassert( - ErrorCodes::QueryFeatureNotAllowed, - str::stream() << "\"format\" option to $dateFromString is not allowed with the current " - "feature compatibility version. See " - << feature_compatibility_version_documentation::kCompatibilityLink - << " for more information.", - !formatElem); - uassert( - ErrorCodes::QueryFeatureNotAllowed, - str::stream() << "\"onNull\" option to $dateFromString is not allowed with the current " - "feature compatibility version. See " - << feature_compatibility_version_documentation::kCompatibilityLink - << " for more information.", - !onNullElem); - uassert(ErrorCodes::QueryFeatureNotAllowed, - str::stream() - << "\"onError\" option to $dateFromString is not allowed with the current " - "feature compatibility version. See " - << feature_compatibility_version_documentation::kCompatibilityLink - << " for more information.", - !onErrorElem); - } - uassert(40542, "Missing 'dateString' parameter to $dateFromString", dateStringElem); return new ExpressionDateFromString( @@ -1691,28 +1663,6 @@ intrusive_ptr<Expression> ExpressionDateToString::parse( } } - // The 'onNull' option was introduced in 4.0, and should not be allowed in contexts where the - // maximum feature version is <= 4.0. Similarly, the 'format' option was made optional in 4.0, - // so should be required in such scenarios. - if (expCtx->maxFeatureCompatibilityVersion && - *expCtx->maxFeatureCompatibilityVersion < - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40) { - uassert( - ErrorCodes::QueryFeatureNotAllowed, - str::stream() << "\"onNull\" option to $dateToString is not allowed with the current " - "feature compatibility version. See " - << feature_compatibility_version_documentation::kCompatibilityLink - << " for more information.", - !onNullElem); - - uassert(ErrorCodes::QueryFeatureNotAllowed, - str::stream() << "\"format\" option to $dateToString is required with the current " - "feature compatibility version. See " - << feature_compatibility_version_documentation::kCompatibilityLink - << " for more information.", - formatElem); - } - uassert(18628, "Missing 'date' parameter to $dateToString", !dateElem.eoo()); return new ExpressionDateToString(expCtx, diff --git a/src/mongo/db/repair_database_and_check_version.cpp b/src/mongo/db/repair_database_and_check_version.cpp index 7eb1ad2d917..78a1e380718 100644 --- a/src/mongo/db/repair_database_and_check_version.cpp +++ b/src/mongo/db/repair_database_and_check_version.cpp @@ -68,8 +68,8 @@ using std::endl; namespace { const std::string mustDowngradeErrorMsg = str::stream() - << "UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.6 before attempting " - "an upgrade to 4.0; see " + << "UPGRADE PROBLEM: The data files need to be fully upgraded to version 4.0 before attempting " + "an upgrade to 4.2; see " << feature_compatibility_version_documentation::kUpgradeLink << " for more details."; Status restoreMissingFeatureCompatibilityVersionDocument(OperationContext* opCtx, @@ -104,11 +104,11 @@ Status restoreMissingFeatureCompatibilityVersionDocument(OperationContext* opCtx BSON("_id" << FeatureCompatibilityVersionParser::kParameterName), featureCompatibilityVersion)) { log() << "Re-creating featureCompatibilityVersion document that was deleted with version " - << FeatureCompatibilityVersionParser::kVersion36 << "."; + << FeatureCompatibilityVersionParser::kVersion40 << "."; BSONObj fcvObj = BSON("_id" << FeatureCompatibilityVersionParser::kParameterName << FeatureCompatibilityVersionParser::kVersionField - << FeatureCompatibilityVersionParser::kVersion36); + << FeatureCompatibilityVersionParser::kVersion40); writeConflictRetry(opCtx, "insertFCVDocument", fcvNss.ns(), [&] { WriteUnitOfWork wunit(opCtx); @@ -426,14 +426,14 @@ StatusWith<bool> repairDatabasesAndCheckVersion(OperationContext* opCtx) { if (!swVersion.isOK()) { severe() << swVersion.getStatus(); // Note this error path captures all cases of an FCV document existing, - // but with any value other than "3.6" or "4.0". This includes unexpected + // but with any value other than "4.0" or "4.2". This includes unexpected // cases with no path forward such as the FCV value not being a string. return {ErrorCodes::MustDowngrade, str::stream() << "UPGRADE PROBLEM: Unable to parse the " "featureCompatibilityVersion document. The data files need " - "to be fully upgraded to version 3.6 before attempting an " - "upgrade to 4.0. If you are upgrading to 4.0, see " + "to be fully upgraded to version 4.0 before attempting an " + "upgrade to 4.2. If you are upgrading to 4.2, see " << feature_compatibility_version_documentation::kUpgradeLink << "."}; } @@ -445,23 +445,23 @@ StatusWith<bool> repairDatabasesAndCheckVersion(OperationContext* opCtx) { // On startup, if the version is in an upgrading or downrading state, print a // warning. if (version == - ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo40) { + ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo42) { log() << "** WARNING: A featureCompatibilityVersion upgrade did not " << "complete. " << startupWarningsLog; log() << "** The current featureCompatibilityVersion is " << FeatureCompatibilityVersionParser::toString(version) << "." << startupWarningsLog; log() << "** To fix this, use the setFeatureCompatibilityVersion " - << "command to resume upgrade to 4.0." << startupWarningsLog; + << "command to resume upgrade to 4.2." << startupWarningsLog; } else if (version == ServerGlobalParams::FeatureCompatibility::Version:: - kDowngradingTo36) { + kDowngradingTo40) { log() << "** WARNING: A featureCompatibilityVersion downgrade did not " << "complete. " << startupWarningsLog; log() << "** The current featureCompatibilityVersion is " << FeatureCompatibilityVersionParser::toString(version) << "." << startupWarningsLog; log() << "** To fix this, use the setFeatureCompatibilityVersion " - << "command to resume downgrade to 3.6." << startupWarningsLog; + << "command to resume downgrade to 4.0." << startupWarningsLog; } } } diff --git a/src/mongo/db/repl/initial_syncer.cpp b/src/mongo/db/repl/initial_syncer.cpp index 2268129f0b3..bcf6ae2b6d4 100644 --- a/src/mongo/db/repl/initial_syncer.cpp +++ b/src/mongo/db/repl/initial_syncer.cpp @@ -728,8 +728,8 @@ void InitialSyncer::_fcvFetcherCallback(const StatusWith<Fetcher::QueryResponse> auto version = fCVParseSW.getValue(); // Changing the featureCompatibilityVersion during initial sync is unsafe. - if (version > ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36 && - version < ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40) { + if (version > ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo40 && + version < ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42) { 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 98a18d6c75f..0f0f95e9fa1 100644 --- a/src/mongo/db/repl/initial_syncer_test.cpp +++ b/src/mongo/db/repl/initial_syncer_test.cpp @@ -200,10 +200,10 @@ public: /** * Schedules and processes a successful response to the network request sent by InitialSyncer's - * feature compatibility version fetcher. Always includes a valid fCV=3.6 document in the + * feature compatibility version fetcher. Always includes a valid fCV=4.0 document in the * response. */ - void processSuccessfulFCVFetcherResponse36(); + void processSuccessfulFCVFetcherResponse40(); void finishProcessingNetworkResponse() { getNet()->runReadyNetworkOperations(); @@ -591,9 +591,9 @@ void assertFCVRequest(RemoteCommandRequest request) { request.cmdObj.getObjectField("filter")); } -void InitialSyncerTest::processSuccessfulFCVFetcherResponse36() { +void InitialSyncerTest::processSuccessfulFCVFetcherResponse40() { auto docs = {BSON("_id" << FeatureCompatibilityVersionParser::kParameterName << "version" - << FeatureCompatibilityVersionParser::kVersion36)}; + << FeatureCompatibilityVersionParser::kVersion40)}; processSuccessfulFCVFetcherResponse(docs); } @@ -1347,7 +1347,7 @@ TEST_F(InitialSyncerTest, processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); } initialSyncer->join(); @@ -1475,7 +1475,7 @@ TEST_F(InitialSyncerTest, InitialSyncerResendsFindCommandIfFCVFetcherReturnsRetr ASSERT_TRUE(initialSyncer->isActive()); // FCV second attempt. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); } void InitialSyncerTest::runInitialSyncWithBadFCVResponse(std::vector<BSONObj> docs, @@ -1512,7 +1512,7 @@ TEST_F(InitialSyncerTest, TEST_F(InitialSyncerTest, InitialSyncerReturnsTooManyMatchingDocumentsWhenFCVFetcherReturnsMultipleDocuments) { auto docs = {BSON("_id" << FeatureCompatibilityVersionParser::kParameterName << "version" - << FeatureCompatibilityVersionParser::kVersion36), + << FeatureCompatibilityVersionParser::kVersion40), BSON("_id" << "other")}; runInitialSyncWithBadFCVResponse(docs, ErrorCodes::TooManyMatchingDocuments); @@ -1521,24 +1521,24 @@ TEST_F(InitialSyncerTest, TEST_F(InitialSyncerTest, InitialSyncerReturnsIncompatibleServerVersionWhenFCVFetcherReturnsUpgradeTargetVersion) { auto docs = {BSON("_id" << FeatureCompatibilityVersionParser::kParameterName << "version" - << FeatureCompatibilityVersionParser::kVersion36 + << FeatureCompatibilityVersionParser::kVersion40 << "targetVersion" - << FeatureCompatibilityVersionParser::kVersion40)}; + << FeatureCompatibilityVersionParser::kVersion42)}; runInitialSyncWithBadFCVResponse(docs, ErrorCodes::IncompatibleServerVersion); } TEST_F(InitialSyncerTest, InitialSyncerReturnsIncompatibleServerVersionWhenFCVFetcherReturnsDowngradeTargetVersion) { auto docs = {BSON("_id" << FeatureCompatibilityVersionParser::kParameterName << "version" - << FeatureCompatibilityVersionParser::kVersion36 + << FeatureCompatibilityVersionParser::kVersion40 << "targetVersion" - << FeatureCompatibilityVersionParser::kVersion36)}; + << FeatureCompatibilityVersionParser::kVersion40)}; runInitialSyncWithBadFCVResponse(docs, ErrorCodes::IncompatibleServerVersion); } TEST_F(InitialSyncerTest, InitialSyncerReturnsBadValueWhenFCVFetcherReturnsNoVersion) { auto docs = {BSON("_id" << FeatureCompatibilityVersionParser::kParameterName << "targetVersion" - << FeatureCompatibilityVersionParser::kVersion36)}; + << FeatureCompatibilityVersionParser::kVersion40)}; runInitialSyncWithBadFCVResponse(docs, ErrorCodes::BadValue); } @@ -1561,7 +1561,7 @@ TEST_F(InitialSyncerTest, InitialSyncerSucceedsWhenFCVFetcherReturnsOldVersion) processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); auto docs = {BSON("_id" << FeatureCompatibilityVersionParser::kParameterName << "version" - << FeatureCompatibilityVersionParser::kVersion36)}; + << FeatureCompatibilityVersionParser::kVersion40)}; processSuccessfulFCVFetcherResponse(docs); ASSERT_TRUE(net->hasReadyRequests()); } @@ -1608,7 +1608,7 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughOplogFetcherScheduleError) { net->runReadyNetworkOperations(); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // OplogFetcher will shut down DatabasesCloner on error after setting the completion status. // We call runReadyNetworkOperations() again to deliver the cancellation status to @@ -1646,7 +1646,7 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughOplogFetcherCallbackError) { net->runReadyNetworkOperations(); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); assertRemoteCommandNameEquals( "listDatabases", net->scheduleSuccessfulResponse(makeListDatabasesResponse({}))); @@ -1694,7 +1694,7 @@ TEST_F(InitialSyncerTest, net->runReadyNetworkOperations(); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); assertRemoteCommandNameEquals( "listDatabases", net->scheduleSuccessfulResponse(makeListDatabasesResponse({}))); @@ -1743,7 +1743,7 @@ TEST_F( processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); assertRemoteCommandNameEquals( "listDatabases", net->scheduleSuccessfulResponse(makeListDatabasesResponse({}))); @@ -1796,7 +1796,7 @@ TEST_F( processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); assertRemoteCommandNameEquals( "listDatabases", net->scheduleSuccessfulResponse(makeListDatabasesResponse({}))); @@ -1857,7 +1857,7 @@ TEST_F(InitialSyncerTest, processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // InitialSyncer shuts down OplogFetcher when it fails to schedule DatabasesCloner // so we should not expect any network requests in the queue. @@ -1897,7 +1897,7 @@ TEST_F(InitialSyncerTest, processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // DatabasesCloner's first remote command - listDatabases assertRemoteCommandNameEquals( @@ -1934,7 +1934,7 @@ TEST_F(InitialSyncerTest, InitialSyncerIgnoresLocalDatabasesWhenCloningDatabases processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // DatabasesCloner's first remote command - listDatabases assertRemoteCommandNameEquals( @@ -1997,7 +1997,7 @@ TEST_F(InitialSyncerTest, processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // DatabasesCloner's first remote command - listDatabases assertRemoteCommandNameEquals( @@ -2066,7 +2066,7 @@ TEST_F(InitialSyncerTest, InitialSyncerCancelsBothOplogFetcherAndDatabasesCloner processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); } ASSERT_OK(initialSyncer->shutdown()); @@ -2115,7 +2115,7 @@ TEST_F(InitialSyncerTest, processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -2154,7 +2154,7 @@ TEST_F(InitialSyncerTest, processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -2209,7 +2209,7 @@ TEST_F(InitialSyncerTest, processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -2259,7 +2259,7 @@ TEST_F(InitialSyncerTest, processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -2320,7 +2320,7 @@ TEST_F( processSuccessfulLastOplogEntryFetcherResponse({oplogEntry}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -2371,7 +2371,7 @@ TEST_F(InitialSyncerTest, processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(2)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -2437,7 +2437,7 @@ TEST_F( processSuccessfulLastOplogEntryFetcherResponse({oplogEntry}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -2506,7 +2506,7 @@ TEST_F( processSuccessfulLastOplogEntryFetcherResponse({oplogEntry}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -2575,7 +2575,7 @@ TEST_F( processSuccessfulLastOplogEntryFetcherResponse({oplogEntry}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -2626,7 +2626,7 @@ TEST_F( processSuccessfulLastOplogEntryFetcherResponse({oplogEntry}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -2682,7 +2682,7 @@ TEST_F(InitialSyncerTest, InitialSyncerCancelsLastRollbackCheckerOnShutdown) { processSuccessfulLastOplogEntryFetcherResponse({oplogEntry}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -2739,7 +2739,7 @@ TEST_F(InitialSyncerTest, InitialSyncerCancelsLastRollbackCheckerOnOplogFetcherC processSuccessfulLastOplogEntryFetcherResponse({oplogEntry}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -2801,7 +2801,7 @@ TEST_F(InitialSyncerTest, processSuccessfulLastOplogEntryFetcherResponse({oplogEntry}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -2854,7 +2854,7 @@ TEST_F(InitialSyncerTest, LastOpTimeShouldBeSetEvenIfNoOperationsAreAppliedAfter processSuccessfulLastOplogEntryFetcherResponse({oplogEntry.toBSON()}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Instead of fast forwarding to DatabasesCloner completion by returning an empty list of // database names, we'll simulate copying a single database with a single collection on the @@ -2945,7 +2945,7 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughGetNextApplierBatchScheduleE processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -3002,7 +3002,7 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughSecondGetNextApplierBatchSch processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -3059,7 +3059,7 @@ TEST_F(InitialSyncerTest, InitialSyncerCancelsGetNextApplierBatchOnShutdown) { processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -3118,7 +3118,7 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughGetNextApplierBatchInLockErr processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -3185,7 +3185,7 @@ TEST_F( processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -3243,7 +3243,7 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughMultiApplierScheduleError) { processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -3317,7 +3317,7 @@ TEST_F(InitialSyncerTest, InitialSyncerPassesThroughMultiApplierCallbackError) { processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -3366,7 +3366,7 @@ TEST_F(InitialSyncerTest, InitialSyncerCancelsGetNextApplierBatchCallbackOnOplog processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -3421,7 +3421,7 @@ OplogEntry InitialSyncerTest::doInitialSyncWithOneBatch(bool shouldSetFCV) { processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -3515,7 +3515,7 @@ TEST_F(InitialSyncerTest, processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Instead of fast forwarding to DatabasesCloner completion by returning an empty list of // database names, we'll simulate copying a single database with a single collection on the @@ -3633,7 +3633,7 @@ TEST_F( processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Quickest path to a successful DatabasesCloner completion is to respond to the // listDatabases with an empty list of database names. @@ -3725,7 +3725,7 @@ TEST_F(InitialSyncerTest, OplogOutOfOrderOnOplogFetchFinish) { processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // Ignore listDatabases request. auto noi = net->getNextReadyRequest(); @@ -3779,7 +3779,7 @@ TEST_F(InitialSyncerTest, GetInitialSyncProgressReturnsCorrectProgress) { processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); } log() << "Done playing first failed response"; @@ -3828,7 +3828,7 @@ TEST_F(InitialSyncerTest, GetInitialSyncProgressReturnsCorrectProgress) { processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); } log() << "Done playing first successful response"; @@ -4041,7 +4041,7 @@ TEST_F(InitialSyncerTest, GetInitialSyncProgressOmitsClonerStatsIfClonerStatsExc processSuccessfulLastOplogEntryFetcherResponse({makeOplogEntryObj(1)}); // Feature Compatibility Version. - processSuccessfulFCVFetcherResponse36(); + processSuccessfulFCVFetcherResponse40(); // listDatabases NamespaceString nss("a.a"); diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index 828ac2622ad..35875f1bb33 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -2534,7 +2534,7 @@ ReplicationCoordinatorImpl::_updateMemberStateFromTopologyCoordinator_inlock( // receive the replicated version. This is to avoid bugs like SERVER-32639. if (newState.arbiter()) { serverGlobalParams.featureCompatibility.setVersion( - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40); + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42); } _memberState = newState; diff --git a/src/mongo/db/repl/replication_info.cpp b/src/mongo/db/repl/replication_info.cpp index 3782148a7d6..3c594a75492 100644 --- a/src/mongo/db/repl/replication_info.cpp +++ b/src/mongo/db/repl/replication_info.cpp @@ -57,7 +57,6 @@ #include "mongo/executor/network_interface.h" #include "mongo/rpc/metadata/client_metadata.h" #include "mongo/rpc/metadata/client_metadata_ismaster.h" -#include "mongo/util/fail_point_service.h" #include "mongo/util/map_util.h" namespace mongo { @@ -69,12 +68,6 @@ using std::stringstream; namespace repl { -namespace { - -MONGO_FAIL_POINT_DEFINE(impersonateFullyUpgradedFutureVersion); - -} // namespace - void appendReplicationInfo(OperationContext* opCtx, BSONObjBuilder& result, int level) { ReplicationCoordinator* replCoord = ReplicationCoordinator::get(opCtx); if (replCoord->getSettings().usingReplSets()) { @@ -355,10 +348,7 @@ public: result.append("logicalSessionTimeoutMinutes", localLogicalSessionTimeoutMinutes); result.appendNumber("connectionId", opCtx->getClient()->getConnectionId()); - if (MONGO_FAIL_POINT(impersonateFullyUpgradedFutureVersion)) { - result.append("minWireVersion", WireVersion::FUTURE_WIRE_VERSION_FOR_TESTING); - result.append("maxWireVersion", WireVersion::FUTURE_WIRE_VERSION_FOR_TESTING); - } else if (internalClientElement) { + if (internalClientElement) { result.append("minWireVersion", WireSpec::instance().incomingInternalClient.minWireVersion); result.append("maxWireVersion", diff --git a/src/mongo/db/repl/sync_tail_test_fixture.cpp b/src/mongo/db/repl/sync_tail_test_fixture.cpp index b3b7980a470..dc1ed3dec95 100644 --- a/src/mongo/db/repl/sync_tail_test_fixture.cpp +++ b/src/mongo/db/repl/sync_tail_test_fixture.cpp @@ -121,7 +121,7 @@ void SyncTailTest::setUp() { // test fixture does not create a featureCompatibilityVersion document from which to initialize // the server parameter. serverGlobalParams.featureCompatibility.setVersion( - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40); + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42); } void SyncTailTest::tearDown() { diff --git a/src/mongo/db/s/config/configsvr_shard_collection_command.cpp b/src/mongo/db/s/config/configsvr_shard_collection_command.cpp index bdaa4e5510f..125dc67569e 100644 --- a/src/mongo/db/s/config/configsvr_shard_collection_command.cpp +++ b/src/mongo/db/s/config/configsvr_shard_collection_command.cpp @@ -666,7 +666,7 @@ boost::optional<UUID> getUUIDFromPrimaryShard(const NamespaceString& nss, str::stream() << "expected primary shard to return 'info' field as part of " "listCollections for " << nss.ns() - << " because the cluster is in featureCompatibilityVersion=3.6, but got " + << ", but got " << res, !collectionInfo.isEmpty()); diff --git a/src/mongo/db/s/config/sharding_catalog_manager_add_shard_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_add_shard_test.cpp index f0e5aa84f5e..74587e60d3e 100644 --- a/src/mongo/db/s/config/sharding_catalog_manager_add_shard_test.cpp +++ b/src/mongo/db/s/config/sharding_catalog_manager_add_shard_test.cpp @@ -144,7 +144,7 @@ protected: ASSERT_EQ(request.dbname, "admin"); ASSERT_BSONOBJ_EQ(request.cmdObj, BSON("setFeatureCompatibilityVersion" - << "4.0" + << "4.2" << "writeConcern" << writeConcern)); 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 85831492b73..7d11f8e316b 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 @@ -343,14 +343,14 @@ StatusWith<ShardType> ShardingCatalogManager::_validateHostAsShard( << " as a shard"); } if (serverGlobalParams.featureCompatibility.getVersion() > - ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36) { - // If the cluster's FCV is 4.0, or upgrading to / downgrading from, the node being added - // must be a v4.0 binary. + ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo40) { + // If the cluster's FCV is 4.2, or upgrading to / downgrading from, the node being added + // must be a v4.2 binary. invariant(maxWireVersion == WireVersion::LATEST_WIRE_VERSION); } else { - // If the cluster's FCV is 3.6, the node being added must be a v3.6 or v4.0 binary. + // If the cluster's FCV is 4.0, the node being added must be a v4.0 or v4.2 binary. invariant(serverGlobalParams.featureCompatibility.getVersion() == - ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36); + ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo40); invariant(maxWireVersion >= WireVersion::LATEST_WIRE_VERSION - 1); } @@ -702,16 +702,16 @@ StatusWith<std::string> ShardingCatalogManager::addShard( BSONObj setFCVCmd; switch (serverGlobalParams.featureCompatibility.getVersion()) { - case ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40: - case ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo40: + case ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42: + case ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo42: setFCVCmd = BSON(FeatureCompatibilityVersionCommandParser::kCommandName - << FeatureCompatibilityVersionParser::kVersion40 + << FeatureCompatibilityVersionParser::kVersion42 << WriteConcernOptions::kWriteConcernField << opCtx->getWriteConcern().toBSON()); break; default: setFCVCmd = BSON(FeatureCompatibilityVersionCommandParser::kCommandName - << FeatureCompatibilityVersionParser::kVersion36 + << FeatureCompatibilityVersionParser::kVersion40 << WriteConcernOptions::kWriteConcernField << opCtx->getWriteConcern().toBSON()); break; diff --git a/src/mongo/db/server_options.h b/src/mongo/db/server_options.h index f4abfe9a884..25f7a7ccc42 100644 --- a/src/mongo/db/server_options.h +++ b/src/mongo/db/server_options.h @@ -155,40 +155,40 @@ struct ServerGlobalParams { * * The legal enum (and featureCompatibilityVersion document) states are: * - * kFullyDowngradedTo36 - * (3.6, Unset): Only 3.6 features are available, and new and existing storage - * engine entries use the 3.6 format + * kFullyDowngradedTo40 + * (4.0, Unset): Only 4.0 features are available, and new and existing storage + * engine entries use the 4.0 format * - * kUpgradingTo40 - * (3.6, 4.0): Only 3.6 features are available, but new storage engine entries - * use the 4.0 format, and existing entries may have either the - * 3.6 or 4.0 format + * kUpgradingTo42 + * (4.0, 4.2): Only 4.0 features are available, but new storage engine entries + * use the 4.2 format, and existing entries may have either the + * 4.0 or 4.2 format * - * kFullyUpgradedTo40 - * (4.0, Unset): 4.0 features are available, and new and existing storage - * engine entries use the 4.0 format + * kFullyUpgradedTo42 + * (4.2, Unset): 4.2 features are available, and new and existing storage + * engine entries use the 4.2 format * - * kDowngradingTo36 - * (3.6, 3.6): Only 3.6 features are available and new storage engine - * entries use the 3.6 format, but existing entries may have - * either the 3.6 or 4.0 format + * kDowngradingTo40 + * (4.0, 4.0): Only 4.0 features are available and new storage engine + * entries use the 4.0 format, but existing entries may have + * either the 4.0 or 4.2 format * - * kUnsetDefault36Behavior + * kUnsetDefault40Behavior * (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 - * (kFullyDowngradedTo36). + * (kFullyDowngradedTo40). * */ enum class Version { // The order of these enums matter, higher upgrades having higher values, so that // features can be active or inactive if the version is higher than some minimum or // lower than some maximum, respectively. - kUnsetDefault36Behavior = 0, - kFullyDowngradedTo36 = 1, - kDowngradingTo36 = 2, - kUpgradingTo40 = 3, - kFullyUpgradedTo40 = 4, + kUnsetDefault40Behavior = 0, + kFullyDowngradedTo40 = 1, + kDowngradingTo40 = 2, + kUpgradingTo42 = 3, + kFullyUpgradedTo42 = 4, }; /** @@ -196,7 +196,7 @@ struct ServerGlobalParams { * exposes the actual state of the featureCompatibilityVersion if it is uninitialized. */ const bool isVersionInitialized() const { - return _version.load() != Version::kUnsetDefault36Behavior; + return _version.load() != Version::kUnsetDefault40Behavior; } /** @@ -216,11 +216,11 @@ struct ServerGlobalParams { */ const Version getVersionUnsafe() const { Version v = _version.load(); - return (v == Version::kUnsetDefault36Behavior) ? Version::kFullyDowngradedTo36 : v; + return (v == Version::kUnsetDefault40Behavior) ? Version::kFullyDowngradedTo40 : v; } void reset() { - _version.store(Version::kUnsetDefault36Behavior); + _version.store(Version::kUnsetDefault40Behavior); } void setVersion(Version version) { @@ -228,12 +228,12 @@ struct ServerGlobalParams { } bool isVersionUpgradingOrUpgraded() { - return (getVersion() == Version::kUpgradingTo40 || - getVersion() == Version::kFullyUpgradedTo40); + return (getVersion() == Version::kUpgradingTo42 || + getVersion() == Version::kFullyUpgradedTo42); } private: - AtomicWord<Version> _version{Version::kUnsetDefault36Behavior}; + AtomicWord<Version> _version{Version::kUnsetDefault40Behavior}; } featureCompatibility; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index f5984adc33f..4e06354af8b 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -115,8 +115,8 @@ bool WiredTigerFileVersion::shouldDowngrade(bool readOnly, } if (serverGlobalParams.featureCompatibility.getVersion() != - ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36) { - // Only consider downgrading when FCV is set to 3.6 + ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo40) { + // Only consider downgrading when FCV is set to 4.0 return false; } diff --git a/src/mongo/db/views/view_catalog.cpp b/src/mongo/db/views/view_catalog.cpp index 27eb95d875d..107249c3d3d 100644 --- a/src/mongo/db/views/view_catalog.cpp +++ b/src/mongo/db/views/view_catalog.cpp @@ -254,11 +254,11 @@ StatusWith<stdx::unordered_set<NamespaceString>> ViewCatalog::_validatePipeline_ // Save this to a variable to avoid reading the atomic variable multiple times. auto currentFCV = serverGlobalParams.featureCompatibility.getVersion(); - // If the feature compatibility version is not 4.0, and we are validating features as master, - // ban the use of new agg features introduced in 4.0 to prevent them from being persisted in the + // If the feature compatibility version is not 4.2, and we are validating features as master, + // ban the use of new agg features introduced in 4.2 to prevent them from being persisted in the // catalog. if (serverGlobalParams.validateFeaturesAsMaster.load() && - currentFCV != ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40) { + currentFCV != ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42) { expCtx->maxFeatureCompatibilityVersion = currentFCV; } auto pipelineStatus = Pipeline::parse(viewDef.pipeline(), std::move(expCtx)); diff --git a/src/mongo/db/wire_version.h b/src/mongo/db/wire_version.h index 13ec8aa58b8..d373c648578 100644 --- a/src/mongo/db/wire_version.h +++ b/src/mongo/db/wire_version.h @@ -70,15 +70,15 @@ enum WireVersion { // Supports the new OP_MSG wireprotocol (3.6+). SUPPORTS_OP_MSG = 6, - // Supports replica set transactions (3.8+). + // Supports replica set transactions (4.0+). REPLICA_SET_TRANSACTIONS = 7, + // Supports sharded transactions (4.2+). + SHARDED_TRANSACTIONS = 8, + // Set this to the highest value in this enum - it will be the default maxWireVersion for // the WireSpec values. - LATEST_WIRE_VERSION = REPLICA_SET_TRANSACTIONS, - - // This is used in testing to masquerade as a future binary version node. - FUTURE_WIRE_VERSION_FOR_TESTING = 1 << 20, + LATEST_WIRE_VERSION = SHARDED_TRANSACTIONS, }; /** diff --git a/src/mongo/dbtests/dbtests.cpp b/src/mongo/dbtests/dbtests.cpp index 2f89aa3354e..07a4b4fe915 100644 --- a/src/mongo/dbtests/dbtests.cpp +++ b/src/mongo/dbtests/dbtests.cpp @@ -165,7 +165,7 @@ int dbtestsMain(int argc, char** argv, char** envp) { mongo::runGlobalInitializersOrDie(argc, argv, envp); serverGlobalParams.featureCompatibility.setVersion( - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40); + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42); repl::ReplSettings replSettings; replSettings.setOplogSizeBytes(10 * 1024 * 1024); ServiceContext* service = getGlobalServiceContext(); diff --git a/src/mongo/rpc/protocol.cpp b/src/mongo/rpc/protocol.cpp index ab5cbf8d47b..00fa6159ad4 100644 --- a/src/mongo/rpc/protocol.cpp +++ b/src/mongo/rpc/protocol.cpp @@ -181,7 +181,7 @@ ProtocolSet computeProtocolSet(const WireVersionInfo version) { result |= supports::kOpMsgOnly; } if (version.maxWireVersion >= WireVersion::FIND_COMMAND && - version.maxWireVersion <= WireVersion::REPLICA_SET_TRANSACTIONS) { + version.maxWireVersion <= WireVersion::SHARDED_TRANSACTIONS) { // Future versions may remove support for OP_COMMAND. result |= supports::kOpCommandOnly; } diff --git a/src/mongo/rpc/protocol_test.cpp b/src/mongo/rpc/protocol_test.cpp index ab92e3eeae1..daa9e27a1b7 100644 --- a/src/mongo/rpc/protocol_test.cpp +++ b/src/mongo/rpc/protocol_test.cpp @@ -283,20 +283,19 @@ TEST(Protocol, validateWireVersion) { // A mongos is unable to communicate with a fully upgraded cluster with a higher wire version. TEST(Protocol, validateWireVersionFailsForUpgradedServerNode) { - // Server is fully upgraded higher than the latest wire version. - auto msg = - BSON("minWireVersion" << static_cast<int>(WireVersion::FUTURE_WIRE_VERSION_FOR_TESTING) - << "maxWireVersion" - << static_cast<int>(WireVersion::FUTURE_WIRE_VERSION_FOR_TESTING)); + // Server is fully upgraded to the latest wire version. + auto msg = BSON("minWireVersion" << static_cast<int>(WireVersion::LATEST_WIRE_VERSION) + << "maxWireVersion" + << static_cast<int>(WireVersion::LATEST_WIRE_VERSION)); auto swReply = parseProtocolSetFromIsMasterReply(msg); ASSERT_OK(swReply.getStatus()); - // The client (this mongos server) only has latest wire version. - ASSERT_EQUALS( - mongo::ErrorCodes::IncompatibleWithUpgradedServer, - validateWireVersion({WireVersion::LATEST_WIRE_VERSION, WireVersion::LATEST_WIRE_VERSION}, - swReply.getValue().version) - .code()); + // The client (this mongos server) only has the previous wire version. + ASSERT_EQUALS(mongo::ErrorCodes::IncompatibleWithUpgradedServer, + validateWireVersion( + {WireVersion::LATEST_WIRE_VERSION - 1, WireVersion::LATEST_WIRE_VERSION - 1}, + swReply.getValue().version) + .code()); } } // namespace 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 21278ac91a1..1d3fbfeaa68 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 @@ -71,11 +71,11 @@ public: std::string help() const override { return str::stream() << "Set the API version for the cluster. If set to \"" - << FeatureCompatibilityVersionParser::kVersion36 - << "\", then 4.0 features are disabled. If \"" << FeatureCompatibilityVersionParser::kVersion40 - << "\", then 4.0 features are enabled, and all nodes in the cluster must be version " - << "4.0. See " << feature_compatibility_version_documentation::kCompatibilityLink + << "\", then 4.2 features are disabled. If \"" + << FeatureCompatibilityVersionParser::kVersion42 + << "\", then 4.2 features are enabled, and all nodes in the cluster must be version " + << "4.2. See " << feature_compatibility_version_documentation::kCompatibilityLink << "."; } diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp index 9e7358b2ca6..d5d38e1cc34 100644 --- a/src/mongo/s/server.cpp +++ b/src/mongo/s/server.cpp @@ -536,10 +536,10 @@ MONGO_INITIALIZER_GENERAL(ForkServer, ("EndStartupOptionHandling"), ("default")) // 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")) +MONGO_INITIALIZER_WITH_PREREQUISITES(SetFeatureCompatibilityVersion42, ("EndStartupOptionStorage")) (InitializerContext* context) { serverGlobalParams.featureCompatibility.setVersion( - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40); + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42); return Status::OK(); } diff --git a/src/mongo/s/sharding_mongod_test_fixture.cpp b/src/mongo/s/sharding_mongod_test_fixture.cpp index 6fa3565cab9..a91670bf753 100644 --- a/src/mongo/s/sharding_mongod_test_fixture.cpp +++ b/src/mongo/s/sharding_mongod_test_fixture.cpp @@ -146,7 +146,7 @@ void ShardingMongodTestFixture::setUp() { // Set the highest FCV because otherwise it defaults to the lower FCV. This way we default to // testing this release's code, not backwards compatibility code. serverGlobalParams.featureCompatibility.setVersion( - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40); + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42); } std::unique_ptr<ReplicationCoordinatorMock> ShardingMongodTestFixture::makeReplicationCoordinator( diff --git a/src/mongo/shell/dbshell.cpp b/src/mongo/shell/dbshell.cpp index 94b68ee43e3..bb0a82ffa02 100644 --- a/src/mongo/shell/dbshell.cpp +++ b/src/mongo/shell/dbshell.cpp @@ -97,10 +97,10 @@ const auto kDefaultMongoURL = "mongodb://127.0.0.1:27017"_sd; // 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")) +MONGO_INITIALIZER_WITH_PREREQUISITES(SetFeatureCompatibilityVersion42, ("EndStartupOptionSetup")) (InitializerContext* context) { mongo::serverGlobalParams.featureCompatibility.setVersion( - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40); + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42); return Status::OK(); } const auto kAuthParam = "authSource"s; diff --git a/src/mongo/shell/shardingtest.js b/src/mongo/shell/shardingtest.js index 29f710386b0..864c23b510c 100644 --- a/src/mongo/shell/shardingtest.js +++ b/src/mongo/shell/shardingtest.js @@ -1408,7 +1408,7 @@ var ShardingTest = function(params) { const configRS = this.configRS; if (_hasNewFeatureCompatibilityVersion() && _isMixedVersionCluster()) { function setFeatureCompatibilityVersion() { - assert.commandWorked(csrsPrimary.adminCommand({setFeatureCompatibilityVersion: '3.6'})); + assert.commandWorked(csrsPrimary.adminCommand({setFeatureCompatibilityVersion: '4.0'})); // Wait for the new featureCompatibilityVersion to propagate to all nodes in the CSRS // to ensure that older versions of mongos can successfully connect. diff --git a/src/mongo/unittest/unittest.cpp b/src/mongo/unittest/unittest.cpp index f3388758ba0..a1d6a81bdb3 100644 --- a/src/mongo/unittest/unittest.cpp +++ b/src/mongo/unittest/unittest.cpp @@ -184,7 +184,7 @@ void Test::run() { // with a meaningful value will trigger failures as of SERVER-32630. void Test::setUp() { serverGlobalParams.featureCompatibility.setVersion( - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40); + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42); } void Test::tearDown() { serverGlobalParams.featureCompatibility.reset(); |