summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/readConcern_snapshot.js
diff options
context:
space:
mode:
authorXiangyu Yao <xiangyu.yao@mongodb.com>2018-06-13 15:21:28 -0400
committerXiangyu Yao <xiangyu.yao@mongodb.com>2018-06-19 17:09:50 -0400
commit1871507cdbdd492abee785076203467d20e0e716 (patch)
treecbd4419e90783af801ad3a239bdff4b27211e385 /jstests/noPassthrough/readConcern_snapshot.js
parent1026f5e41426b85b49f3987028f2a63e17012aa6 (diff)
downloadmongo-1871507cdbdd492abee785076203467d20e0e716.tar.gz
SERVER-34113 Remove all support for snapshot reads outside multi-document transactions
Diffstat (limited to 'jstests/noPassthrough/readConcern_snapshot.js')
-rw-r--r--jstests/noPassthrough/readConcern_snapshot.js31
1 files changed, 8 insertions, 23 deletions
diff --git a/jstests/noPassthrough/readConcern_snapshot.js b/jstests/noPassthrough/readConcern_snapshot.js
index 8878e596987..9880ee40d5c 100644
--- a/jstests/noPassthrough/readConcern_snapshot.js
+++ b/jstests/noPassthrough/readConcern_snapshot.js
@@ -23,13 +23,15 @@
session.startTransaction({readConcern: {level: "snapshot"}});
assert.commandFailedWithCode(sessionDb.runCommand({find: collName}),
ErrorCodes.IllegalOperation);
- session.abortTransaction();
+ assert.commandFailedWithCode(session.abortTransaction_forTesting(),
+ ErrorCodes.NoSuchTransaction);
// Transactions without readConcern snapshot fail.
session.startTransaction();
assert.commandFailedWithCode(sessionDb.runCommand({find: collName}),
ErrorCodes.IllegalOperation);
- session.abortTransaction();
+ assert.commandFailedWithCode(session.abortTransaction_forTesting(),
+ ErrorCodes.NoSuchTransaction);
rst.stopSet();
return;
@@ -37,24 +39,6 @@
session.endSession();
rst.stopSet();
- // TODO: SERVER-34113:
- // readConcern 'snapshot' should fail for autocommit:true transactions when test
- // 'enableTestCommands' is set to false.
- jsTest.setOption('enableTestCommands', false);
- rst = new ReplSetTest({nodes: 1});
- rst.startSet();
- rst.initiate();
- session = rst.getPrimary().getDB(dbName).getMongo().startSession({causalConsistency: false});
- sessionDb = session.getDatabase(dbName);
- assert.commandWorked(sessionDb.coll.insert({}, {writeConcern: {w: "majority"}}));
- assert.commandFailedWithCode(
- sessionDb.runCommand(
- {find: collName, readConcern: {level: "snapshot"}, txnNumber: NumberLong(1)}),
- ErrorCodes.InvalidOptions);
- jsTest.setOption('enableTestCommands', true);
- session.endSession();
- rst.stopSet();
-
// readConcern 'snapshot' is not allowed on a standalone.
const conn = MongoRunner.runMongod();
session = conn.startSession({causalConsistency: false});
@@ -63,7 +47,8 @@
session.startTransaction({readConcern: {level: "snapshot"}});
assert.commandFailedWithCode(sessionDb.runCommand({find: collName}),
ErrorCodes.IllegalOperation);
- session.abortTransaction();
+ assert.commandFailedWithCode(session.abortTransaction_forTesting(),
+ ErrorCodes.IllegalOperation);
session.endSession();
MongoRunner.stopMongod(conn);
@@ -95,7 +80,8 @@
session.startTransaction(
{readConcern: {level: "snapshot", afterOpTime: {ts: Timestamp(1, 2), t: 1}}});
assert.commandFailedWithCode(sessionDb.runCommand({find: collName}), ErrorCodes.InvalidOptions);
- session.abortTransaction();
+ assert.commandFailedWithCode(session.abortTransaction_forTesting(),
+ ErrorCodes.NoSuchTransaction);
session.endSession();
// readConcern 'snapshot' is allowed on a replica set secondary.
@@ -157,6 +143,5 @@
50768);
assert.commandWorked(session.abortTransaction_forTesting());
session.endSession();
-
rst.stopSet();
}());