-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Diagnostics, Replication
-
Fully Compatible
-
v4.0
-
Repl 2018-07-02
-
0
We want to track the total number of active and inactive transactions currently running. To do this, we should currentActive and currentInactive counter fields to ServerTransactionsMetrics that track these respective metrics. A transaction is considered "active" if it is currently executing an operation as a part of that transaction, and considered "inactive" if it the transaction is open, but idly waiting for a new operation to occur. The "unstash" and "stash" events are a way to mark the transitions between "active" and "inactive" transaction state i.e. if a transaction's resources are currently stashed on the session, it implies that the transaction is inactive. Whenever a transaction becomes "active" (unstash), we should increment the ServerTransactionsMetrics::currentActive and decrement the ServerTransactionsMetrics::currentInactive counter. Similarly for when it becomes "inactive" (stash). Also, when a transaction first starts, we must increment currentActive. When it finishes (commits or aborts), we must decrement currentActive or currentInactive, depending on the cause of commit/abort i.e. a transaction might abort due to an abort command, in which case it goes from "inactive" => "aborted", or it might abort due to a write conflict, in which case it goes from "active" => "aborted".
- depends on
-
SERVER-35129 Create a ServerTransactionsMetrics class and store it as a decoration on the ServiceContext
- Closed
- is depended on by
-
SERVER-35293 Add counts of active and inactive transactions to serverStatus
- Closed