0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

SERVER-38055 Mongod servers started through the shell must respect TestData.enableMajorityReadConcern

This commit is contained in:
Tess Avitabile 2018-11-13 11:40:00 -05:00
parent 087f25379e
commit a058fc68c5
2 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,35 @@
// This test ensures that we respect the value of 'enableMajorityReadConcern' included in TestData.
// @tags: [requires_wiredtiger, requires_replication, requires_majority_read_concern,
// requires_persistence]
(function() {
"use strict";
// Majority reads are enabled by default.
let rst = new ReplSetTest({nodes: 1});
rst.startSet();
rst.initiate();
let serverStatus = rst.getPrimary().getDB("test").serverStatus();
assert(serverStatus.storageEngine.supportsCommittedReads, tojson(serverStatus));
rst.stopSet();
// Explicitly enable majority reads.
TestData.enableMajorityReadConcern = true;
rst = new ReplSetTest({nodes: 1});
rst.startSet();
rst.initiate();
serverStatus = rst.getPrimary().getDB("test").serverStatus();
assert(serverStatus.storageEngine.supportsCommittedReads, tojson(serverStatus));
rst.stopSet();
// Explicitly disable majority reads.
TestData.enableMajorityReadConcern = false;
rst = new ReplSetTest({nodes: 1});
rst.startSet();
rst.initiate();
serverStatus = rst.getPrimary().getDB("test").serverStatus();
assert(!serverStatus.storageEngine.supportsCommittedReads, tojson(serverStatus));
rst.stopSet();
})();

View File

@ -1146,7 +1146,7 @@ var MongoRunner, _startMongod, startMongoProgram, runMongoProgram, startMongoPro
if (programName.endsWith('mongod')) {
if (jsTest.options().storageEngine === "wiredTiger" ||
!jsTest.options().storageEngine) {
if (jsTest.options().enableMajorityReadConcern &&
if (jsTest.options().enableMajorityReadConcern !== undefined &&
!argArrayContains("--enableMajorityReadConcern")) {
argArray.push(
...['--enableMajorityReadConcern',