ClientCursorPin doesn't properly track number of open pinned cursors

XMLWordPrintableJSON

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

      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
              Reporter:
              Charlie Swanson
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: