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

getMore command does not set "nreturned" operation counter

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.2.1, 3.3.0
    • Component/s: Querying
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Completed:
    • Sprint:
      QuInt D (12/14/15)

      Description

      The "nreturned" field is never displayed in the diagnostic log line generated by the getMore command. "nreturned" is properly shown for legacy OP_GET_MORE requests.

      Reproduce with the following script:

      > db.foo.drop()
      true
      > db.foo.insert([{},{},{},{},{}])
      BulkWriteResult({
      	"writeErrors" : [ ],
      	"writeConcernErrors" : [ ],
      	"nInserted" : 5,
      	"nUpserted" : 0,
      	"nMatched" : 0,
      	"nModified" : 0,
      	"nRemoved" : 0,
      	"upserted" : [ ]
      })
      > db.getMongo().forceReadMode('commands')
      > db.foo.find().batchSize(3).itcount()
      5
      > db.getMongo().forceReadMode('legacy')
      > db.foo.find().batchSize(3).itcount()
      5
      

      Output from the server when "commands" read mode is forced ("nreturned" not present for getMore):

      2015-12-02T17:48:07.148-0500 I COMMAND  [conn1] command test.foo command: find { find: "foo", filter: {}, batchSize: 3.0 } planSummary: COLLSCAN cursorid:30116070077 keysExamined:0 docsExamined:3 keyUpdates:0 writeConflicts:0 numYields:0 nreturned:3 reslen:174 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { r: 1 } } } protocol:op_command 0ms
      2015-12-02T17:48:07.149-0500 I COMMAND  [conn1] command test.foo command: getMore { getMore: 30116070077, collection: "foo", batchSize: 3.0 } ntoreturn:1 ntoskip:0 cursorExhausted:1 keyUpdates:0 writeConflicts:0 numYields:0 reslen:130 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { r: 1 } } } protocol:op_command 0ms
      

      Output from the server when "legacy" read mode is forced ("nreturned" present for getMore):

      2015-12-02T17:48:13.083-0500 I QUERY    [conn1] query test.foo planSummary: COLLSCAN cursorid:33369655876 ntoreturn:3 ntoskip:0 keysExamined:0 docsExamined:3 keyUpdates:0 writeConflicts:0 numYields:0 nreturned:3 reslen:86 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { r: 1 } } } 0ms
      2015-12-02T17:48:13.084-0500 I QUERY    [conn1] getmore test.foo cursorid:33369655876 ntoreturn:3 cursorExhausted:1 keyUpdates:0 writeConflicts:0 numYields:0 nreturned:2 reslen:64 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { r: 1 } } } 0ms
      

        Issue Links

          Activity

          Hide
          david.storch David Storch added a comment -

          We should also consider including keysExamined and docsExamined in the getMore command log lines (and maybe planSummary). We may also want to suppress ntoreturn and ntoskip, as we did for the find command log lines.

          Show
          david.storch David Storch added a comment - We should also consider including keysExamined and docsExamined in the getMore command log lines (and maybe planSummary ). We may also want to suppress ntoreturn and ntoskip , as we did for the find command log lines .
          Hide
          xgen-internal-githook Githook User added a comment -

          Author:

          {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}

          Message: SERVER-21750 clean up getMore logging and profiling

          --Omit ntoreturn and ntoskip from the getMore command log line.
          --Add nreturned to the getMore command log line.
          --Upconvert OP_GET_MORE profiler entries to match getMore cmd.
          Branch: master
          https://github.com/mongodb/mongo/commit/bb7e1e539da115da4ee1146c79e47c23109dce95

          Show
          xgen-internal-githook Githook User added a comment - Author: {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'} Message: SERVER-21750 clean up getMore logging and profiling --Omit ntoreturn and ntoskip from the getMore command log line. --Add nreturned to the getMore command log line. --Upconvert OP_GET_MORE profiler entries to match getMore cmd. Branch: master https://github.com/mongodb/mongo/commit/bb7e1e539da115da4ee1146c79e47c23109dce95
          Hide
          xgen-internal-githook Githook User added a comment -

          Author:

          {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}

          Message: SERVER-21750 clean up getMore logging and profiling

          --Omit ntoreturn and ntoskip from the getMore command log line.
          --Add nreturned to the getMore command log line.
          --Upconvert OP_GET_MORE profiler entries to match getMore cmd.

          (cherry picked from commit bb7e1e539da115da4ee1146c79e47c23109dce95)
          Branch: v3.2
          https://github.com/mongodb/mongo/commit/6670ca3ffaf09f79eff8e4e9f618cd1a13481398

          Show
          xgen-internal-githook Githook User added a comment - Author: {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'} Message: SERVER-21750 clean up getMore logging and profiling --Omit ntoreturn and ntoskip from the getMore command log line. --Add nreturned to the getMore command log line. --Upconvert OP_GET_MORE profiler entries to match getMore cmd. (cherry picked from commit bb7e1e539da115da4ee1146c79e47c23109dce95) Branch: v3.2 https://github.com/mongodb/mongo/commit/6670ca3ffaf09f79eff8e4e9f618cd1a13481398

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                  Agile