summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/readConcern_atClusterTime.js
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2019-02-13 13:45:32 -0500
committerTess Avitabile <tess.avitabile@mongodb.com>2019-02-25 15:39:00 -0500
commitdbf6e7832948aef18a2bde086f6e8de20d65b2f1 (patch)
tree000b7fe2da7674ff3a4a3aa5c62632855458d31c /jstests/noPassthrough/readConcern_atClusterTime.js
parent369a2e0432c27b20b106056e2f2e0849cab617f0 (diff)
downloadmongo-dbf6e7832948aef18a2bde086f6e8de20d65b2f1.tar.gz
SERVER-39418 Ban atClusterTime with enableMajorityReadConcern=false
Diffstat (limited to 'jstests/noPassthrough/readConcern_atClusterTime.js')
-rw-r--r--jstests/noPassthrough/readConcern_atClusterTime.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/jstests/noPassthrough/readConcern_atClusterTime.js b/jstests/noPassthrough/readConcern_atClusterTime.js
index b2e5b6ac9f8..ec38d6d776a 100644
--- a/jstests/noPassthrough/readConcern_atClusterTime.js
+++ b/jstests/noPassthrough/readConcern_atClusterTime.js
@@ -2,7 +2,7 @@
//
// Only run this test with the WiredTiger storage engine, since we expect other storage engines to
// return early because they do not support snapshot read concern.
-// @tags: [requires_wiredtiger, uses_transactions]
+// @tags: [requires_wiredtiger, uses_transactions, uses_atclustertime]
function _getClusterTime(rst) {
const pingRes = assert.commandWorked(rst.getPrimary().adminCommand({ping: 1}));
@@ -149,4 +149,22 @@ function _getClusterTime(rst) {
rst.stopSet();
}
+ // readConcern with 'atClusterTime' is not allowed when enableMajorityReadConcern=false.
+ {
+ let rst = new ReplSetTest({nodes: [{"enableMajorityReadConcern": "false"}]});
+ rst.startSet();
+ rst.initiate();
+ let session =
+ rst.getPrimary().getDB(dbName).getMongo().startSession({causalConsistency: false});
+ let sessionDb = session.getDatabase(dbName);
+ session.startTransaction(
+ {readConcern: {level: "snapshot", atClusterTime: _getClusterTime(rst)}});
+ assert.commandFailedWithCode(sessionDb.runCommand({find: collName}),
+ ErrorCodes.InvalidOptions);
+ assert.commandFailedWithCode(session.abortTransaction_forTesting(),
+ ErrorCodes.NoSuchTransaction);
+ session.endSession();
+ rst.stopSet();
+ }
+
}());