2018-11-13 17:40:00 +01:00
|
|
|
// 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() {
|
2019-07-27 00:20:35 +02:00
|
|
|
"use strict";
|
2018-11-13 17:40:00 +01:00
|
|
|
|
2019-07-27 00:20:35 +02:00
|
|
|
// Majority reads are enabled by default.
|
|
|
|
let rst = new ReplSetTest({nodes: 1});
|
|
|
|
rst.startSet();
|
|
|
|
rst.initiate();
|
2018-11-13 17:40:00 +01:00
|
|
|
|
2019-07-27 00:20:35 +02:00
|
|
|
let serverStatus = rst.getPrimary().getDB("test").serverStatus();
|
|
|
|
assert(serverStatus.storageEngine.supportsCommittedReads, tojson(serverStatus));
|
|
|
|
rst.stopSet();
|
2018-11-13 17:40:00 +01:00
|
|
|
|
2019-07-27 00:20:35 +02:00
|
|
|
// Explicitly enable majority reads.
|
|
|
|
TestData.enableMajorityReadConcern = true;
|
|
|
|
rst = new ReplSetTest({nodes: 1});
|
|
|
|
rst.startSet();
|
|
|
|
rst.initiate();
|
2018-11-13 17:40:00 +01:00
|
|
|
|
2019-07-27 00:20:35 +02:00
|
|
|
serverStatus = rst.getPrimary().getDB("test").serverStatus();
|
|
|
|
assert(serverStatus.storageEngine.supportsCommittedReads, tojson(serverStatus));
|
|
|
|
rst.stopSet();
|
2018-11-13 17:40:00 +01:00
|
|
|
|
2019-07-27 00:20:35 +02:00
|
|
|
// Explicitly disable majority reads.
|
|
|
|
TestData.enableMajorityReadConcern = false;
|
|
|
|
rst = new ReplSetTest({nodes: 1});
|
|
|
|
rst.startSet();
|
|
|
|
rst.initiate();
|
2018-11-13 17:40:00 +01:00
|
|
|
|
2019-07-27 00:20:35 +02:00
|
|
|
serverStatus = rst.getPrimary().getDB("test").serverStatus();
|
|
|
|
assert(!serverStatus.storageEngine.supportsCommittedReads, tojson(serverStatus));
|
|
|
|
rst.stopSet();
|
2018-11-13 17:40:00 +01:00
|
|
|
})();
|