diff options
author | Judah Schvimer <judah@mongodb.com> | 2017-10-26 10:34:39 -0400 |
---|---|---|
committer | Judah Schvimer <judah@mongodb.com> | 2017-10-26 10:34:39 -0400 |
commit | 0d8371f7e13b3455506f62d8e9129e4e66ed9a15 (patch) | |
tree | 135564174ed97cb774d645486d7c2db472939c02 /src/mongo | |
parent | 253d4c559450238d786e03d3c3118f02e6b9358f (diff) | |
download | mongo-0d8371f7e13b3455506f62d8e9129e4e66ed9a15.tar.gz |
SERVER-31608 remove FCV getters
Diffstat (limited to 'src/mongo')
35 files changed, 107 insertions, 73 deletions
diff --git a/src/mongo/db/auth/user_management_commands_parser.cpp b/src/mongo/db/auth/user_management_commands_parser.cpp index f206ab72b34..23907d80ca0 100644 --- a/src/mongo/db/auth/user_management_commands_parser.cpp +++ b/src/mongo/db/auth/user_management_commands_parser.cpp @@ -192,7 +192,8 @@ Status parseCreateOrUpdateUserCommands(const BSONObj& cmdObj, validFieldNames.insert("digestPassword"); validFieldNames.insert("pwd"); validFieldNames.insert("roles"); - if (serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { validFieldNames.insert("authenticationRestrictions"); } @@ -507,7 +508,8 @@ Status parseCreateOrUpdateRoleCommands(const BSONObj& cmdObj, validFieldNames.insert(cmdName.toString()); validFieldNames.insert("privileges"); validFieldNames.insert("roles"); - if (serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { validFieldNames.insert("authenticationRestrictions"); } diff --git a/src/mongo/db/catalog/coll_mod.cpp b/src/mongo/db/catalog/coll_mod.cpp index 977e9144dba..c006630d7b2 100644 --- a/src/mongo/db/catalog/coll_mod.cpp +++ b/src/mongo/db/catalog/coll_mod.cpp @@ -173,7 +173,8 @@ StatusWith<CollModRequest> parseCollModRequest(OperationContext* opCtx, MatchExpressionParser::AllowedFeatureSet allowedFeatures = MatchExpressionParser::kBanAllSpecialFeatures; if (!serverGlobalParams.validateFeaturesAsMaster.load() || - serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + (serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36)) { // Note that we don't enforce this restriction on the secondary or on backup // instances, as indicated by !validateFeaturesAsMaster. allowedFeatures |= MatchExpressionParser::kJSONSchema; diff --git a/src/mongo/db/catalog/database_impl.cpp b/src/mongo/db/catalog/database_impl.cpp index 0706f5a1479..c4c826566ee 100644 --- a/src/mongo/db/catalog/database_impl.cpp +++ b/src/mongo/db/catalog/database_impl.cpp @@ -772,7 +772,8 @@ Collection* DatabaseImpl::createCollection(OperationContext* opCtx, auto coordinator = repl::ReplicationCoordinator::get(opCtx); bool okayCreation = (coordinator->getReplicationMode() != repl::ReplicationCoordinator::modeReplSet || - !serverGlobalParams.featureCompatibility.isFullyUpgradedTo36() || + (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) || coordinator->canAcceptWritesForDatabase(opCtx, nss.db()) || nss.isSystemDotProfile()); // system.profile is special as it's not replicated if (!okayCreation) { @@ -1025,7 +1026,8 @@ auto mongo::userCreateNSImpl(OperationContext* opCtx, MatchExpressionParser::AllowedFeatureSet allowedFeatures = MatchExpressionParser::kBanAllSpecialFeatures; if (!serverGlobalParams.validateFeaturesAsMaster.load() || - serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + (serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36)) { // Note that we don't enforce this feature compatibility check when we are on // the secondary or on a backup instance, as indicated by !validateFeaturesAsMaster. allowedFeatures |= MatchExpressionParser::kJSONSchema; diff --git a/src/mongo/db/commands/dbcheck.cpp b/src/mongo/db/commands/dbcheck.cpp index fe7bcd178c6..9adf39f6b5e 100644 --- a/src/mongo/db/commands/dbcheck.cpp +++ b/src/mongo/db/commands/dbcheck.cpp @@ -550,7 +550,8 @@ public: private: bool _hasCorrectFCV(void) { - return serverGlobalParams.featureCompatibility.isFullyUpgradedTo36(); + return serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36; } }; diff --git a/src/mongo/db/commands/end_sessions_command.cpp b/src/mongo/db/commands/end_sessions_command.cpp index 3693c1971fd..fdaf5f37187 100644 --- a/src/mongo/db/commands/end_sessions_command.cpp +++ b/src/mongo/db/commands/end_sessions_command.cpp @@ -60,7 +60,8 @@ public: const std::string& dbname, const BSONObj& cmdObj) override { - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { return SessionsCommandFCV34Status(getName()); } @@ -81,7 +82,8 @@ public: const BSONObj& cmdObj, BSONObjBuilder& result) override { - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { return appendCommandStatus(result, SessionsCommandFCV34Status(getName())); } diff --git a/src/mongo/db/commands/feature_compatibility_version.cpp b/src/mongo/db/commands/feature_compatibility_version.cpp index c4b3053d4ce..32f4de091fd 100644 --- a/src/mongo/db/commands/feature_compatibility_version.cpp +++ b/src/mongo/db/commands/feature_compatibility_version.cpp @@ -275,7 +275,8 @@ void uassertDuringRollbackOnDowngradeOp( ServerGlobalParams::FeatureCompatibility::Version newVersion, std::string msg) { if ((newVersion != ServerGlobalParams::FeatureCompatibility::Version::kDowngradingTo34) || - (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36())) { + (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36)) { // This is only the start of a downgrade operation if we're currently upgraded to 3.6. return; } diff --git a/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp b/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp index 30590d93739..d0f7b0d1368 100644 --- a/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp +++ b/src/mongo/db/commands/kill_all_sessions_by_pattern_command.cpp @@ -73,7 +73,8 @@ public: const std::string& dbname, const BSONObj& cmdObj) override { - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { return SessionsCommandFCV34Status(getName()); } @@ -91,7 +92,8 @@ public: const BSONObj& cmdObj, BSONObjBuilder& result) override { - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { return appendCommandStatus(result, SessionsCommandFCV34Status(getName())); } diff --git a/src/mongo/db/commands/kill_all_sessions_command.cpp b/src/mongo/db/commands/kill_all_sessions_command.cpp index 452a25cc6b5..d0ef93cb466 100644 --- a/src/mongo/db/commands/kill_all_sessions_command.cpp +++ b/src/mongo/db/commands/kill_all_sessions_command.cpp @@ -73,7 +73,8 @@ public: const std::string& dbname, const BSONObj& cmdObj) override { - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { return SessionsCommandFCV34Status(getName()); } @@ -91,7 +92,8 @@ public: const BSONObj& cmdObj, BSONObjBuilder& result) override { - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { return appendCommandStatus(result, SessionsCommandFCV34Status(getName())); } diff --git a/src/mongo/db/commands/kill_sessions_command.cpp b/src/mongo/db/commands/kill_sessions_command.cpp index 9e6c9e05dc1..9336cf1f588 100644 --- a/src/mongo/db/commands/kill_sessions_command.cpp +++ b/src/mongo/db/commands/kill_sessions_command.cpp @@ -102,7 +102,8 @@ public: const std::string& dbname, const BSONObj& cmdObj) override { - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { return SessionsCommandFCV34Status(getName()); } @@ -114,7 +115,8 @@ public: const BSONObj& cmdObj, BSONObjBuilder& result) override { - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { return appendCommandStatus(result, SessionsCommandFCV34Status(getName())); } diff --git a/src/mongo/db/commands/refresh_logical_session_cache_now.cpp b/src/mongo/db/commands/refresh_logical_session_cache_now.cpp index cf4d6a713c4..8629d98e287 100644 --- a/src/mongo/db/commands/refresh_logical_session_cache_now.cpp +++ b/src/mongo/db/commands/refresh_logical_session_cache_now.cpp @@ -66,7 +66,8 @@ public: const std::string& dbname, const BSONObj& cmdObj) override { - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { return SessionsCommandFCV34Status(getName()); } @@ -78,7 +79,8 @@ public: const BSONObj& cmdObj, BSONObjBuilder& result) override { - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { return appendCommandStatus(result, SessionsCommandFCV34Status(getName())); } diff --git a/src/mongo/db/commands/refresh_sessions_command.cpp b/src/mongo/db/commands/refresh_sessions_command.cpp index c8dc0b31914..8e65c32fa9d 100644 --- a/src/mongo/db/commands/refresh_sessions_command.cpp +++ b/src/mongo/db/commands/refresh_sessions_command.cpp @@ -62,7 +62,8 @@ public: const std::string& dbname, const BSONObj& cmdObj) override { - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { return SessionsCommandFCV34Status(getName()); } @@ -83,7 +84,8 @@ public: const BSONObj& cmdObj, BSONObjBuilder& result) override { - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { return appendCommandStatus(result, SessionsCommandFCV34Status(getName())); } 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 41fc9853f5e..9dfb4985ae4 100644 --- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp +++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp @@ -118,7 +118,8 @@ public: uassert(ErrorCodes::IllegalOperation, "cannot initiate featureCompatibilityVersion upgrade while a previous " "featureCompatibilityVersion downgrade has not completed", - !serverGlobalParams.featureCompatibility.isDowngradingTo34()); + serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kDowngradingTo34); FeatureCompatibilityVersion::setTargetUpgrade(opCtx); @@ -154,7 +155,8 @@ public: uassert(ErrorCodes::IllegalOperation, "cannot initiate featureCompatibilityVersion downgrade while a previous " "featureCompatibilityVersion upgrade has not completed", - !serverGlobalParams.featureCompatibility.isUpgradingTo36()); + serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo36); FeatureCompatibilityVersion::setTargetDowngrade(opCtx); diff --git a/src/mongo/db/commands/start_session_command.cpp b/src/mongo/db/commands/start_session_command.cpp index 6454bc2dc50..70b153b6789 100644 --- a/src/mongo/db/commands/start_session_command.cpp +++ b/src/mongo/db/commands/start_session_command.cpp @@ -67,7 +67,8 @@ public: const std::string& dbname, const BSONObj& cmdObj) override { - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { return SessionsCommandFCV34Status(getName()); } @@ -79,7 +80,8 @@ public: const BSONObj& cmdObj, BSONObjBuilder& result) override { - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { return appendCommandStatus(result, SessionsCommandFCV34Status(getName())); } diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp index b5c3ca89355..458637cfdec 100644 --- a/src/mongo/db/db.cpp +++ b/src/mongo/db/db.cpp @@ -1204,7 +1204,8 @@ void shutdownTask() { opCtx = uniqueOpCtx.get(); } - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { log(LogComponent::kReplication) << "shutdown: removing all drop-pending collections..."; repl::DropPendingCollectionReaper::get(serviceContext) ->dropCollectionsOlderThan(opCtx, repl::OpTime::max()); diff --git a/src/mongo/db/initialize_operation_session_info.cpp b/src/mongo/db/initialize_operation_session_info.cpp index a3ca5b66eb1..87003e8cc80 100644 --- a/src/mongo/db/initialize_operation_session_info.cpp +++ b/src/mongo/db/initialize_operation_session_info.cpp @@ -46,7 +46,8 @@ void initializeOperationSessionInfo(OperationContext* opCtx, return; } - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { return; } diff --git a/src/mongo/db/keys_collection_cache_reader_and_updater.cpp b/src/mongo/db/keys_collection_cache_reader_and_updater.cpp index 65efb639e6b..d18eb2b1da0 100644 --- a/src/mongo/db/keys_collection_cache_reader_and_updater.cpp +++ b/src/mongo/db/keys_collection_cache_reader_and_updater.cpp @@ -83,7 +83,8 @@ StatusWith<KeysCollectionDocument> KeysCollectionCacheReaderAndUpdater::refresh( return {ErrorCodes::FailPointEnabled, "key generation disabled"}; } - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { return KeysCollectionCacheReader::refresh(opCtx); } diff --git a/src/mongo/db/keys_collection_manager_sharding.cpp b/src/mongo/db/keys_collection_manager_sharding.cpp index 265dbf9e51f..13bac7a5359 100644 --- a/src/mongo/db/keys_collection_manager_sharding.cpp +++ b/src/mongo/db/keys_collection_manager_sharding.cpp @@ -236,7 +236,8 @@ void KeysCollectionManagerSharding::PeriodicRunner::_doPeriodicRefresh( Milliseconds nextWakeup = kRefreshIntervalIfErrored; // No need to refresh keys in FCV 3.4, since key generation will be disabled. - if (serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { auto latestKeyStatusWith = (*doRefresh)(opCtx.get()); if (latestKeyStatusWith.getStatus().isOK()) { errorCount = 0; diff --git a/src/mongo/db/logical_session_cache_impl.cpp b/src/mongo/db/logical_session_cache_impl.cpp index 6cb5287f32b..b8b34c07b5f 100644 --- a/src/mongo/db/logical_session_cache_impl.cpp +++ b/src/mongo/db/logical_session_cache_impl.cpp @@ -199,7 +199,8 @@ Status LogicalSessionCacheImpl::_reap(Client* client) { void LogicalSessionCacheImpl::_refresh(Client* client) { // Do not run this job if we are not in FCV 3.6 - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { LOG(1) << "Skipping session refresh job while feature compatibility version is not 3.6"; return; } diff --git a/src/mongo/db/logical_time_metadata_hook.cpp b/src/mongo/db/logical_time_metadata_hook.cpp index 12745e8d793..ffe1ebcac5c 100644 --- a/src/mongo/db/logical_time_metadata_hook.cpp +++ b/src/mongo/db/logical_time_metadata_hook.cpp @@ -75,7 +75,8 @@ Status LogicalTimeMetadataHook::readReplyMetadata(OperationContext* opCtx, return Status::OK(); } - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { return Status::OK(); } diff --git a/src/mongo/db/ops/parsed_update.cpp b/src/mongo/db/ops/parsed_update.cpp index aecf7c30794..7dd6444bc6b 100644 --- a/src/mongo/db/ops/parsed_update.cpp +++ b/src/mongo/db/ops/parsed_update.cpp @@ -160,7 +160,8 @@ Status ParsedUpdate::parseUpdate() { Status ParsedUpdate::parseArrayFilters() { if (!_request->getArrayFilters().empty() && - !serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36)) { return Status(ErrorCodes::InvalidOptions, str::stream() << "The featureCompatibilityVersion must be 3.6 to use arrayFilters. See " diff --git a/src/mongo/db/pipeline/document_source_change_stream.cpp b/src/mongo/db/pipeline/document_source_change_stream.cpp index b42cb41bdc0..e08e94d0d9a 100644 --- a/src/mongo/db/pipeline/document_source_change_stream.cpp +++ b/src/mongo/db/pipeline/document_source_change_stream.cpp @@ -278,7 +278,8 @@ list<intrusive_ptr<DocumentSource>> DocumentSourceChangeStream::createFromBson( << "The featureCompatibilityVersion must be 3.6 to use the $changeStream stage. See " << feature_compatibility_version::kDochubLink << ".", - serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()); + serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36); // A change stream is a tailable + awaitData cursor. expCtx->tailableMode = TailableMode::kTailableAndAwaitData; diff --git a/src/mongo/db/read_concern.cpp b/src/mongo/db/read_concern.cpp index f79fd3541f4..f5f36e46ea3 100644 --- a/src/mongo/db/read_concern.cpp +++ b/src/mongo/db/read_concern.cpp @@ -213,7 +213,8 @@ Status waitForReadConcern(OperationContext* opCtx, const repl::ReadConcernArgs& auto afterClusterTime = readConcernArgs.getArgsClusterTime(); if (afterClusterTime) { - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36() && + if ((serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) && ShardingState::get(opCtx)->enabled()) { return {ErrorCodes::InvalidOptions, "readConcern afterClusterTime is not available in featureCompatibilityVersion " diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp index 3e7147c1ba0..dc3bc01c529 100644 --- a/src/mongo/db/repl/bgsync.cpp +++ b/src/mongo/db/repl/bgsync.cpp @@ -684,7 +684,8 @@ void BackgroundSync::_runRollback(OperationContext* opCtx, opCtx, source, &localOplog, storageInterface, getConnection); } else if (rollbackMethod != kRollbackViaRefetchNoUUID && - (serverGlobalParams.featureCompatibility.isFullyUpgradedTo36())) { + (serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36)) { // If the user is in FCV 3.6 and the user did not specify to fall back on "roll back via // refetch" without UUID support, then we use "roll back via refetch" with UUIDs. @@ -702,12 +703,14 @@ void BackgroundSync::_runRollback(OperationContext* opCtx, } else { if (rollbackMethod == kRollbackToCheckpoint) { invariant(!supportsCheckpointRollback); - invariant(!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()); + invariant(serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36); log() << "Rollback using the 'rollbackViaRefetchNoUUID' method because this storage " "engine does not support 'roll back to a checkpoint' and we are " "in featureCompatibilityVersion 3.4."; } else if (rollbackMethod == kRollbackViaRefetch) { - invariant(!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()); + invariant(serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36); log() << "Rollback using the 'rollbackViaRefetchNoUUID' method. 'rollbackViaRefetch' " "with UUID support is not feature compatible with featureCompatabilityVersion " "3.4."; diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp index 8fd70dff826..567a9be6335 100644 --- a/src/mongo/db/repl/oplog.cpp +++ b/src/mongo/db/repl/oplog.cpp @@ -345,7 +345,9 @@ OplogDocWriter _logOpWriter(OperationContext* opCtx, if (o2) b.append("o2", *o2); - if (wallTime != Date_t{} && serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (wallTime != Date_t{} && + (serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36)) { b.appendDate("wall", wallTime); } diff --git a/src/mongo/db/repl/oplog_fetcher.cpp b/src/mongo/db/repl/oplog_fetcher.cpp index 12cc813de49..aff0170db14 100644 --- a/src/mongo/db/repl/oplog_fetcher.cpp +++ b/src/mongo/db/repl/oplog_fetcher.cpp @@ -367,7 +367,8 @@ BSONObj OplogFetcher::_makeFindCommandObject(const NamespaceString& nss, // TODO(SERVER-30977): Remove the term comparison when this ticket is fixed. if (term == lastOpTimeFetched.getTerm()) { cmdBob.append("readConcern", - !serverGlobalParams.featureCompatibility.isFullyUpgradedTo36() + (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) ? BSON("afterOpTime" << lastOpTimeFetched) : BSON("afterClusterTime" << lastOpTimeFetched.getTimestamp())); } diff --git a/src/mongo/db/repl/oplog_fetcher_test.cpp b/src/mongo/db/repl/oplog_fetcher_test.cpp index 35af92df177..598d8faa245 100644 --- a/src/mongo/db/repl/oplog_fetcher_test.cpp +++ b/src/mongo/db/repl/oplog_fetcher_test.cpp @@ -282,7 +282,8 @@ TEST_F(OplogFetcherTest, FindQueryHasNoReadconcernIfTermUninitialized) { TEST_F(OplogFetcherTest, FindQueryHasAfterOpTimeWithFeatureCompatibilityVersion34) { EnsureFCV ensureFCV(EnsureFCV::Version::kFullyDowngradedTo34); - ASSERT(!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()); + ASSERT(serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36); auto cmdObj = makeOplogFetcher(_createConfig(true))->getFindQuery_forTest(); auto readConcernElem = cmdObj["readConcern"]; ASSERT_EQUALS(mongo::BSONType::Object, readConcernElem.type()); @@ -294,7 +295,8 @@ TEST_F(OplogFetcherTest, FindQueryHasAfterOpTimeWithFeatureCompatibilityVersion3 TEST_F(OplogFetcherTest, FindQueryHasAfterOpTimeWithFeatureCompatibilityVersion36) { EnsureFCV ensureFCV(EnsureFCV::Version::kFullyUpgradedTo36); - ASSERT(serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()); + ASSERT(serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36); auto cmdObj = makeOplogFetcher(_createConfig(true))->getFindQuery_forTest(); auto readConcernElem = cmdObj["readConcern"]; ASSERT_EQUALS(mongo::BSONType::Object, readConcernElem.type()); diff --git a/src/mongo/db/repl/replication_consistency_markers_impl.cpp b/src/mongo/db/repl/replication_consistency_markers_impl.cpp index 39fc82c321b..27cc61c0271 100644 --- a/src/mongo/db/repl/replication_consistency_markers_impl.cpp +++ b/src/mongo/db/repl/replication_consistency_markers_impl.cpp @@ -277,7 +277,8 @@ Timestamp ReplicationConsistencyMarkersImpl::getOplogTruncateAfterPoint( OperationContext* opCtx) const { auto doc = _getOplogTruncateAfterPointDocument(opCtx); if (!doc) { - if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { LOG(3) << "Falling back on old oplog delete from point because there is no oplog " "truncate after point and we are in FCV 3.4."; return _getOldOplogDeleteFromPoint(opCtx); diff --git a/src/mongo/db/s/migration_source_manager.cpp b/src/mongo/db/s/migration_source_manager.cpp index d1ed1b7be88..7261283268f 100644 --- a/src/mongo/db/s/migration_source_manager.cpp +++ b/src/mongo/db/s/migration_source_manager.cpp @@ -230,7 +230,8 @@ Status MigrationSourceManager::enterCriticalSection(OperationContext* opCtx) { const ShardId& recipientId = _args.getToShardId(); if (!_collectionMetadata->getChunkManager()->getVersion(recipientId).isSet() && - serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + (serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36)) { // The recipient didn't have any chunks of this collection. Write the no-op message so that // change stream will notice that and close cursor to notify mongos to target to the new // shard. diff --git a/src/mongo/db/server_options.h b/src/mongo/db/server_options.h index 1c84b5d33ad..85bd5e8964f 100644 --- a/src/mongo/db/server_options.h +++ b/src/mongo/db/server_options.h @@ -210,29 +210,10 @@ struct ServerGlobalParams { return _version.store(version); } - // Deprecated. Please use getVersion() directly instead. - const bool isFullyUpgradedTo36() { - return (getVersion() == Version::kFullyUpgradedTo36); - } - - // Deprecated. Please use getVersion() directly instead. - const bool isUpgradingTo36() { - return (getVersion() == Version::kUpgradingTo36); - } - - // Deprecated. Please use getVersion() directly instead. - const bool isFullyDowngradedTo34() { - return (getVersion() == Version::kFullyDowngradedTo34); - } - - // Deprecated. Please use getVersion() directly instead. - const bool isDowngradingTo34() { - return (getVersion() == Version::kDowngradingTo34); - } - // This determines whether to give Collections UUIDs upon creation. const bool isSchemaVersion36() { - return (isFullyUpgradedTo36() || isUpgradingTo36()); + return (getVersion() == Version::kFullyUpgradedTo36 || + getVersion() == Version::kUpgradingTo36); } private: diff --git a/src/mongo/db/service_entry_point_mongod.cpp b/src/mongo/db/service_entry_point_mongod.cpp index fb93a273413..29cb58eb0da 100644 --- a/src/mongo/db/service_entry_point_mongod.cpp +++ b/src/mongo/db/service_entry_point_mongod.cpp @@ -259,7 +259,8 @@ void appendReplyMetadataOnError(OperationContext* opCtx, BSONObjBuilder* metadat replCoord->getReplicationMode() == repl::ReplicationCoordinator::modeReplSet; if (isReplSet) { - if (serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { if (LogicalTimeValidator::isAuthorizedToAdvanceClock(opCtx)) { // No need to sign cluster times for internal clients. SignedLogicalTime currentTime( @@ -297,7 +298,8 @@ void appendReplyMetadata(OperationContext* opCtx, .writeToMetadata(metadataBob) .transitional_ignore(); } - if (serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { if (LogicalTimeValidator::isAuthorizedToAdvanceClock(opCtx)) { // No need to sign cluster times for internal clients. SignedLogicalTime currentTime( @@ -532,7 +534,8 @@ bool runCommandImpl(OperationContext* opCtx, // An uninitialized operation time means the cluster time is not propagated, so the operation // time should not be attached to the response. if (operationTime != LogicalTime::kUninitialized && - serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + (serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36)) { operationTime.appendAsOperationTime(&inPlaceReplyBob); } @@ -710,7 +713,8 @@ void execCommandDatabase(OperationContext* opCtx, if (!opCtx->getClient()->isInDirectClient() && readConcernArgs.getLevel() != repl::ReadConcernLevel::kAvailableReadConcern && (iAmPrimary || - (serverGlobalParams.featureCompatibility.isFullyUpgradedTo36() && + ((serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) && (readConcernArgs.hasLevel() || readConcernArgs.getArgsClusterTime())))) { oss.initializeShardVersion(NamespaceString(command->parseNs(dbname, request.body)), shardVersionFieldIdx); @@ -778,7 +782,8 @@ void execCommandDatabase(OperationContext* opCtx, // An uninitialized operation time means the cluster time is not propagated, so the // operation time should not be attached to the error response. if (operationTime != LogicalTime::kUninitialized && - serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + (serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36)) { LOG(1) << "assertion while executing command '" << request.getCommandName() << "' " << "on database '" << request.getDatabase() << "' " << "with arguments '" << command->getRedactedCopyForLogging(request.body) diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index 1f5c11e1aa0..8e224876874 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -498,7 +498,8 @@ void WiredTigerKVEngine::cleanShutdown() { // Only downgrade when the fCV document has been explicitly initialized and is 3.4. const bool needsDowngrade = !_readOnly && serverGlobalParams.featureCompatibility.isVersionInitialized() && - serverGlobalParams.featureCompatibility.isFullyDowngradedTo34(); + (serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo34); invariantWTOK(_conn->close(_conn, closeConfig)); _conn = nullptr; diff --git a/src/mongo/db/update/update_driver.cpp b/src/mongo/db/update/update_driver.cpp index fb076acf98d..a09dc6635ec 100644 --- a/src/mongo/db/update/update_driver.cpp +++ b/src/mongo/db/update/update_driver.cpp @@ -198,7 +198,8 @@ Status UpdateDriver::parse( } else if (_modOptions.fromOplogApplication) { updateSemantics = UpdateSemantics::kModifierInterface; } else { - updateSemantics = (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) + updateSemantics = (serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) ? UpdateSemantics::kModifierInterface : UpdateSemantics::kUpdateNode; } diff --git a/src/mongo/db/views/view_catalog.cpp b/src/mongo/db/views/view_catalog.cpp index 7938084d9f5..7bba174bd57 100644 --- a/src/mongo/db/views/view_catalog.cpp +++ b/src/mongo/db/views/view_catalog.cpp @@ -314,7 +314,8 @@ StatusWith<stdx::unordered_set<NamespaceString>> ViewCatalog::_validatePipeline_ } if (serverGlobalParams.validateFeaturesAsMaster.load() && - !serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { auto status = validInViewUnder34FeatureCompatibility(expCtx, *pipelineStatus.getValue()); if (!status.isOK()) { return status; diff --git a/src/mongo/rpc/metadata.cpp b/src/mongo/rpc/metadata.cpp index c4488220493..b59ef935ea9 100644 --- a/src/mongo/rpc/metadata.cpp +++ b/src/mongo/rpc/metadata.cpp @@ -101,7 +101,8 @@ void readRequestMetadata(OperationContext* opCtx, const BSONObj& metadataObj) { if (signedTime.getTime() != LogicalTime::kUninitialized) { // Cluster times are only sent by sharding aware mongod servers, so this point is only // reached in sharded clusters. - if (serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { + if (serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { auto logicalTimeValidator = LogicalTimeValidator::get(opCtx); if (!LogicalTimeValidator::isAuthorizedToAdvanceClock(opCtx)) { if (!logicalTimeValidator) { diff --git a/src/mongo/s/catalog/sharding_catalog_manager_shard_operations.cpp b/src/mongo/s/catalog/sharding_catalog_manager_shard_operations.cpp index 6aaa1b4f8bc..38b8295e1c9 100644 --- a/src/mongo/s/catalog/sharding_catalog_manager_shard_operations.cpp +++ b/src/mongo/s/catalog/sharding_catalog_manager_shard_operations.cpp @@ -340,9 +340,11 @@ StatusWith<ShardType> ShardingCatalogManager::_validateHostAsShard( << " as a shard: " << status.reason()); } - if ((serverGlobalParams.featureCompatibility.isFullyUpgradedTo36() && + if (((serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) && maxWireVersion < WireVersion::LATEST_WIRE_VERSION) || - (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36() && + ((serverGlobalParams.featureCompatibility.getVersion() != + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) && maxWireVersion < WireVersion::LATEST_WIRE_VERSION - 1)) { return {ErrorCodes::IncompatibleServerVersion, str::stream() << "Cannot add " << connectionString.toString() |