[SERVER-9284] Global index counters not updated in all code paths Created: 08/Apr/13  Updated: 20/Mar/15  Resolved: 20/Mar/15

Status: Closed
Project: Core Server
Component/s: Diagnostics, Index Maintenance
Affects Version/s: 2.2.4, 2.4.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Tad Marshall Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

Some index accesses update the global index counters; some don't.

MongoDB shell version: 2.2.4
connecting to: test
> db.version()
2.2.4
> db.hostInfo().os
{ "type" : "Linux", "name" : "Ubuntu", "version" : "12.04" }
> show dbs
local	(empty)
> db.test.insert({a:1})
> db.test.ensureIndex({a:1})
> db.serverStatus().indexCounters.btree
{
	"accesses" : 1,
	"hits" : 1,
	"misses" : 0,
	"resets" : 0,
	"missRatio" : 0
}
> db.test.find()
{ "_id" : ObjectId("51632bd680036fc7eb0cbdea"), "a" : 1 }
> db.test.find({_id: ObjectId("51632bd680036fc7eb0cbdea")})
{ "_id" : ObjectId("51632bd680036fc7eb0cbdea"), "a" : 1 }
> db.serverStatus().indexCounters.btree
{
	"accesses" : 2,
	"hits" : 2,
	"misses" : 0,
	"resets" : 0,
	"missRatio" : 0
}
> db.test.find({a:1})
{ "_id" : ObjectId("51632bd680036fc7eb0cbdea"), "a" : 1 }
> db.test.find({a:1}).explain()
{
	"cursor" : "BtreeCursor a_1",
	"isMultiKey" : false,
	"n" : 1,
	"nscannedObjects" : 1,
	"nscanned" : 1,
	"nscannedObjectsAllPlans" : 1,
	"nscannedAllPlans" : 1,
	"scanAndOrder" : false,
	"indexOnly" : false,
	"nYields" : 0,
	"nChunkSkips" : 0,
	"millis" : 0,
	"indexBounds" : {
		"a" : [
			[
				1,
				1
			]
		]
	},
	"server" : "tad-ubuntu:27017"
}
> db.serverStatus().indexCounters.btree
{
	"accesses" : 2,
	"hits" : 2,
	"misses" : 0,
	"resets" : 0,
	"missRatio" : 0
}

MongoDB shell version: 2.4.1
connecting to: test
> db.version()
2.4.1
> db.hostInfo().os
{ "type" : "Linux", "name" : "Ubuntu", "version" : "12.04" }
> show dbs
local	0.078125GB
> db.test.insert({a:1})
> db.test.ensureIndex({a:1})
> db.serverStatus().indexCounters
{
	"accesses" : 1,
	"hits" : 1,
	"misses" : 0,
	"resets" : 0,
	"missRatio" : 0
}
> db.test.find()
{ "_id" : ObjectId("51632d682b2597dfbeae7f92"), "a" : 1 }
> db.test.find({_id: ObjectId("51632d682b2597dfbeae7f92")})
{ "_id" : ObjectId("51632d682b2597dfbeae7f92"), "a" : 1 }
> db.serverStatus().indexCounters
{
	"accesses" : 2,
	"hits" : 2,
	"misses" : 0,
	"resets" : 0,
	"missRatio" : 0
}
> db.test.find({a:1})
{ "_id" : ObjectId("51632d682b2597dfbeae7f92"), "a" : 1 }
> db.test.find({a:1}).explain()
{
	"cursor" : "BtreeCursor a_1",
	"isMultiKey" : false,
	"n" : 1,
	"nscannedObjects" : 1,
	"nscanned" : 1,
	"nscannedObjectsAllPlans" : 1,
	"nscannedAllPlans" : 1,
	"scanAndOrder" : false,
	"indexOnly" : false,
	"nYields" : 0,
	"nChunkSkips" : 0,
	"millis" : 0,
	"indexBounds" : {
		"a" : [
			[
				1,
				1
			]
		]
	},
	"server" : "tad-ubuntu:27017"
}
> db.serverStatus().indexCounters
{
	"accesses" : 2,
	"hits" : 2,
	"misses" : 0,
	"resets" : 0,
	"missRatio" : 0
}

Indexed access using _id adds to the index counters. Indexed access using the "a" key in this example does not add to the index counters.



 Comments   
Comment by Ramon Fernandez Marina [ 20/Mar/15 ]

indexCounters was removed from the serverStatus() output in 3.0; see this comment for more details.

Generated at Thu Feb 08 03:19:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.