diff options
author | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2018-04-11 16:29:54 -0400 |
---|---|---|
committer | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2018-04-11 16:39:34 -0400 |
commit | 50d2f0e7eae0f500ea04a509c12d7935356c0dde (patch) | |
tree | 942f5905456014bc628a13c2ccb07d58df152a96 | |
parent | 68005e0ffcc50c9260a162b717aaa5c2225096da (diff) | |
download | mongo-50d2f0e7eae0f500ea04a509c12d7935356c0dde.tar.gz |
SERVER-33501 Support retryable writes for commitTransaction command
This reverts commit f205975ea89798fa1b6d91097226ae7b10ad9f3c.
-rw-r--r-- | jstests/core/txns/finished_transaction_error_handling.js | 144 | ||||
-rw-r--r-- | jstests/core/txns/multi_statement_transaction_abort.js | 49 | ||||
-rw-r--r-- | jstests/sharding/snapshot_aggregate_mongos.js | 3 | ||||
-rw-r--r-- | jstests/sharding/snapshot_find_mongos.js | 3 | ||||
-rw-r--r-- | src/mongo/base/error_codes.err | 1 | ||||
-rw-r--r-- | src/mongo/db/commands/txn_cmds.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/repl/do_txn_test.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/service_entry_point_common.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/session.cpp | 11 | ||||
-rw-r--r-- | src/mongo/db/session.h | 2 | ||||
-rw-r--r-- | src/mongo/db/session_catalog_test.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/session_test.cpp | 36 |
12 files changed, 185 insertions, 78 deletions
diff --git a/jstests/core/txns/finished_transaction_error_handling.js b/jstests/core/txns/finished_transaction_error_handling.js new file mode 100644 index 00000000000..4df83974bd5 --- /dev/null +++ b/jstests/core/txns/finished_transaction_error_handling.js @@ -0,0 +1,144 @@ +// Test committed and aborted transactions cannot be changed but commitTransaction is retryable. +// @tags: [uses_transactions] +(function() { + "use strict"; + + // For waitForDropToComplete + load("jstests/replsets/libs/two_phase_drops.js"); + + const dbName = "test"; + const collName = "finished_transaction_error_handling"; + const testDB = db.getSiblingDB(dbName); + const testColl = testDB[collName]; + + testColl.drop(); + TwoPhaseDropCollectionTest.waitForDropToComplete(testDB, collName); + + assert.commandWorked( + testDB.createCollection(testColl.getName(), {writeConcern: {w: "majority"}})); + let txnNumber = 0; + let stmtId = 0; + + const sessionOptions = {causalConsistency: false}; + const session = db.getMongo().startSession(sessionOptions); + const sessionDb = session.getDatabase(dbName); + + jsTestLog("Test aborted transaction number cannot be reused."); + txnNumber++; + assert.commandWorked(sessionDb.runCommand({ + insert: collName, + documents: [{_id: "abort-txn-1"}], + readConcern: {level: "snapshot"}, + txnNumber: NumberLong(txnNumber), + startTransaction: true, + stmtId: NumberInt(stmtId++), + autocommit: false + })); + assert.commandWorked(sessionDb.adminCommand({ + abortTransaction: 1, + writeConcern: {w: "majority"}, + txnNumber: NumberLong(txnNumber), + stmtId: NumberInt(stmtId++), + autocommit: false + })); + + jsTestLog("Attempt to commit an aborted transaction"); + assert.commandFailedWithCode(sessionDb.adminCommand({ + commitTransaction: 1, + txnNumber: NumberLong(txnNumber), + stmtId: NumberInt(stmtId++), + autocommit: false + }), + ErrorCodes.NoSuchTransaction); + + jsTestLog("Attempt to abort an aborted transaction"); + assert.commandFailedWithCode(sessionDb.adminCommand({ + abortTransaction: 1, + txnNumber: NumberLong(txnNumber), + stmtId: NumberInt(stmtId++), + autocommit: false + }), + ErrorCodes.NoSuchTransaction); + + jsTestLog("Attempt to continue an aborted transaction"); + assert.commandFailedWithCode(sessionDb.runCommand({ + insert: collName, + documents: [{_id: "abort-txn-2"}], + txnNumber: NumberLong(txnNumber), + stmtId: NumberInt(stmtId++), + autocommit: false + }), + ErrorCodes.NoSuchTransaction); + + jsTestLog("Attempt to restart an aborted transaction"); + assert.commandFailedWithCode(sessionDb.runCommand({ + insert: collName, + documents: [{_id: "abort-txn-2"}], + readConcern: {level: "snapshot"}, + txnNumber: NumberLong(txnNumber), + startTransaction: true, + stmtId: NumberInt(stmtId++), + autocommit: false + }), + ErrorCodes.ConflictingOperationInProgress); + + jsTest.log("Test commitTransaction command is retryable"); + txnNumber++; + stmtId = 0; + assert.commandWorked(sessionDb.runCommand({ + insert: collName, + documents: [{_id: "commit-txn-1"}], + readConcern: {level: "snapshot"}, + txnNumber: NumberLong(txnNumber), + startTransaction: true, + stmtId: NumberInt(stmtId++), + autocommit: false + })); + assert.commandWorked(sessionDb.adminCommand({ + commitTransaction: 1, + txnNumber: NumberLong(txnNumber), + stmtId: NumberInt(stmtId++), + autocommit: false + })); + + jsTestLog("Retry commitTransaction command on a committed transaction"); + assert.commandWorked(sessionDb.adminCommand({ + commitTransaction: 1, + txnNumber: NumberLong(txnNumber), + stmtId: NumberInt(stmtId), + autocommit: false + })); + + jsTestLog("Attempt to abort a committed transaction"); + assert.commandFailedWithCode(sessionDb.adminCommand({ + abortTransaction: 1, + txnNumber: NumberLong(txnNumber), + stmtId: NumberInt(stmtId++), + autocommit: false + }), + ErrorCodes.TransactionCommitted); + + jsTestLog("Attempt to continue a committed transaction"); + assert.commandFailedWithCode(sessionDb.runCommand({ + insert: collName, + documents: [{_id: "commit-txn-2"}], + txnNumber: NumberLong(txnNumber), + stmtId: NumberInt(stmtId++), + autocommit: false + }), + ErrorCodes.TransactionCommitted); + + jsTestLog("Attempt to restart a committed transaction"); + assert.commandFailedWithCode(sessionDb.runCommand({ + insert: collName, + documents: [{_id: "commit-txn-2"}], + readConcern: {level: "snapshot"}, + txnNumber: NumberLong(txnNumber), + startTransaction: true, + stmtId: NumberInt(stmtId++), + autocommit: false + }), + ErrorCodes.ConflictingOperationInProgress); + + session.endSession(); +}()); diff --git a/jstests/core/txns/multi_statement_transaction_abort.js b/jstests/core/txns/multi_statement_transaction_abort.js index 4567aa75524..95fa29ff802 100644 --- a/jstests/core/txns/multi_statement_transaction_abort.js +++ b/jstests/core/txns/multi_statement_transaction_abort.js @@ -247,54 +247,5 @@ // TODO: SERVER-33690 Test the old cursor has been killed when the transaction is aborted. - jsTest.log("Aborted transaction number cannot be reused."); - txnNumber++; - assert.commandWorked(sessionDb.runCommand({ - insert: collName, - documents: [{_id: "abort-txn-1"}], - readConcern: {level: "snapshot"}, - txnNumber: NumberLong(txnNumber), - startTransaction: true, - autocommit: false - })); - assert.commandWorked(sessionDb.adminCommand({ - abortTransaction: 1, - writeConcern: {w: "majority"}, - txnNumber: NumberLong(txnNumber), - autocommit: false - })); - - // Cannot commit the aborted transaction. - assert.commandFailedWithCode( - sessionDb.adminCommand( - {commitTransaction: 1, txnNumber: NumberLong(txnNumber), autocommit: false}), - ErrorCodes.NoSuchTransaction); - - // Cannot abort the aborted transaction. - assert.commandFailedWithCode( - sessionDb.adminCommand( - {abortTransaction: 1, txnNumber: NumberLong(txnNumber), autocommit: false}), - ErrorCodes.NoSuchTransaction); - - // Cannot continue the aborted transaction. - assert.commandFailedWithCode(sessionDb.runCommand({ - insert: collName, - documents: [{_id: "abort-txn-2"}], - txnNumber: NumberLong(txnNumber), - autocommit: false - }), - ErrorCodes.NoSuchTransaction); - - // Cannot restart the aborted transaction. - assert.commandFailedWithCode(sessionDb.runCommand({ - insert: collName, - documents: [{_id: "abort-txn-2"}], - readConcern: {level: "snapshot"}, - txnNumber: NumberLong(txnNumber), - startTransaction: true, - autocommit: false - }), - ErrorCodes.ConflictingOperationInProgress); - session.endSession(); }()); diff --git a/jstests/sharding/snapshot_aggregate_mongos.js b/jstests/sharding/snapshot_aggregate_mongos.js index 0ff71218aea..36a2a529c7b 100644 --- a/jstests/sharding/snapshot_aggregate_mongos.js +++ b/jstests/sharding/snapshot_aggregate_mongos.js @@ -87,12 +87,13 @@ assert.eq(4, res.cursor.nextBatch.length); // Perform a second snapshot read under a new transaction. + txnNumber++; res = assert.commandWorked(sessionDb.runCommand({ aggregate: collName, pipeline: [{$sort: {_id: 1}}], cursor: {batchSize: 20}, readConcern: {level: "snapshot"}, - txnNumber: NumberLong(txnNumber++) + txnNumber: NumberLong(txnNumber) })); // The cursor has been exhausted. diff --git a/jstests/sharding/snapshot_find_mongos.js b/jstests/sharding/snapshot_find_mongos.js index 04846fba66c..8687654ac39 100644 --- a/jstests/sharding/snapshot_find_mongos.js +++ b/jstests/sharding/snapshot_find_mongos.js @@ -88,12 +88,13 @@ assert.eq(4, res.cursor.nextBatch.length); // Perform a second snapshot read under a new transaction. + txnNumber++; res = assert.commandWorked(sessionDb.runCommand({ find: collName, sort: {_id: 1}, batchSize: 20, readConcern: {level: "snapshot"}, - txnNumber: NumberLong(txnNumber++) + txnNumber: NumberLong(txnNumber) })); // The cursor has been exhausted. diff --git a/src/mongo/base/error_codes.err b/src/mongo/base/error_codes.err index e1c5002a512..392745bf2f4 100644 --- a/src/mongo/base/error_codes.err +++ b/src/mongo/base/error_codes.err @@ -253,6 +253,7 @@ error_code("ReentrancyNotAllowed", 252) error_code("FreeMonHttpInFlight", 253) error_code("FreeMonHttpTemporaryFailure", 254) error_code("FreeMonHttpPermanentFailure", 255) +error_code("TransactionCommitted", 256) # Error codes 4000-8999 are reserved. diff --git a/src/mongo/db/commands/txn_cmds.cpp b/src/mongo/db/commands/txn_cmds.cpp index 68088e6aca8..48708f2c9ec 100644 --- a/src/mongo/db/commands/txn_cmds.cpp +++ b/src/mongo/db/commands/txn_cmds.cpp @@ -77,7 +77,11 @@ public: uassert( ErrorCodes::CommandFailed, "commitTransaction must be run within a session", session); - // TODO SERVER-33501 Change this when commitTransaction is retryable. + // commitTransaction is retryable. + if (session->transactionIsCommitted()) { + return true; + } + uassert(ErrorCodes::NoSuchTransaction, "Transaction isn't in progress", session->inMultiDocumentTransaction()); diff --git a/src/mongo/db/repl/do_txn_test.cpp b/src/mongo/db/repl/do_txn_test.cpp index 67242427e4f..d6dde975452 100644 --- a/src/mongo/db/repl/do_txn_test.cpp +++ b/src/mongo/db/repl/do_txn_test.cpp @@ -149,7 +149,7 @@ void DoTxnTest::setUp() { true /* checkOutSession */, false /* autocommit */, true /* startTransaction */); - OperationContextSession::get(opCtx())->unstashTransactionResources(opCtx()); + OperationContextSession::get(opCtx())->unstashTransactionResources(opCtx(), "doTxn"); } void DoTxnTest::tearDown() { diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp index 021933e87e7..43ab916f157 100644 --- a/src/mongo/db/service_entry_point_common.cpp +++ b/src/mongo/db/service_entry_point_common.cpp @@ -433,7 +433,7 @@ void invokeInTransaction(OperationContext* opCtx, return; } - session->unstashTransactionResources(opCtx); + session->unstashTransactionResources(opCtx, invocation->definition()->getName()); ScopeGuard guard = MakeGuard([session, opCtx]() { session->abortActiveTransaction(opCtx); }); invocation->run(opCtx, replyBuilder); diff --git a/src/mongo/db/session.cpp b/src/mongo/db/session.cpp index 9c34e10c4df..acf721b5015 100644 --- a/src/mongo/db/session.cpp +++ b/src/mongo/db/session.cpp @@ -614,7 +614,7 @@ void Session::stashTransactionResources(OperationContext* opCtx) { _txnResourceStash = TxnResources(opCtx); } -void Session::unstashTransactionResources(OperationContext* opCtx) { +void Session::unstashTransactionResources(OperationContext* opCtx, const std::string& cmdName) { if (opCtx->getClient()->isInDirectClient()) { return; } @@ -645,6 +645,12 @@ void Session::unstashTransactionResources(OperationContext* opCtx) { str::stream() << "Transaction " << *opCtx->getTxnNumber() << " has been aborted.", _txnState != MultiDocumentTransactionState::kAborted); + // Cannot change committed transaction but allow retrying commitTransaction command. + uassert(ErrorCodes::TransactionCommitted, + str::stream() << "Transaction " << *opCtx->getTxnNumber() << " has been committed.", + cmdName == "commitTransaction" || + _txnState != MultiDocumentTransactionState::kCommitted); + if (_txnResourceStash) { // Transaction resources already exist for this transaction. Transfer them from the // stash to the operation context. @@ -774,8 +780,7 @@ void Session::commitTransaction(OperationContext* opCtx) { // and migration, which do not check out the session. _checkIsActiveTransaction(lk, *opCtx->getTxnNumber(), true); - if (_txnState == MultiDocumentTransactionState::kCommitted) - return; + invariant(_txnState != MultiDocumentTransactionState::kCommitted); _commitTransaction(std::move(lk), opCtx); } diff --git a/src/mongo/db/session.h b/src/mongo/db/session.h index 099c3ec043e..774fa91eaef 100644 --- a/src/mongo/db/session.h +++ b/src/mongo/db/session.h @@ -232,7 +232,7 @@ public: /** * Transfers management of transaction resources from the Session to the OperationContext. */ - void unstashTransactionResources(OperationContext* opCtx); + void unstashTransactionResources(OperationContext* opCtx, const std::string& cmdName); /** * Commits the transaction, including committing the write unit of work and updating diff --git a/src/mongo/db/session_catalog_test.cpp b/src/mongo/db/session_catalog_test.cpp index 641c0880ca2..68151010483 100644 --- a/src/mongo/db/session_catalog_test.cpp +++ b/src/mongo/db/session_catalog_test.cpp @@ -190,7 +190,7 @@ TEST_F(SessionCatalogTest, StashInNestedSessionIsANoop) { repl::ReadConcernArgs::get(opCtx()) = readConcernArgs; // Perform initial unstash, which sets up a WriteUnitOfWork. - OperationContextSession::get(opCtx())->unstashTransactionResources(opCtx()); + OperationContextSession::get(opCtx())->unstashTransactionResources(opCtx(), "find"); ASSERT_EQUALS(originalLocker, opCtx()->lockState()); ASSERT_EQUALS(originalRecoveryUnit, opCtx()->recoveryUnit()); ASSERT(opCtx()->getWriteUnitOfWork()); @@ -241,7 +241,7 @@ TEST_F(SessionCatalogTest, UnstashInNestedSessionIsANoop) { DirectClientSetter inDirectClient(opCtx()); OperationContextSession innerScopedSession(opCtx(), true, boost::none, boost::none); - OperationContextSession::get(opCtx())->unstashTransactionResources(opCtx()); + OperationContextSession::get(opCtx())->unstashTransactionResources(opCtx(), "find"); // The unstash was a noop, so the OperationContext did not get a WriteUnitOfWork. ASSERT_EQUALS(originalLocker, opCtx()->lockState()); diff --git a/src/mongo/db/session_test.cpp b/src/mongo/db/session_test.cpp index c14900f7a11..60415aca574 100644 --- a/src/mongo/db/session_test.cpp +++ b/src/mongo/db/session_test.cpp @@ -594,7 +594,7 @@ TEST_F(SessionTest, StashAndUnstashResources) { repl::ReadConcernArgs::get(opCtx()) = readConcernArgs; // Perform initial unstash which sets up a WriteUnitOfWork. - session.unstashTransactionResources(opCtx()); + session.unstashTransactionResources(opCtx(), "find"); ASSERT_EQUALS(originalLocker, opCtx()->lockState()); ASSERT_EQUALS(originalRecoveryUnit, opCtx()->recoveryUnit()); ASSERT(opCtx()->getWriteUnitOfWork()); @@ -615,7 +615,7 @@ TEST_F(SessionTest, StashAndUnstashResources) { // Unstash the stashed resources. This restores the original Locker and RecoveryUnit to the // OperationContext. - session.unstashTransactionResources(opCtx()); + session.unstashTransactionResources(opCtx(), "find"); ASSERT_EQUALS(originalLocker, opCtx()->lockState()); ASSERT_EQUALS(originalRecoveryUnit, opCtx()->recoveryUnit()); ASSERT(opCtx()->getWriteUnitOfWork()); @@ -647,7 +647,7 @@ TEST_F(SessionTest, ReportStashedResources) { repl::ReadConcernArgs::get(opCtx()) = readConcernArgs; // Perform initial unstash which sets up a WriteUnitOfWork. - session.unstashTransactionResources(opCtx()); + session.unstashTransactionResources(opCtx(), "find"); ASSERT(opCtx()->getWriteUnitOfWork()); // Take a lock. This is expected in order to stash resources. @@ -685,7 +685,7 @@ TEST_F(SessionTest, ReportStashedResources) { // Unstash the stashed resources. This restores the original Locker and RecoveryUnit to the // OperationContext. - session.unstashTransactionResources(opCtx()); + session.unstashTransactionResources(opCtx(), "commitTransaction"); ASSERT(opCtx()->getWriteUnitOfWork()); // With the resources unstashed, verify that the Session reports an empty stashed state. @@ -799,7 +799,7 @@ TEST_F(SessionTest, AbortClearsStoredStatements) { opCtx()->setLogicalSessionId(sessionId); opCtx()->setTxnNumber(txnNum); session.beginOrContinueTxn(opCtx(), txnNum, false, true); - session.unstashTransactionResources(opCtx()); + session.unstashTransactionResources(opCtx(), "insert"); auto operation = repl::OplogEntry::makeInsertOperation(kNss, kUUID, BSON("TestValue" << 0)); session.addTransactionOperation(opCtx(), operation); ASSERT_BSONOBJ_EQ(operation.toBSON(), session.transactionOperationsForTest()[0].toBSON()); @@ -822,7 +822,7 @@ TEST_F(SessionTest, EmptyTransactionCommit) { opCtx()->setLogicalSessionId(sessionId); opCtx()->setTxnNumber(txnNum); session.beginOrContinueTxn(opCtx(), txnNum, false, true); - session.unstashTransactionResources(opCtx()); + session.unstashTransactionResources(opCtx(), "commitTransaction"); // The transaction machinery cannot store an empty locker. Lock::GlobalLock lk(opCtx(), MODE_IX, Date_t::now()); session.commitTransaction(opCtx()); @@ -841,7 +841,7 @@ TEST_F(SessionTest, EmptyTransactionAbort) { opCtx()->setLogicalSessionId(sessionId); opCtx()->setTxnNumber(txnNum); session.beginOrContinueTxn(opCtx(), txnNum, false, true); - session.unstashTransactionResources(opCtx()); + session.unstashTransactionResources(opCtx(), "abortTransaction"); // The transaction machinery cannot store an empty locker. { Lock::GlobalLock lk(opCtx(), MODE_IX, Date_t::now()); } session.stashTransactionResources(opCtx()); @@ -863,7 +863,7 @@ TEST_F(SessionTest, ConcurrencyOfUnstashAndAbort) { session.abortArbitraryTransaction(); // An unstash after an abort should uassert. - ASSERT_THROWS_CODE(session.unstashTransactionResources(opCtx()), + ASSERT_THROWS_CODE(session.unstashTransactionResources(opCtx(), "find"), AssertionException, ErrorCodes::NoSuchTransaction); } @@ -878,7 +878,7 @@ TEST_F(SessionTest, ConcurrencyOfUnstashAndMigration) { opCtx()->setTxnNumber(txnNum); session.beginOrContinueTxn(opCtx(), txnNum, false, true); - session.unstashTransactionResources(opCtx()); + session.unstashTransactionResources(opCtx(), "insert"); // The transaction machinery cannot store an empty locker. { Lock::GlobalLock lk(opCtx(), MODE_IX, Date_t::now()); } auto operation = repl::OplogEntry::makeInsertOperation(kNss, kUUID, BSON("TestValue" << 0)); @@ -890,7 +890,7 @@ TEST_F(SessionTest, ConcurrencyOfUnstashAndMigration) { bumpTxnNumberFromDifferentOpCtx(&session, higherTxnNum); // An unstash after a migration that bumps the active transaction number should uassert. - ASSERT_THROWS_CODE(session.unstashTransactionResources(opCtx()), + ASSERT_THROWS_CODE(session.unstashTransactionResources(opCtx(), "insert"), AssertionException, ErrorCodes::ConflictingOperationInProgress); } @@ -905,7 +905,7 @@ TEST_F(SessionTest, ConcurrencyOfStashAndAbort) { opCtx()->setTxnNumber(txnNum); session.beginOrContinueTxn(opCtx(), txnNum, false, true); - session.unstashTransactionResources(opCtx()); + session.unstashTransactionResources(opCtx(), "find"); // The transaction may be aborted without checking out the session. session.abortArbitraryTransaction(); @@ -924,7 +924,7 @@ TEST_F(SessionTest, ConcurrencyOfStashAndMigration) { opCtx()->setTxnNumber(txnNum); session.beginOrContinueTxn(opCtx(), txnNum, false, true); - session.unstashTransactionResources(opCtx()); + session.unstashTransactionResources(opCtx(), "insert"); auto operation = repl::OplogEntry::makeInsertOperation(kNss, kUUID, BSON("TestValue" << 0)); session.addTransactionOperation(opCtx(), operation); @@ -948,7 +948,7 @@ TEST_F(SessionTest, ConcurrencyOfAddTransactionOperationAndAbort) { opCtx()->setTxnNumber(txnNum); session.beginOrContinueTxn(opCtx(), txnNum, false, true); - session.unstashTransactionResources(opCtx()); + session.unstashTransactionResources(opCtx(), "insert"); // The transaction may be aborted without checking out the session. session.abortArbitraryTransaction(); @@ -970,7 +970,7 @@ TEST_F(SessionTest, ConcurrencyOfAddTransactionOperationAndMigration) { opCtx()->setTxnNumber(txnNum); session.beginOrContinueTxn(opCtx(), txnNum, false, true); - session.unstashTransactionResources(opCtx()); + session.unstashTransactionResources(opCtx(), "find"); auto operation = repl::OplogEntry::makeInsertOperation(kNss, kUUID, BSON("TestValue" << 0)); session.addTransactionOperation(opCtx(), operation); @@ -995,7 +995,7 @@ TEST_F(SessionTest, ConcurrencyOfEndTransactionAndRetrieveOperationsAndAbort) { opCtx()->setTxnNumber(txnNum); session.beginOrContinueTxn(opCtx(), txnNum, false, true); - session.unstashTransactionResources(opCtx()); + session.unstashTransactionResources(opCtx(), "insert"); // The transaction may be aborted without checking out the session. session.abortArbitraryTransaction(); @@ -1016,7 +1016,7 @@ TEST_F(SessionTest, ConcurrencyOfEndTransactionAndRetrieveOperationsAndMigration opCtx()->setTxnNumber(txnNum); session.beginOrContinueTxn(opCtx(), txnNum, false, true); - session.unstashTransactionResources(opCtx()); + session.unstashTransactionResources(opCtx(), "insert"); auto operation = repl::OplogEntry::makeInsertOperation(kNss, kUUID, BSON("TestValue" << 0)); session.addTransactionOperation(opCtx(), operation); @@ -1041,7 +1041,7 @@ TEST_F(SessionTest, ConcurrencyOfCommitTransactionAndAbort) { opCtx()->setTxnNumber(txnNum); session.beginOrContinueTxn(opCtx(), txnNum, false, true); - session.unstashTransactionResources(opCtx()); + session.unstashTransactionResources(opCtx(), "commitTransaction"); // The transaction may be aborted without checking out the session. session.abortArbitraryTransaction(); @@ -1061,7 +1061,7 @@ TEST_F(SessionTest, ConcurrencyOfCommitTransactionAndMigration) { opCtx()->setTxnNumber(txnNum); session.beginOrContinueTxn(opCtx(), txnNum, false, true); - session.unstashTransactionResources(opCtx()); + session.unstashTransactionResources(opCtx(), "insert"); auto operation = repl::OplogEntry::makeInsertOperation(kNss, kUUID, BSON("TestValue" << 0)); session.addTransactionOperation(opCtx(), operation); |