diff options
author | Tess Avitabile <tess.avitabile@mongodb.com> | 2019-05-15 12:36:54 -0400 |
---|---|---|
committer | Tess Avitabile <tess.avitabile@mongodb.com> | 2019-05-16 09:46:43 -0400 |
commit | 06c7e27f2e7a668d81baf02d89f422cdda205fce (patch) | |
tree | 81ed0df5ecd0193fe7a2dc1846980cdfd2863fc9 /jstests/libs | |
parent | 953c6116138800e0fbed79e7654eda1690d56f71 (diff) | |
download | mongo-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.js | 20 |
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); } |