diff options
-rw-r--r-- | src/mongo/db/repl/repl_set_commands.cpp | 9 | ||||
-rw-r--r-- | src/mongo/db/repl/repl_set_config_checks.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/repl/repl_set_config_checks_test.cpp | 14 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl.cpp | 26 |
4 files changed, 9 insertions, 45 deletions
diff --git a/src/mongo/db/repl/repl_set_commands.cpp b/src/mongo/db/repl/repl_set_commands.cpp index 11ff4550d27..e3cfe46a459 100644 --- a/src/mongo/db/repl/repl_set_commands.cpp +++ b/src/mongo/db/repl/repl_set_commands.cpp @@ -439,13 +439,8 @@ public: uassertStatusOK(status); // Now that the new config has been persisted and installed in memory, wait for the new - // config to become committed. For force reconfigs we don't need to do this waiting, and in - // any FCV < 4.4 we also bypass this to preserve client facing behavior in mixed version - // sets. - if (!parsedArgs.force && - serverGlobalParams.featureCompatibility.isVersion( - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44) && - enableSafeReplicaSetReconfig) { + // config to become committed. For force reconfigs we don't need to do this waiting. + if (!parsedArgs.force && enableSafeReplicaSetReconfig) { uassertStatusOK(replCoord->awaitConfigCommitment(opCtx)); } diff --git a/src/mongo/db/repl/repl_set_config_checks.cpp b/src/mongo/db/repl/repl_set_config_checks.cpp index e55ab04f905..3286b69e46b 100644 --- a/src/mongo/db/repl/repl_set_config_checks.cpp +++ b/src/mongo/db/repl/repl_set_config_checks.cpp @@ -363,10 +363,7 @@ StatusWith<int> validateConfigForReconfig(ReplicationCoordinatorExternalState* e // For non-force reconfigs, verify that the reconfig only adds or removes a single node. This // ensures that all quorums of the new config overlap with all quorums of the old config. - if (!force && - serverGlobalParams.featureCompatibility.getVersion() == - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44 && - enableSafeReplicaSetReconfig) { + if (!force && enableSafeReplicaSetReconfig) { status = validateSingleNodeChange(oldConfig, newConfig); if (!status.isOK()) { return StatusWith<int>(status); diff --git a/src/mongo/db/repl/repl_set_config_checks_test.cpp b/src/mongo/db/repl/repl_set_config_checks_test.cpp index 9654e9217e0..d68cab85d05 100644 --- a/src/mongo/db/repl/repl_set_config_checks_test.cpp +++ b/src/mongo/db/repl/repl_set_config_checks_test.cpp @@ -1103,20 +1103,6 @@ TEST_F(ServiceContextTest, ValidateForReconfig_MultiNodeRemovalDisallowed) { validateMemberReconfig(oldMembers, newMembers, m1)); } -TEST_F(ServiceContextTest, ValidateForReconfig_MultiNodeAdditionAllowedFCV42) { - EnsureFCV fcv{ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo42}; - BSONArray oldMembers = BSON_ARRAY(m1 << m2); - BSONArray newMembers = BSON_ARRAY(m1 << m2 << m3 << m4); // add 2 voting nodes. - ASSERT_OK(validateMemberReconfig(oldMembers, newMembers, m1)); -} - -TEST_F(ServiceContextTest, ValidateForReconfig_MultiNodeRemovalAllowedFCV42) { - EnsureFCV fcv{ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo42}; - BSONArray oldMembers = BSON_ARRAY(m1 << m2 << m3 << m4); - BSONArray newMembers = BSON_ARRAY(m1 << m2); // remove 2 voting nodes. - ASSERT_OK(validateMemberReconfig(oldMembers, newMembers, m1)); -} - TEST_F(ServiceContextTest, ValidateForReconfig_MultiNodeAdditionOfNonVotingNodesAllowed) { BSONArray oldMembers = BSON_ARRAY(m1 << m2); BSONArray newMembers = diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index 80d548b7716..16ba689edab 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -3011,10 +3011,7 @@ void ReplicationCoordinatorImpl::cancelAndRescheduleElectionTimeout() { EventHandle ReplicationCoordinatorImpl::_processReplSetMetadata_inlock( const rpc::ReplSetMetadata& replMetadata) { - // If we're in FCV 4.4, allow metadata updates between config versions. - if (!serverGlobalParams.featureCompatibility.isVersion( - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44) || - !enableSafeReplicaSetReconfig) { + if (!enableSafeReplicaSetReconfig) { if (replMetadata.getConfigVersion() != _rsConfig.getConfigVersion()) { return EventHandle(); } @@ -3125,12 +3122,10 @@ Status ReplicationCoordinatorImpl::processReplSetReconfig(OperationContext* opCt long long currentTerm) -> StatusWith<ReplSetConfig> { ReplSetConfig newConfig; - // Only explicitly set configTerm for reconfig to this node's term if we're in FCV 4.4. - // Otherwise, use -1. - auto useSafeReconfig = serverGlobalParams.featureCompatibility.isVersion( - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44); - useSafeReconfig = useSafeReconfig && enableSafeReplicaSetReconfig; - auto term = (!args.force && useSafeReconfig) ? currentTerm : OpTime::kUninitializedTerm; + // Only explicitly set configTerm for reconfig to this node's term if safe reconfig is + // enabled. Otherwise, use -1. + auto term = (!args.force && enableSafeReplicaSetReconfig) ? currentTerm + : OpTime::kUninitializedTerm; // When initializing a new config through the replSetReconfig command, ignore the term // field passed in through its args. Instead, use this node's term. @@ -3265,9 +3260,7 @@ Status ReplicationCoordinatorImpl::doReplSetReconfig(OperationContext* opCtx, // Construct a fake OpTime that can be accepted but isn't used. OpTime fakeOpTime(Timestamp(1, 1), topCoordTerm); - if (serverGlobalParams.featureCompatibility.isVersion( - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44) && - !force && enableSafeReplicaSetReconfig) { + if (!force && enableSafeReplicaSetReconfig) { if (!_doneWaitingForReplication_inlock(fakeOpTime, configWriteConcern)) { return Status(ErrorCodes::ConfigurationInProgress, str::stream() @@ -3814,13 +3807,6 @@ ReplicationCoordinatorImpl::_updateMemberStateFromTopologyCoordinator(WithLock l "Replica set state transition", "newState"_attr = newState, "oldState"_attr = _memberState); - // Initializes the featureCompatibilityVersion to the latest value, because arbiters do not - // receive the replicated version. This is to avoid bugs like SERVER-32639. - if (newState.arbiter()) { - serverGlobalParams.featureCompatibility.setVersion( - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44); - } - _memberState = newState; _cancelAndRescheduleElectionTimeout_inlock(); |