[SERVER-35151] Track total number of active and inactive transactions in ServerTransactionsMetrics Created: 22/May/18  Updated: 29/Oct/23  Resolved: 26/Jun/18

Status: Closed
Project: Core Server
Component/s: Diagnostics, Replication
Affects Version/s: None
Fix Version/s: 4.0.2, 4.1.1

Type: Task Priority: Major - P3
Reporter: William Schultz (Inactive) Assignee: Nathan Louie
Resolution: Fixed Votes: 0
Labels: global-txn-metrics
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
depends on SERVER-35129 Create a ServerTransactionsMetrics cl... Closed
is depended on by SERVER-35293 Add counts of active and inactive tra... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.0
Sprint: Repl 2018-07-02
Participants:
Linked BF Score: 0

 Description   

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".



 Comments   
Comment by Githook User [ 16/Aug/18 ]

Author:

{'username': 'nxlouie', 'email': 'nathan.louie@10gen.com', 'name': 'Nathan Louie'}

Message: SERVER-35151 Track total number of active/inactive transactions in ServerTransactionsMetrics

(cherry picked from commit d28c9472878a9e50196c568848c84d6225036406)
Branch: v4.0
https://github.com/mongodb/mongo/commit/95064cf5603d1c52f952ca5b40251f804eeaf788

Comment by Nathan Louie [ 25/Jun/18 ]

Forgot to rebase before pushing.

Comment by Nathan Louie [ 25/Jun/18 ]

Author:

{'username': 'nxlouie', 'name': 'Nathan Louie', 'email': 'nathan.louie@10gen.com'}

Branch: master
https://github.com/mongodb/mongo/commit/d28c9472878a9e50196c568848c84d6225036406

https://github.com/mongodb/mongo/commit/ace1aec25c5324fb51083e266757e48ef664be55

https://github.com/mongodb/mongo/commit/aaec2087d9e70fa24293326bf5297808570dcc11

https://github.com/mongodb/mongo/commit/fcda650b90f497c26ecfe121249f421adada8451

https://github.com/mongodb/mongo/commit/6e78c920ab239e415700fedba49d3c08709461e4

https://github.com/mongodb/mongo/commit/a4cc866475278e943d9b840b99185667158db59d

https://github.com/mongodb/mongo/commit/70255f060ec9aacdb990a5e37a55c8c7b272c8b8

Comment by Nathan Louie [ 18/Jun/18 ]

Given that we need to unstash resources before committing as discussed in SERVER-35149, is it reasonable to say that all commits will decrement the currentActive counter?

Generated at Thu Feb 08 04:38:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.