Skip to content

Commit 44c6af4

Browse files
authored
SERVER-84801 fix handling of enableMajorityReadConcern (#312)
1 parent cbe6293 commit 44c6af4

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

mongo_orchestration/servers.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,15 @@ def __init_mongod(self, params, add_auth=False):
128128
self.__init_config_params(cfg)
129129

130130
# Read concern majority requires MongoDB >= 3.2, WiredTiger storage
131-
# engine, and protocol version 1:
131+
# engine, and protocol version 1.
132+
# Starting in MongoDB 5.0, enableMajorityReadConcern and --enableMajorityReadConcern
133+
# cannot be changed and are always set to true due to storage engine improvements.
134+
# The flag is removed altogether in MongoDB 8.1.
132135
# https://docs.mongodb.com/manual/reference/read-concern/
133136
if ('enableMajorityReadConcern' not in cfg
134137
and self.enable_majority_read_concern
135-
and self.version >= (3, 2)):
138+
and self.version >= (3, 2)
139+
and self.version < (5, 0)):
136140
if (cfg.get('storageEngine', 'wiredTiger') == 'wiredTiger'
137141
and cfg.get('protocolVersion', 1) == 1):
138142
cfg['enableMajorityReadConcern'] = True

tests/test_servers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def test_majority_read_concern(self):
219219
.get('parsed', {})
220220
.get('replication', {})
221221
.get('enableMajorityReadConcern'))
222-
if SERVER_VERSION >= (3, 2):
222+
if SERVER_VERSION >= (3, 2) and SERVER_VERSION < (5, 0):
223223
self.assertTrue(majority_rc_enabled)
224224
else:
225225
self.assertFalse(majority_rc_enabled)

0 commit comments

Comments
 (0)