summaryrefslogtreecommitdiff
path: root/jstests/libs
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2019-05-15 12:36:54 -0400
committerTess Avitabile <tess.avitabile@mongodb.com>2019-05-16 09:46:43 -0400
commit06c7e27f2e7a668d81baf02d89f422cdda205fce (patch)
tree81ed0df5ecd0193fe7a2dc1846980cdfd2863fc9 /jstests/libs
parent953c6116138800e0fbed79e7654eda1690d56f71 (diff)
downloadmongo-06c7e27f2e7a668d81baf02d89f422cdda205fce.tar.gz
SERVER-41050 Ban txnNumbers outside of transactions and retryable writes
Diffstat (limited to 'jstests/libs')
-rw-r--r--jstests/libs/global_snapshot_reads_util.js20
1 files changed, 9 insertions, 11 deletions
diff --git a/jstests/libs/global_snapshot_reads_util.js b/jstests/libs/global_snapshot_reads_util.js
index be3421ea1c1..c1976d0218b 100644
--- a/jstests/libs/global_snapshot_reads_util.js
+++ b/jstests/libs/global_snapshot_reads_util.js
@@ -9,27 +9,25 @@ function verifyInvalidGetMoreAttempts(mainDb, collName, cursorId, lsid, txnNumbe
// Subsequent getMore requests without the same session id are rejected. The cursor should
// still be valid and usable after this failed attempt.
- assert.commandFailedWithCode(mainDb.runCommand({
- getMore: cursorId,
- collection: collName,
- batchSize: 1,
- txnNumber: NumberLong(txnNumber),
- lsid: {id: UUID()}
- }),
- 50801);
+ assert.commandFailedWithCode(
+ mainDb.runCommand(
+ {getMore: cursorId, collection: collName, batchSize: 1, lsid: {id: UUID()}}),
+ 50801);
// Reject getMores without txnNumber.
assert.commandFailedWithCode(
mainDb.runCommand({getMore: cursorId, collection: collName, batchSize: 1, lsid: lsid}),
50803);
- // Reject getMores without same txnNumber.
+ // Reject getMores without same txnNumber. This fails with NoSuchTransaction because the
+ // txnNumber 50 is higher than the active txnNumber for the session.
assert.commandFailedWithCode(mainDb.runCommand({
getMore: cursorId,
collection: collName,
batchSize: 1,
lsid: lsid,
- txnNumber: NumberLong(50)
+ txnNumber: NumberLong(50),
+ autocommit: false
}),
- 50804);
+ ErrorCodes.NoSuchTransaction);
}