diff options
author | Nathan Louie <nathan.louie@10gen.com> | 2018-06-19 11:29:24 -0400 |
---|---|---|
committer | Nathan Louie <nathan.louie@10gen.com> | 2018-06-25 17:21:30 -0400 |
commit | ace1aec25c5324fb51083e266757e48ef664be55 (patch) | |
tree | 4c1f0e6c8f12c6c38c82f8eb4bcdfb33335ed3ac /src/mongo/db | |
parent | d28c9472878a9e50196c568848c84d6225036406 (diff) | |
download | mongo-ace1aec25c5324fb51083e266757e48ef664be55.tar.gz |
initial review
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/server_transactions_metrics.h | 10 | ||||
-rw-r--r-- | src/mongo/db/session.cpp | 7 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/mongo/db/server_transactions_metrics.h b/src/mongo/db/server_transactions_metrics.h index 6ed3aad007c..f877a1f8b23 100644 --- a/src/mongo/db/server_transactions_metrics.h +++ b/src/mongo/db/server_transactions_metrics.h @@ -46,11 +46,6 @@ public: static ServerTransactionsMetrics* get(ServiceContext* service); static ServerTransactionsMetrics* get(OperationContext* opCtx); -<<<<<<< HEAD - unsigned long long getCurrentOpen() const; - void decrementCurrentOpen(); - void incrementCurrentOpen(); -======= unsigned long long getCurrentActive() const; void decrementCurrentActive(); void incrementCurrentActive(); @@ -58,7 +53,10 @@ public: unsigned long long getCurrentInactive() const; void decrementCurrentInactive(); void incrementCurrentInactive(); ->>>>>>> 40c317ccbb... added to class + + unsigned long long getCurrentOpen() const; + void decrementCurrentOpen(); + void incrementCurrentOpen(); unsigned long long getTotalStarted() const; void incrementTotalStarted(); diff --git a/src/mongo/db/session.cpp b/src/mongo/db/session.cpp index cb511947cff..04b56675a5b 100644 --- a/src/mongo/db/session.cpp +++ b/src/mongo/db/session.cpp @@ -597,6 +597,7 @@ void Session::_beginOrContinueTxn(WithLock wl, stdx::chrono::seconds{transactionLifetimeLimitSeconds.load()}; ServerTransactionsMetrics::get(getGlobalServiceContext())->incrementTotalStarted(); ServerTransactionsMetrics::get(getGlobalServiceContext())->incrementCurrentOpen(); + ServerTransactionsMetrics::get(getGlobalServiceContext())->incrementCurrentActive(); } else { // Execute a retryable write. invariant(startTransaction == boost::none); @@ -725,6 +726,8 @@ void Session::stashTransactionResources(OperationContext* opCtx) { invariant(!_txnResourceStash); _txnResourceStash = TxnResources(opCtx); + ServerTransactionsMetrics::get(opCtx)->decrementCurrentActive(); + ServerTransactionsMetrics::get(opCtx)->incrementCurrentInactive(); } void Session::unstashTransactionResources(OperationContext* opCtx, const std::string& cmdName) { @@ -778,6 +781,8 @@ void Session::unstashTransactionResources(OperationContext* opCtx, const std::st if (_txnState == MultiDocumentTransactionState::kInProgress) { _singleTransactionStats->setActive(curTimeMicros64()); } + ServerTransactionsMetrics::get(opCtx)->incrementCurrentActive(); + ServerTransactionsMetrics::get(opCtx)->decrementCurrentInactive(); return; } @@ -917,6 +922,7 @@ void Session::_abortTransaction(WithLock wl) { } } ServerTransactionsMetrics::get(getGlobalServiceContext())->decrementCurrentOpen(); + ServerTransactionsMetrics::get(getGlobalServiceContext())->decrementCurrentInactive(); } void Session::_beginOrContinueTxnOnMigration(WithLock wl, TxnNumber txnNumber) { @@ -1054,6 +1060,7 @@ void Session::_commitTransaction(stdx::unique_lock<stdx::mutex> lk, OperationCon _singleTransactionStats->setInactive(curTimeMicros64()); } ServerTransactionsMetrics::get(opCtx)->decrementCurrentOpen(); + ServerTransactionsMetrics::get(getGlobalServiceContext())->decrementCurrentActive(); } BSONObj Session::reportStashedState() const { |