Skip to content

Commit f094005

Browse files
ali-mirEvergreen Agent
authored andcommitted
SERVER-60869 Re-add logic to set feature compatibility version on arbiters
1 parent 0d1009d commit f094005

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Tests that an arbiter will default to the latest FCV regardless of the FCV of the replica set.
3+
*/
4+
(function() {
5+
"use strict";
6+
7+
function runTest(FCV) {
8+
let rst = new ReplSetTest(
9+
{nodes: [{}, {rsConfig: {arbiterOnly: true}}], nodeOpts: {binVersion: FCV}});
10+
rst.startSet();
11+
rst.initiate();
12+
13+
const arbiter = rst.getArbiter();
14+
const res = assert.commandWorked(
15+
arbiter.getDB("admin").runCommand({getParameter: 1, featureCompatibilityVersion: 1}));
16+
assert.eq(res.featureCompatibilityVersion.version, latestFCV, tojson(res));
17+
rst.stopSet();
18+
}
19+
20+
runTest(latestFCV);
21+
runTest(lastLTSFCV);
22+
if (lastContinuousFCV != lastLTSFCV) {
23+
runTest(lastContinuousFCV);
24+
}
25+
}());

src/mongo/db/repl/replication_coordinator_impl.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4347,6 +4347,15 @@ ReplicationCoordinatorImpl::_updateMemberStateFromTopologyCoordinator(WithLock l
43474347
"Replica set state transition",
43484348
"newState"_attr = newState,
43494349
"oldState"_attr = _memberState);
4350+
4351+
// Initializes the featureCompatibilityVersion to the latest value, because arbiters do not
4352+
// receive the replicated version. This is to avoid bugs like SERVER-32639.
4353+
if (newState.arbiter()) {
4354+
// (Generic FCV reference): This FCV check should exist across LTS binary versions.
4355+
serverGlobalParams.mutableFeatureCompatibility.setVersion(
4356+
multiversion::GenericFCV::kLatest);
4357+
}
4358+
43504359
_memberState = newState;
43514360

43524361
_cancelAndRescheduleElectionTimeout_inlock();

0 commit comments

Comments
 (0)