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

ClientCursorPin doesn't properly track number of open pinned cursors

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.3
    • Affects Version/s: 3.5.1
    • Component/s: Querying
    • None
    • Fully Compatible
    • ALL
    • Query 2017-02-13

      The changes introduced in SERVER-27065 made it possible to move-construct or move-assign into a ClientCursorPin, which left an old ClientCursorPin object around which no longer corresponds to an actual pinned cursor, since ownership was transferred during the move. Nonetheless, when the old ClientCursorPin goes out of scope, it will decrement the number of pinned cursors, one more time than necessary. This happens during a getMore, so can be shown using serverStatus:

      > db.foo.find()
      { "_id" : ObjectId("58813b945c612bc58ce4c0e3"), "x" : 1 }
      { "_id" : ObjectId("588b6e69bf0c887f6da894b4"), "x" : 1 }
      > db.serverStatus().metrics.cursor
      {
      	"timedOut" : NumberLong(0),
      	"open" : {
      		"noTimeout" : NumberLong(0),
      		"pinned" : NumberLong(0),
      		"total" : NumberLong(0)
      	}
      }
      > db.foo.find().batchSize(1)
      { "_id" : ObjectId("58813b945c612bc58ce4c0e3"), "x" : 1 }
      { "_id" : ObjectId("588b6e69bf0c887f6da894b4"), "x" : 1 }
      > db.serverStatus().metrics.cursor
      {
      	"timedOut" : NumberLong(0),
      	"open" : {
      		"noTimeout" : NumberLong(0),
      		"pinned" : NumberLong(-2),
      		"total" : NumberLong(0)
      	}
      }
      

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: