diff options
author | mike o'brien <mpobrien005@gmail.com> | 2015-02-11 14:50:43 -0500 |
---|---|---|
committer | mike o'brien <mpobrien005@gmail.com> | 2015-02-11 17:07:58 -0500 |
commit | f53b5680906345ca301e087b31a08c32df4ec6d0 (patch) | |
tree | 031b3a8ec85716f12842dc7dedb3cc4d7a3555e9 | |
parent | 6e694cedaa583abdd3137c4e79eef294ab3cddaf (diff) | |
download | mongo-f53b5680906345ca301e087b31a08c32df4ec6d0.tar.gz |
TOOLS-624 use db.serverStatus().concurrentTransactions to calculate aw/ar and qw/qr for WT nodes
-rw-r--r-- | mongostat/stat_types.go | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/mongostat/stat_types.go b/mongostat/stat_types.go index 6b1319158a5..3adc9ca3c58 100644 --- a/mongostat/stat_types.go +++ b/mongostat/stat_types.go @@ -74,8 +74,18 @@ type ServerStatus struct { // WiredTiger stores information related to the WiredTiger storage engine. type WiredTiger struct { - Transaction TransactionStats `bson:"transaction"` - Cache CacheStats `bson:"cache"` + Transaction TransactionStats `bson:"transaction"` + Concurrent ConcurrentTransactions `bson:"concurrentTransactions"` + Cache CacheStats `bson:"cache"` +} + +type ConcurrentTransactions struct { + Write ConcurrentTransStats `bson:"write"` + Read ConcurrentTransStats `bson:"read"` +} + +type ConcurrentTransStats struct { + Out int64 `bson:"out"` } // CacheStats stores cache statistics for WiredTiger. @@ -837,12 +847,28 @@ func NewStatLine(oldStat, newStat ServerStatus, key string, all bool, sampleSecs } if newStat.GlobalLock != nil { + hasWT := (newStat.WiredTiger != nil && oldStat.WiredTiger != nil) + //If we have wiredtiger stats, use those instead if newStat.GlobalLock.CurrentQueue != nil { - returnVal.QueuedReaders = newStat.GlobalLock.CurrentQueue.Readers - returnVal.QueuedWriters = newStat.GlobalLock.CurrentQueue.Writers + if hasWT { + returnVal.QueuedReaders = newStat.GlobalLock.CurrentQueue.Readers + newStat.GlobalLock.ActiveClients.Readers - newStat.WiredTiger.Concurrent.Read.Out + returnVal.QueuedWriters = newStat.GlobalLock.CurrentQueue.Writers + newStat.GlobalLock.ActiveClients.Writers - newStat.WiredTiger.Concurrent.Write.Out + if returnVal.QueuedReaders < 0 { + returnVal.QueuedReaders = 0 + } + if returnVal.QueuedWriters < 0 { + returnVal.QueuedWriters = 0 + } + } else { + returnVal.QueuedReaders = newStat.GlobalLock.CurrentQueue.Readers + returnVal.QueuedWriters = newStat.GlobalLock.CurrentQueue.Writers + } } - if newStat.GlobalLock.ActiveClients != nil { + if hasWT { + returnVal.ActiveReaders = newStat.WiredTiger.Concurrent.Read.Out + returnVal.ActiveWriters = newStat.WiredTiger.Concurrent.Write.Out + } else if newStat.GlobalLock.ActiveClients != nil { returnVal.ActiveReaders = newStat.GlobalLock.ActiveClients.Readers returnVal.ActiveWriters = newStat.GlobalLock.ActiveClients.Writers } |