[SERVER-19981] Log query options Created: 17/Aug/15  Updated: 03/Sep/15  Resolved: 21/Aug/15

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Kevin Pulo Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
Backwards Compatibility: Fully Compatible
Participants:

 Description   

The options specified for a query can alter server behaviour in important ways, but these options are not recorded in log lines. It would be useful if they could be included (even just numerically), eg:

rs.slaveOk()
db.test.find().addOption(DBQuery.Option.noTimeout)

results in

-2015-08-17T15:40:38.088+1000 I QUERY    [conn3] query test.test planSummary: COLLSCAN cursorid:30655346326 ntoreturn:0 ntoskip:0 nscanned:0 nscannedObjects:101 keyUpdates:0 writeConflicts:0 numYields:0 nreturned:101 reslen:2242 locks:{ Global: { acquireCount: { r: 2 } }, MMAPV1Journal: { acquireCount: { r: 1 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { R: 1 } } } 0ms
+2015-08-17T15:40:38.088+1000 I QUERY    [conn3] query test.test planSummary: COLLSCAN options:20 cursorid:30655346326 ntoreturn:0 ntoskip:0 nscanned:0 nscannedObjects:101 keyUpdates:0 writeConflicts:0 numYields:0 nreturned:101 reslen:2242 locks:{ Global: { acquireCount: { r: 2 } }, MMAPV1Journal: { acquireCount: { r: 1 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { R: 1 } } } 0ms

or

-2015-08-17T15:40:38.088+1000 I QUERY    [conn3] query test.test planSummary: COLLSCAN cursorid:30655346326 ntoreturn:0 ntoskip:0 nscanned:0 nscannedObjects:101 keyUpdates:0 writeConflicts:0 numYields:0 nreturned:101 reslen:2242 locks:{ Global: { acquireCount: { r: 2 } }, MMAPV1Journal: { acquireCount: { r: 1 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { R: 1 } } } 0ms
+2015-08-17T15:40:38.088+1000 I QUERY    [conn3] query test.test planSummary: COLLSCAN options:20(slaveOk,noTimeout) cursorid:30655346326 ntoreturn:0 ntoskip:0 nscanned:0 nscannedObjects:101 keyUpdates:0 writeConflicts:0 numYields:0 nreturned:101 reslen:2242 locks:{ Global: { acquireCount: { r: 2 } }, MMAPV1Journal: { acquireCount: { r: 1 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { R: 1 } } } 0ms



 Comments   
Comment by David Storch [ 17/Aug/15 ]

The query options will be visible in the log line produced by a find command. Unless we produce a targeted fix for the old OP_QUERY path, this ticket is a dup of SERVER-15176. A find command log line with the noTimeout option will look something like this:

2015-08-17T09:22:21.913-0400 I COMMAND  [conn1] command test.c command: find { find: "c", filter: {}, noCursorTimeout: true } planSummary: COLLSCAN ntoreturn:0 ntoskip:0 nscanned:0 nscannedObjects:1 cursorExhausted:1 keyUpdates:0 writeConflicts:0 numYields:0 nreturned:1 reslen:122 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { r: 1 } } } protocol:op_command 0ms

Generated at Thu Feb 08 03:52:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.