diff options
author | Lingzhi Deng <lingzhi.deng@mongodb.com> | 2021-03-22 15:23:25 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-03-22 16:18:36 +0000 |
commit | c45819ca1324f65a2eb0040eff1754289383711a (patch) | |
tree | 6696a51626a7be231badb8bdbb475d2d89000a8d /jstests | |
parent | 939178eb77d25dc234de03ac7d5dc98210514c7a (diff) | |
download | mongo-c45819ca1324f65a2eb0040eff1754289383711a.tar.gz |
SERVER-55044: Do a majority write before starting tests in read_majority_reads.js
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/noPassthrough/read_majority_reads.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/jstests/noPassthrough/read_majority_reads.js b/jstests/noPassthrough/read_majority_reads.js index dc02f8c215b..a1c73cd28e3 100644 --- a/jstests/noPassthrough/read_majority_reads.js +++ b/jstests/noPassthrough/read_majority_reads.js @@ -189,6 +189,13 @@ replTest.initiateWithAnyNodeAsPrimary( var mongod = replTest.getPrimary(); +// Do a majority write to wait for a valid committed snapshot before starting the test. This is +// needed to make sure no oplog holes behind the clusterTime and all internal writes as part of the +// server startup are committed. Otherwise, manually setting the committed snapshot to the latest +// clusterTime using the `setCommittedSnapshot` command could result in reading ahead of the +// all_durable. +assert.commandWorked(mongod.getDB("test")["coll"].insert({x: 1}, {writeConcern: {w: "majority"}})); + (function testSingleNode() { var db = mongod.getDB("singleNode"); runTests(db.collection, mongod); |