Skip to content

Commit

Permalink
SERVER-60869 Re-add logic to set feature compatibility version on arb…
Browse files Browse the repository at this point in the history
…iters

(cherry picked from commit f094005)
  • Loading branch information
ali-mir authored and Evergreen Agent committed Nov 2, 2021
1 parent b47031e commit c7a51b8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
@@ -0,0 +1,25 @@
/*
* Tests that an arbiter will default to the latest FCV regardless of the FCV of the replica set.
*/
(function() {
"use strict";

function runTest(FCV) {
let rst = new ReplSetTest(
{nodes: [{}, {rsConfig: {arbiterOnly: true}}], nodeOpts: {binVersion: FCV}});
rst.startSet();
rst.initiate();

const arbiter = rst.getArbiter();
const res = assert.commandWorked(
arbiter.getDB("admin").runCommand({getParameter: 1, featureCompatibilityVersion: 1}));
assert.eq(res.featureCompatibilityVersion.version, latestFCV, tojson(res));
rst.stopSet();
}

runTest(latestFCV);
runTest(lastLTSFCV);
if (lastContinuousFCV != lastLTSFCV) {
runTest(lastContinuousFCV);
}
}());
9 changes: 9 additions & 0 deletions src/mongo/db/repl/replication_coordinator_impl.cpp
Expand Up @@ -4301,6 +4301,15 @@ 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()) {
// (Generic FCV reference): This FCV check should exist across LTS binary versions.
serverGlobalParams.mutableFeatureCompatibility.setVersion(
FeatureCompatibilityParams::kLatest);
}

_memberState = newState;

_cancelAndRescheduleElectionTimeout_inlock();
Expand Down

0 comments on commit c7a51b8

Please sign in to comment.