diff options
author | Benety Goh <benety@mongodb.com> | 2022-08-29 06:49:09 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-08-29 11:21:41 +0000 |
commit | 41c52264f5ad613ad0e0b265f32ce58b6f2b1295 (patch) | |
tree | aed2469fd685b7637d7c195532e12984892197e7 /src/mongo/db/session | |
parent | d5978f3d85b3764a3876553a893f458485dc6d3d (diff) | |
download | mongo-41c52264f5ad613ad0e0b265f32ce58b6f2b1295.tar.gz |
SERVER-68215 add MongoDSessionCatalogTransactionInterface::refreshLocksForPreparedTransaction()
Diffstat (limited to 'src/mongo/db/session')
-rw-r--r-- | src/mongo/db/session/session_catalog_mongod.cpp | 11 | ||||
-rw-r--r-- | src/mongo/db/session/session_catalog_mongod_transaction_interface.h | 9 |
2 files changed, 9 insertions, 11 deletions
diff --git a/src/mongo/db/session/session_catalog_mongod.cpp b/src/mongo/db/session/session_catalog_mongod.cpp index b18b21190be..d02ed6d853d 100644 --- a/src/mongo/db/session/session_catalog_mongod.cpp +++ b/src/mongo/db/session/session_catalog_mongod.cpp @@ -551,16 +551,7 @@ void MongoDSessionCatalog::onStepUp(OperationContext* opCtx) { // lock in the IS mode prior to reading the config.transactions collection but it // cannot do that while the RSTL lock is being held by 'opCtx'. auto ocs = checkOutSessionWithoutRefresh(newOpCtx.get()); - auto txnParticipant = TransactionParticipant::get(newOpCtx.get()); - LOGV2_DEBUG(21979, - 3, - "Restoring locks of prepared transaction. SessionId: {sessionId} " - "TxnNumberAndRetryCounter: {txnNumberAndRetryCounter}", - "Restoring locks of prepared transaction", - "sessionId"_attr = sessionInfo.getSessionId()->getId(), - "txnNumberAndRetryCounter"_attr = - txnParticipant.getActiveTxnNumberAndRetryCounter()); - txnParticipant.refreshLocksForPreparedTransaction(newOpCtx.get(), false); + _ti->refreshLocksForPreparedTransaction(newOpCtx.get(), sessionInfo); } } diff --git a/src/mongo/db/session/session_catalog_mongod_transaction_interface.h b/src/mongo/db/session/session_catalog_mongod_transaction_interface.h index 95b70e4bec6..aff43d5b4c7 100644 --- a/src/mongo/db/session/session_catalog_mongod_transaction_interface.h +++ b/src/mongo/db/session/session_catalog_mongod_transaction_interface.h @@ -30,7 +30,8 @@ #pragma once #include "mongo/db/operation_context.h" -#include "mongo/db/session/logical_session_id.h" // for TxnNumberAndRetryCounter +#include "mongo/db/session/logical_session_id.h" // for TxnNumberAndRetryCounter +#include "mongo/db/session/logical_session_id_gen.h" // for OperationSessionInfo #include "mongo/db/session/session_catalog.h" // for ObservableSession and ScanSessionsCallbackFn #include "mongo/db/session/session_txn_record_gen.h" // for SessionTxnRecord #include "mongo/db/transaction/transaction_participant.h" // for SessionToKill @@ -89,6 +90,12 @@ public: virtual void abortTransaction(OperationContext* opCtx, const SessionTxnRecord& txnRecord) = 0; /** + * Yield or reacquire locks for prepared transactions, used on replication state transition. + */ + virtual void refreshLocksForPreparedTransaction(OperationContext* opCtx, + const OperationSessionInfo& sessionInfo) = 0; + + /** * Marks the session as requiring refresh. Used when the session state has been modified * externally, such as through a direct write to the transactions table. */ |