diff options
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r-- | src/mongo/db/repl/bgsync.cpp | 9 | ||||
-rw-r--r-- | src/mongo/db/repl/idempotency_test.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog_fetcher.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog_fetcher_test.cpp | 12 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_consistency_markers_impl.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_consistency_markers_impl_test.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_info.cpp | 2 |
8 files changed, 17 insertions, 26 deletions
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp index 21c88b4f6d3..447d0949d7a 100644 --- a/src/mongo/db/repl/bgsync.cpp +++ b/src/mongo/db/repl/bgsync.cpp @@ -679,8 +679,7 @@ void BackgroundSync::_runRollback(OperationContext* opCtx, opCtx, source, &localOplog, storageInterface, getConnection); } else if (rollbackMethod != kRollbackViaRefetchNoUUID && - (serverGlobalParams.featureCompatibility.version.load() == - ServerGlobalParams::FeatureCompatibility::Version::k36)) { + (serverGlobalParams.featureCompatibility.isFullyUpgradedTo36())) { // 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. @@ -698,14 +697,12 @@ void BackgroundSync::_runRollback(OperationContext* opCtx, } else { if (rollbackMethod == kRollbackToCheckpoint) { invariant(!supportsCheckpointRollback); - invariant(serverGlobalParams.featureCompatibility.version.load() == - ServerGlobalParams::FeatureCompatibility::Version::k34); + invariant(!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()); 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.version.load() == - ServerGlobalParams::FeatureCompatibility::Version::k34); + invariant(!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()); 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/idempotency_test.cpp b/src/mongo/db/repl/idempotency_test.cpp index 84a03172947..b6d44eff367 100644 --- a/src/mongo/db/repl/idempotency_test.cpp +++ b/src/mongo/db/repl/idempotency_test.cpp @@ -193,13 +193,13 @@ void RandomizedIdempotencyTest::runIdempotencyTestCase() { } TEST_F(RandomizedIdempotencyTest, CheckUpdateSequencesAreIdempotentWhenFCV34) { - serverGlobalParams.featureCompatibility.version.store( + serverGlobalParams.featureCompatibility.setVersion( ServerGlobalParams::FeatureCompatibility::Version::k34); runIdempotencyTestCase(); } TEST_F(RandomizedIdempotencyTest, CheckUpdateSequencesAreIdempotentWhenFCV36) { - serverGlobalParams.featureCompatibility.version.store( + serverGlobalParams.featureCompatibility.setVersion( ServerGlobalParams::FeatureCompatibility::Version::k36); runIdempotencyTestCase(); } diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp index 99d2e0c3929..110909ffd6c 100644 --- a/src/mongo/db/repl/oplog.cpp +++ b/src/mongo/db/repl/oplog.cpp @@ -344,9 +344,7 @@ OplogDocWriter _logOpWriter(OperationContext* opCtx, if (o2) b.append("o2", *o2); - if (wallTime != Date_t{} && - serverGlobalParams.featureCompatibility.version.load() != - ServerGlobalParams::FeatureCompatibility::Version::k34) { + if (wallTime != Date_t{} && serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { b.appendDate("wall", wallTime); } diff --git a/src/mongo/db/repl/oplog_fetcher.cpp b/src/mongo/db/repl/oplog_fetcher.cpp index b4b0b024e4f..12cc813de49 100644 --- a/src/mongo/db/repl/oplog_fetcher.cpp +++ b/src/mongo/db/repl/oplog_fetcher.cpp @@ -367,8 +367,7 @@ 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.version.load() == - ServerGlobalParams::FeatureCompatibility::Version::k34 + !serverGlobalParams.featureCompatibility.isFullyUpgradedTo36() ? 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 c87542c9e12..b2195e50710 100644 --- a/src/mongo/db/repl/oplog_fetcher_test.cpp +++ b/src/mongo/db/repl/oplog_fetcher_test.cpp @@ -269,11 +269,11 @@ class EnsureFCV { public: using Version = ServerGlobalParams::FeatureCompatibility::Version; EnsureFCV(Version version) - : _version(version), _origVersion(serverGlobalParams.featureCompatibility.version.load()) { - serverGlobalParams.featureCompatibility.version.store(_version); + : _version(version), _origVersion(serverGlobalParams.featureCompatibility.getVersion()) { + serverGlobalParams.featureCompatibility.setVersion(_version); } ~EnsureFCV() { - serverGlobalParams.featureCompatibility.version.store(_origVersion); + serverGlobalParams.featureCompatibility.setVersion(_origVersion); } private: @@ -297,8 +297,7 @@ TEST_F(OplogFetcherTest, FindQueryHasNoReadconcernIfTermUninitialized) { TEST_F(OplogFetcherTest, FindQueryHasAfterOpTimeWithFeatureCompatibilityVersion34) { EnsureFCV ensureFCV(EnsureFCV::Version::k34); - ASSERT(serverGlobalParams.featureCompatibility.version.load() == - ServerGlobalParams::FeatureCompatibility::Version::k34); + ASSERT(!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()); auto cmdObj = makeOplogFetcher(_createConfig(true))->getFindQuery_forTest(); auto readConcernElem = cmdObj["readConcern"]; ASSERT_EQUALS(mongo::BSONType::Object, readConcernElem.type()); @@ -310,8 +309,7 @@ TEST_F(OplogFetcherTest, FindQueryHasAfterOpTimeWithFeatureCompatibilityVersion3 TEST_F(OplogFetcherTest, FindQueryHasAfterOpTimeWithFeatureCompatibilityVersion36) { EnsureFCV ensureFCV(EnsureFCV::Version::k36); - ASSERT(serverGlobalParams.featureCompatibility.version.load() != - ServerGlobalParams::FeatureCompatibility::Version::k34); + ASSERT(serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()); 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 c4be7496074..39fc82c321b 100644 --- a/src/mongo/db/repl/replication_consistency_markers_impl.cpp +++ b/src/mongo/db/repl/replication_consistency_markers_impl.cpp @@ -277,8 +277,7 @@ Timestamp ReplicationConsistencyMarkersImpl::getOplogTruncateAfterPoint( OperationContext* opCtx) const { auto doc = _getOplogTruncateAfterPointDocument(opCtx); if (!doc) { - if (serverGlobalParams.featureCompatibility.version.load() == - ServerGlobalParams::FeatureCompatibility::Version::k34) { + if (!serverGlobalParams.featureCompatibility.isFullyUpgradedTo36()) { 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/repl/replication_consistency_markers_impl_test.cpp b/src/mongo/db/repl/replication_consistency_markers_impl_test.cpp index bb3199e2a62..105613c516f 100644 --- a/src/mongo/db/repl/replication_consistency_markers_impl_test.cpp +++ b/src/mongo/db/repl/replication_consistency_markers_impl_test.cpp @@ -316,7 +316,7 @@ TEST_F(ReplicationConsistencyMarkersTest, OplogTruncateAfterPointUpgrade) { consistencyMarkers.initializeMinValidDocument(opCtx); // Set the feature compatibility version to 3.6. - serverGlobalParams.featureCompatibility.version.store( + serverGlobalParams.featureCompatibility.setVersion( ServerGlobalParams::FeatureCompatibility::Version::k36); // Check that we see no oplog truncate after point in FCV 3.6. @@ -324,7 +324,7 @@ TEST_F(ReplicationConsistencyMarkersTest, OplogTruncateAfterPointUpgrade) { ASSERT_EQ(consistencyMarkers.getMinValid(opCtx), minValidTime); // Set the feature compatibility version to 3.4. - serverGlobalParams.featureCompatibility.version.store( + serverGlobalParams.featureCompatibility.setVersion( ServerGlobalParams::FeatureCompatibility::Version::k34); // Check that we see the old oplog delete from point in FCV 3.4. @@ -347,7 +347,7 @@ TEST_F(ReplicationConsistencyMarkersTest, OplogTruncateAfterPointUpgrade) { ASSERT_EQ(consistencyMarkers.getMinValid(opCtx), minValidTime); // Set the feature compatibility version to 3.6. - serverGlobalParams.featureCompatibility.version.store( + serverGlobalParams.featureCompatibility.setVersion( ServerGlobalParams::FeatureCompatibility::Version::k36); // Check that after removing the old oplog delete from point, that we do not see the oplog diff --git a/src/mongo/db/repl/replication_info.cpp b/src/mongo/db/repl/replication_info.cpp index e29d748aa37..f27e1608e73 100644 --- a/src/mongo/db/repl/replication_info.cpp +++ b/src/mongo/db/repl/replication_info.cpp @@ -363,7 +363,7 @@ public: // Then if the connection is from a mongod/mongos of an earlier version, it will fail to // connect. if (internalClientElement && - serverGlobalParams.featureCompatibility.version.load() == + serverGlobalParams.featureCompatibility.getVersion() == ServerGlobalParams::FeatureCompatibility::Version::k36) { result.append("minWireVersion", WireSpec::instance().incoming.maxWireVersion); } else { |