diff options
author | jinichu <jinnybyun@gmail.com> | 2018-07-26 15:26:40 -0400 |
---|---|---|
committer | jinichu <jinnybyun@gmail.com> | 2018-07-26 15:26:40 -0400 |
commit | 835cf665a19d0b5bfddd817bb9b266b479d115fb (patch) | |
tree | 53058f3c59326cc7880fe69149b4fa3026228de2 /src/mongo/db/session.cpp | |
parent | 9efd0191bbd884996337fd2561e984896fcc48ae (diff) | |
download | mongo-835cf665a19d0b5bfddd817bb9b266b479d115fb.tar.gz |
SERVER-35450 Add SingleTransactionStats::LastClientInfo to CurrentOp for inactive transactions
Diffstat (limited to 'src/mongo/db/session.cpp')
-rw-r--r-- | src/mongo/db/session.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mongo/db/session.cpp b/src/mongo/db/session.cpp index 52b5204af58..4601836a359 100644 --- a/src/mongo/db/session.cpp +++ b/src/mongo/db/session.cpp @@ -745,7 +745,7 @@ void Session::stashTransactionResources(OperationContext* opCtx) { // Update the LastClientInfo object stored in the SingleTransactionStats instance on the Session // with this Client's information. This is the last client that ran a transaction operation on // the Session. - _singleTransactionStats->getLastClientInfo()->update(opCtx->getClient()); + _singleTransactionStats->updateLastClientInfo(opCtx->getClient()); } void Session::unstashTransactionResources(OperationContext* opCtx, const std::string& cmdName) { @@ -927,7 +927,7 @@ void Session::abortActiveTransaction(OperationContext* opCtx) { // Update the LastClientInfo object stored in the SingleTransactionStats instance on the Session // with this Client's information. - _singleTransactionStats->getLastClientInfo()->update(opCtx->getClient()); + _singleTransactionStats->updateLastClientInfo(opCtx->getClient()); } void Session::_abortTransaction(WithLock wl) { @@ -1094,7 +1094,7 @@ void Session::_commitTransaction(stdx::unique_lock<stdx::mutex> lk, CurOp::get(opCtx)->debug().additiveMetrics); // Update the LastClientInfo object stored in the SingleTransactionStats instance on // the Session with this Client's information. - _singleTransactionStats->getLastClientInfo()->update(opCtx->getClient()); + _singleTransactionStats->updateLastClientInfo(opCtx->getClient()); } } // We must clear the recovery unit and locker so any post-transaction writes can run without @@ -1133,7 +1133,7 @@ void Session::_commitTransaction(stdx::unique_lock<stdx::mutex> lk, CurOp::get(opCtx)->debug().additiveMetrics); // Update the LastClientInfo object stored in the SingleTransactionStats instance on the Session // with this Client's information. - _singleTransactionStats->getLastClientInfo()->update(opCtx->getClient()); + _singleTransactionStats->updateLastClientInfo(opCtx->getClient()); } BSONObj Session::reportStashedState() const { @@ -1150,6 +1150,11 @@ void Session::reportStashedState(BSONObjBuilder* builder) const { invariant(_activeTxnNumber != kUninitializedTxnNumber); builder->append("host", getHostNameCachedAndPort()); builder->append("desc", "inactive transaction"); + auto lastClientInfo = _singleTransactionStats->getLastClientInfo(); + builder->append("client", lastClientInfo.clientHostAndPort); + builder->append("connectionId", lastClientInfo.connectionId); + builder->append("appName", lastClientInfo.appName); + builder->append("clientMetadata", lastClientInfo.clientMetadata); { BSONObjBuilder lsid(builder->subobjStart("lsid")); getSessionId().serialize(&lsid); |