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

One constructor for Client::Context does not properly set the curop

    • Fully Compatible
    • ALL
    • Hide
      1. Start a replica set.
      2. Insert a document to the primary.
      3. Run db.adminCommand( {top:1}

        ) on the primary and a secondary.

      Show
      Start a replica set. Insert a document to the primary. Run db.adminCommand( {top:1} ) on the primary and a secondary.
    • Sharding A (10/09/15)

      The two-argument constructor for Client::Context does not call enter() on the curop object, so the current op is never properly updated. This causes some weird behavior, such as the entries with empty field names in the output of the "top" command. I suspect (though have not confirmed) that this also has an impact on the profiler and the output of the inprog command (db.currentOp()).

      This problem was exacerbated in 2.6 by the introduction of more callers of this 2-argument form of the Client::Context constructor.

      PREVIOUS DESCRIPTION:

      In 2.4, if a node is/was a secondary, there is a sub-document with empty field name in the output of top command as below. It has records for "writeLock" and "total".

      > db.adminCommand({top:1})
      {
      	"totals" : {
      		"note" : "all times in microseconds",
      		"" : {
      			"total" : {
      				"time" : 27583,
      				"count" : 1001
      			},
      			"readLock" : {
      				"time" : 0,
      				"count" : 0
      			},
      			"writeLock" : {
      				"time" : 27583,
      				"count" : 1001
      			},
      			"queries" : {
      				"time" : 0,
      				"count" : 0
      			},
      			"getmore" : {
      				"time" : 0,
      				"count" : 0
      			},
      			"insert" : {
      				"time" : 0,
      				"count" : 0
      			},
      			"update" : {
      				"time" : 0,
      				"count" : 0
      			},
      			"remove" : {
      				"time" : 0,
      				"count" : 0
      			},
      			"commands" : {
      				"time" : 0,
      				"count" : 0
      			}
      		},
      ......
      }
      

      In 2.6, it shows up on all the nodes in the replica set, with records for "readLock", "writeLock" (only for secondaries) and "total".

      > db.adminCommand({top:1})
      {
      	"totals" : {
      		"note" : "all times in microseconds",
      		"" : {
      			"total" : {
      				"time" : 1353,
      				"count" : 752
      			},
      			"readLock" : {
      				"time" : 1277,
      				"count" : 751
      			},
      			"writeLock" : {
      				"time" : 76,
      				"count" : 1
      			},
      ...
      }
      

            Assignee:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Reporter:
            linda.qin@mongodb.com Linda Qin
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: