summaryrefslogtreecommitdiff
path: root/src/mongo/s/transaction_router_resource_yielder.cpp
diff options
context:
space:
mode:
authorCheahuychou Mao <mao.cheahuychou@gmail.com>2022-06-28 19:31:11 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-06-28 20:41:29 +0000
commite9c76b4e8a2f206bbb0e5b0e6c00a4207d7c0ead (patch)
tree148ca066c1d1452e8d2f82afcdd6eaf2059a1bb4 /src/mongo/s/transaction_router_resource_yielder.cpp
parent958abd27579450e032f5ee4189b4e0b2687c8b22 (diff)
downloadmongo-e9c76b4e8a2f206bbb0e5b0e6c00a4207d7c0ead.tar.gz
SERVER-67537 Add logging to allow TransactionRouterResourceYielder to be debugged
Diffstat (limited to 'src/mongo/s/transaction_router_resource_yielder.cpp')
-rw-r--r--src/mongo/s/transaction_router_resource_yielder.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/s/transaction_router_resource_yielder.cpp b/src/mongo/s/transaction_router_resource_yielder.cpp
index b0621f1792d..a5bfea59878 100644
--- a/src/mongo/s/transaction_router_resource_yielder.cpp
+++ b/src/mongo/s/transaction_router_resource_yielder.cpp
@@ -30,10 +30,13 @@
#include "mongo/s/transaction_router_resource_yielder.h"
#include "mongo/db/session_catalog.h"
+#include "mongo/logv2/log.h"
#include "mongo/s/is_mongos.h"
#include "mongo/s/session_catalog_router.h"
#include "mongo/util/exit.h"
+#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kTransaction
+
namespace mongo {
namespace {
@@ -57,6 +60,11 @@ TransactionRouterResourceYielder::makeForRemoteCommand() {
void TransactionRouterResourceYielder::yield(OperationContext* opCtx) {
Session* const session = OperationContextSession::get(opCtx);
if (session) {
+ LOGV2_DEBUG(6753700,
+ 5,
+ "TransactionRouterResourceYielder yielding",
+ "lsid"_attr = opCtx->getLogicalSessionId(),
+ "txnNumber"_attr = opCtx->getTxnNumber());
RouterOperationContextSession::checkIn(opCtx,
OperationContextSession::CheckInReason::kYield);
}
@@ -66,6 +74,11 @@ void TransactionRouterResourceYielder::yield(OperationContext* opCtx) {
void TransactionRouterResourceYielder::unyield(OperationContext* opCtx) {
if (_yielded) {
hangBeforeUnyieldingTransactionRouter.pauseWhileSet();
+ LOGV2_DEBUG(6753701,
+ 5,
+ "TransactionRouterResourceYielder unyielding",
+ "lsid"_attr = opCtx->getLogicalSessionId(),
+ "txnNumber"_attr = opCtx->getTxnNumber());
// Code that uses the TransactionRouter assumes it will only run with it, so check back out
// the session ignoring interruptions, except at global shutdown to prevent stalling