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

Add cursorID and ConnectionID to system.profile documents

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Gone away
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Diagnostics, Logging
    • Labels:
      None

      Description

      In 3.2 I get the following.

      MongoDB Enterprise > db.system.profile.find().limit(10).sort( { ts : -1 } ).pretty()
      {
      	"op" : "query",
      	"ns" : "test.testcol",
      	"query" : {
      		"find" : "testcol",
      		"filter" : {
      			
      		}
      	},
      	"keysExamined" : 0,
      	"docsExamined" : 1,
      	"cursorExhausted" : true,
      	"keyUpdates" : 0,
      	"writeConflicts" : 0,
      	"numYield" : 0,
      	"locks" : {
      		"Global" : {
      			"acquireCount" : {
      				"r" : NumberLong(2)
      			}
      		},
      		"Database" : {
      			"acquireCount" : {
      				"r" : NumberLong(1)
      			}
      		},
      		"Collection" : {
      			"acquireCount" : {
      				"r" : NumberLong(1)
      			}
      		}
      	},
      	"nreturned" : 1,
      	"responseLength" : 139,
      	"protocol" : "op_command",
      	"millis" : 0,
      	"execStats" : {
      		"stage" : "COLLSCAN",
      		"filter" : {
      			"$and" : [ ]
      		},
      		"nReturned" : 1,
      		"executionTimeMillisEstimate" : 0,
      		"works" : 3,
      		"advanced" : 1,
      		"needTime" : 1,
      		"needYield" : 0,
      		"saveState" : 0,
      		"restoreState" : 0,
      		"isEOF" : 1,
      		"invalidates" : 0,
      		"direction" : "forward",
      		"docsExamined" : 1
      	},
      	"ts" : ISODate("2016-03-24T14:09:40.200Z"),
      	"client" : "127.0.0.1",
      	"allUsers" : [ ],
      	"user" : ""
      }
      

      I know "cursorExhausted" : true means the cursor was consumed. I would like to capture the ID regardless. I want to be able to take a slow query from the mongod.log and get deeper stats on it without having to parse and do complicated queries. My colleague did a getmore and got:

      {
          "op" : "getmore",
          "ns" : "test.test",
          "query" : {
              "getMore" : NumberLong("32613554020"),
              "collection" : "test"
          },
          "cursorid" : 32613554020,
          "cursorExhausted" : true,
          "keyUpdates" : 0,
          "writeConflicts" : 0,
          "numYield" : 7,
          "locks" : {
              "Global" : {
                  "acquireCount" : {
                      "r" : NumberLong(16)
                  }
              },
              "Database" : {
                  "acquireCount" : {
                      "r" : NumberLong(8)
                  }
              },
              "Collection" : {
                  "acquireCount" : {
                      "r" : NumberLong(8)
                  }
              }
          },
          "nreturned" : 899,
          "responseLength" : 34133,
          "protocol" : "op_command",
          "millis" : 3,
          "execStats" : {
              
          },
          "ts" : ISODate("2016-03-24T13:58:47.891Z"),
          "client" : "127.0.0.1",
          "allUsers" : [ ],
          "user" : ""
      }
      

      I'd like the output to be consistent, to capture the cursorID in all cases to be able to compare to the mongod.log and to also be able to use the system.profile for diagnostics.

        Attachments

          Activity

            People

            Assignee:
            asya Asya Kamsky
            Reporter:
            shakir.sadikali Shakir Sadikali
            Participants:
            Votes:
            2 Vote for this issue
            Watchers:
            12 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: