diff options
author | jannaerin <golden.janna@gmail.com> | 2018-08-06 11:31:54 -0400 |
---|---|---|
committer | jannaerin <golden.janna@gmail.com> | 2018-08-28 17:48:50 -0400 |
commit | 145f3a4368ac2efe92d58ddb2462229e5c27365c (patch) | |
tree | 38f118614d112bfa26e172e4c69e9a75eed0fe6f /src/mongo/shell/session.js | |
parent | 69de1dd12074380806295d6830937625d581af1b (diff) | |
download | mongo-145f3a4368ac2efe92d58ddb2462229e5c27365c.tar.gz |
SERVER-36306 Add FSM workloads that run transactions workloads with all threads using same session
Diffstat (limited to 'src/mongo/shell/session.js')
-rw-r--r-- | src/mongo/shell/session.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mongo/shell/session.js b/src/mongo/shell/session.js index b786d0583ae..d89be37b8e3 100644 --- a/src/mongo/shell/session.js +++ b/src/mongo/shell/session.js @@ -736,9 +736,11 @@ var { return cmdObj; }; - this.startTransaction = function startTransaction(txnOptsObj) { - // If the session is already in a transaction, raise an error. - if (this.isTxnActive()) { + this.startTransaction = function startTransaction(txnOptsObj, ignoreActiveTxn) { + // If the session is already in a transaction, raise an error. If retryNewTxnNum + // is true, don't raise an error. This is to allow multiple threads to try to + // use the same session in a concurrency workload. + if (this.isTxnActive() && !ignoreActiveTxn) { throw new Error("Transaction already in progress on this session."); } if (!serverSupports(kWireVersionSupportingMultiDocumentTransactions)) { @@ -941,6 +943,11 @@ var { this._serverSession.startTransaction(txnOptsObj); }; + this.startTransaction_forTesting = function startTransaction_forTesting( + txnOptsObj = {}, {ignoreActiveTxn: ignoreActiveTxn = false} = {}) { + this._serverSession.startTransaction(txnOptsObj, ignoreActiveTxn); + }; + this.commitTransaction = function commitTransaction() { assert.commandWorked(this._serverSession.commitTransaction(this)); }; |