-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Diagnostics, Logging
-
None
-
Major Change
-
Query 15 (06/03/16), Query 16 (06/24/16)
ISSUE SUMMARY
This project improves the existing MongoDB diagnostics facilities by ensuring that the same diagnostic information is available across all operations.
Consistent reporting of metrics across user operations
All relevant metrics are supported for each command and operation (with a small list of exceptions below). These metrics are available in the slow diagnostic log, the profiler and db.currentOp().
Operations included
- count
- distinct
- find (command + OP_QUERY)
- findAndModify
- getMore (command + OP_GET_MORE)
- geoNear
- group
- mapReduce
- delete (command + OP_DELETE)
- update (command + OP_UPDATE)
Metrics covered
- keysExamined
- docsExamined
- reslen
- nreturned
- ntoreturn
- batchSize
- numYields
- cursorExhausted
- planSummary
- cursorid
- writeConflicts
- hasSortStage
- fromMultiPlanner
- replanned
- locks
- protocol
- millis
- ninserted (or 'upsert' for updates that result in an insert)
- multi
- nMatched
- nModified
- ndeleted
- ntoskip
- exhaust
- nmoved
- upsert
- execStats
Exceptions
- execStats is only available in the profiler output. It is not available in the slow diagnostics log or db.currentOp().
- execStats is not available for the aggregate command.
Introduction of new metrics
This project introduces 2 new metrics, 'keysInserted' and 'keysDeleted'. These metrics report the number of index keys inserted and deleted for all write operations. This replaces 'keyUpdates' which was not previously covered across write commands and is potentially misleading.
Removed metrics
This project removes the following metrics:
- fastmod: replaced by 'keysInserted', 'keysDeleted' and 'nmoved', which in combination can be used to derive this metric in a more granular, easy to understand manner.
- keyUpdates: replaced by 'keysInserted' and 'keysDeleted'.
- idhack: replaced by 'planSummary', which will report when the IDHACK stage is used.
- moved: obsoleted by the 'nmoved' metric.
See SERVER-23272 for the rationale behind this removal.
Deprecated metrics
- fastmodinsert: not considered generally useful for performance analysis.
Original description
Goals
- Improve existing diagnostics by ensuring that the same information is available across operations (e.g. we don't report planSummary for all operations).
- In other words, expose existing debug information more consistently.
Non-goals
- Collect additional debug information which we don't already collect.
- Major infrastructural changes to CurOp, the profiler, or the slow query log.
How
Part of the work for SERVER-10448 (a.k.a. "new explain"), completed for version 3.0, was to add a suite of functions capable of pulling summary statistics and debug information out of PlanExecutor (see explain.h). However, we use these functions in only a few places instead of uniformly populating CurOp with the available debug information. Using explain functionality to add the same stats to CurOp everywhere should be an easy win for diagnosability.
Details
This includes work for the following operations:
- count
- delete
- distinct
- find (OP_QUERY and command)
- findAndModify
- geoNear
- getMore (OP_GET_MORE and command)
- group
- update
The following fields will be added to CurOp for every operation once the operation completes:
- docsExamined
- hasBlockingSort
- idhack
- keysExamined
- nReturned
- planSummary
- is duplicated by
-
SERVER-25657 Inconsistent getMore logging
- Closed
-
SERVER-3444 Alter profiler to capture nscanned when doing counts
- Closed
- is related to
-
SERVER-22250 Diagnostic log messages missing debug information for query operations with execution times close to "slowms"
- Backlog
-
SERVER-22252 Diagnostic log messages missing debug information for queries that encounter execution error
- Backlog
-
SERVER-23357 db.serverStatus.metrics.document.inserted is double what it should be
- Closed
-
SERVER-13419 Plan summary string in slow query log is wrong if fell back to a non-blocking solution
- Closed
-
SERVER-3638 Full insert logging in query logs and/or profiling
- Closed
-
SERVER-14432 Flexible logging of certain queries
- Closed
-
SERVER-5830 Show original queries in currentOp or database profiler
- Closed
-
SERVER-5271 Add keysExamined, docsExamined, and nReturned counters to $currentOp
- Backlog
-
SERVER-5834 Log final count for count command
- Backlog
-
SERVER-7903 When logging a slow count, include the result document
- Backlog
-
SERVER-16265 Add query details to getmore entry in profiler and db.currentOp()
- Closed
-
SERVER-16847 Diagnostic log output for all query clients should include plan summary string
- Closed
-
SERVER-17275 Remove "stats" field from distinct command response
- Closed
-
SERVER-12823 Include query related fields for deletes in log/profiler
- Closed
-
SERVER-21470 Add index usage information to getmore queries in currentOp
- Closed
- related to
-
SERVER-21855 Certain commands are never captured in system profiler
- Backlog
-
SERVER-8912 Metric "document.scanned" is not the same as nscannedObjects (from explain)
- Closed
-
SERVER-15239 serverStatus metrics incorrect: "operation.idhack", "queryExecutor.scanned", "queryExecutor.scannedObjects"
- Closed
-
SERVER-15240 serverStatus metric "document.returned" incorrect
- Closed
-
SERVER-16071 The nscanned and nscannedObjects is not correct for findAndModify
- Closed
-
SERVER-23009 CRUD commands / operations should only produce profiler source object when needed
- Closed
-
SERVER-23255 Log keyUpdates & writeConflicts only when meaningful
- Closed
-
SERVER-23081 keyUpdates not set on MMAPv1 document move
- Closed
-
SERVER-15102 dbCurrentOp should show used index
- Closed
-
SERVER-13034 Rename "upserted" field to "inserted" in update command reply
- Backlog
-
SERVER-23620 Add a failpoint which forces query replanning
- Backlog
-
SERVER-23861 Add keysInserted & keysDeleted to serverStatus
- Backlog
-
SERVER-3129 Include projection in the slow query logs
- Closed