diff options
author | Sanika Phanse <sanika.phanse@mongodb.com> | 2022-02-24 21:36:59 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-24 22:11:26 +0000 |
commit | d85d3a3df471fbbf29459e37937161b0b55c3230 (patch) | |
tree | b3ae7799bea877e9a96ca68002929f92e89169bb /jstests/noPassthrough | |
parent | e9dec3c50147c0a241e16235cc0c41dd127c4971 (diff) | |
download | mongo-d85d3a3df471fbbf29459e37937161b0b55c3230.tar.gz |
SERVER-63491 Remove TxnNumberAndRetryCounter as a parameter for txnRouter.beginOrContinue()
Diffstat (limited to 'jstests/noPassthrough')
-rw-r--r-- | jstests/noPassthrough/transaction_coordinator_curop_info.js | 43 |
1 files changed, 10 insertions, 33 deletions
diff --git a/jstests/noPassthrough/transaction_coordinator_curop_info.js b/jstests/noPassthrough/transaction_coordinator_curop_info.js index 24ac4bb09a8..be2e66a7568 100644 --- a/jstests/noPassthrough/transaction_coordinator_curop_info.js +++ b/jstests/noPassthrough/transaction_coordinator_curop_info.js @@ -12,18 +12,13 @@ load('jstests/libs/fail_point_util.js'); load('jstests/sharding/libs/sharded_transactions_helpers.js'); // for waitForFailpoint -function commitTxn( - st, lsid, txnNumber, txnRetryCounter, areInternalTransactionsEnabled, expectedError = null) { - const txnRetryCounterField = areInternalTransactionsEnabled - ? ("txnRetryCounter: NumberInt(" + txnRetryCounter + "),") - : ""; - +function commitTxn(st, lsid, txnNumber, expectedError = null) { let cmd = "db.adminCommand({" + "commitTransaction: 1," + "lsid: " + tojson(lsid) + "," + "txnNumber: NumberLong(" + txnNumber + ")," + "stmtId: NumberInt(0)," + - "autocommit: false," + txnRetryCounterField + "})"; + "autocommit: false})"; if (expectedError) { cmd = "assert.commandFailedWithCode(" + cmd + "," + String(expectedError) + ");"; @@ -85,7 +80,7 @@ function enableFailPoints(shard, failPointNames) { return failPoints; } -function startTransaction(session, collectionName, insertValue, areInternalTransactionsEnabled) { +function startTransaction(session, collectionName, insertValue) { const dbName = session.getDatabase('test'); jsTest.log(`Starting a new transaction on ${dbName}.${collectionName}`); var insertCmdObj = { @@ -97,10 +92,6 @@ function startTransaction(session, collectionName, insertValue, areInternalTrans autocommit: false, }; - if (areInternalTransactionsEnabled) { - Object.assign(insertCmdObj, {txnRetryCounter: NumberInt(1)}); - } - assert.commandWorked(dbName.runCommand(insertCmdObj)); } @@ -140,12 +131,11 @@ let failPoints = enableFailPoints(coordinator, failPointNames); jsTest.log("Testing that coordinator threads show up in currentOp for a commit decision"); { let session = adminDB.getMongo().startSession(); - startTransaction(session, collectionName, 1, areInternalTransactionsEnabled); + startTransaction(session, collectionName, 1); let txnNumber = NumberLong(1); - let txnRetryCounter = NumberInt(1); + let txnRetryCounter = NumberInt(0); let lsid = session.getSessionId(); - let commitJoin = - commitTxn(st, lsid, txnNumber, txnRetryCounter, areInternalTransactionsEnabled); + let commitJoin = commitTxn(st, lsid, txnNumber); var coordinateCommitFilter = { active: true, @@ -156,10 +146,6 @@ jsTest.log("Testing that coordinator threads show up in currentOp for a commit d 'command.autocommit': false }; - if (areInternalTransactionsEnabled) { - Object.assign(coordinateCommitFilter, {'command.txnRetryCounter': txnRetryCounter}); - } - let createCoordinateCommitTxnOp = curOpAfterFailpoint( failPoints["hangAfterStartingCoordinateCommit"], coordinateCommitFilter); assert.eq(1, createCoordinateCommitTxnOp.length); @@ -200,10 +186,10 @@ jsTest.log("Testing that coordinator threads show up in currentOp for a commit d jsTest.log("Testing that coordinator threads show up in currentOp for an abort decision."); { let session = adminDB.getMongo().startSession(); - startTransaction(session, collectionName, 2, areInternalTransactionsEnabled); + startTransaction(session, collectionName, 2); let txnNumber = NumberLong(1); let lsid = session.getSessionId(); - let txnRetryCounter = NumberInt(1); + let txnRetryCounter = NumberInt(0); // Manually abort the transaction on one of the participants, so that the participant fails to // prepare and failpoint is triggered on the coordinator. var abortTransactionCmd = { @@ -214,18 +200,9 @@ jsTest.log("Testing that coordinator threads show up in currentOp for an abort d autocommit: false, }; - if (areInternalTransactionsEnabled) { - Object.assign(abortTransactionCmd, {txnRetryCounter: txnRetryCounter}); - } - assert.commandWorked(participant.adminCommand(abortTransactionCmd)); - let commitJoin = commitTxn(st, - lsid, - txnNumber, - txnRetryCounter, - areInternalTransactionsEnabled, - ErrorCodes.NoSuchTransaction); + let commitJoin = commitTxn(st, lsid, txnNumber, ErrorCodes.NoSuchTransaction); const sendAbortFilter = makeWorkerFilterWithAction( session, "sendingAbort", txnNumber, txnRetryCounter, areInternalTransactionsEnabled); @@ -237,4 +214,4 @@ jsTest.log("Testing that coordinator threads show up in currentOp for an abort d } st.stop(); -})();
\ No newline at end of file +})(); |