Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-35151

Track total number of active and inactive transactions in ServerTransactionsMetrics




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


          Issue Links



              • Votes:
                0 Vote for this issue
                6 Start watching this issue


                • Created: