[SERVER-27838] ClientCursorPin doesn't properly track number of open pinned cursors Created: 27/Jan/17  Updated: 05/Apr/17  Resolved: 03/Feb/17

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

Type: Bug Priority: Major - P3
Reporter: Charlie Swanson Assignee: David Storch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Query 2017-02-13
Participants:

 Description   

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)
	}
}



 Comments   
Comment by Githook User [ 03/Feb/17 ]

Author:

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

Message: SERVER-27838 fix serverStatus pinned cursor metric
Branch: master
https://github.com/mongodb/mongo/commit/a3f1f6f45377c44e3e2504fb8ebb26d789e02e61

Generated at Thu Feb 08 04:16:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.