[SERVER-13008] Encoding of projection for query plan cache should be type-insensitive Created: 03/Mar/14  Updated: 26/Oct/16  Resolved: 10/Jun/15

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 2.6.0-rc0
Fix Version/s: 3.1.5

Type: Bug Priority: Major - P3
Reporter: J Rassi Assignee: Qingyang Chen
Resolution: Done Votes: 0
Labels: 26qa, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File filterfailure.js    
Issue Links:
Depends
depends on SERVER-16577 2.8 doesn't have a field to report if... Closed
Duplicate
is duplicated by SERVER-16330 plan cache filters aren't applied if ... Closed
is duplicated by SERVER-26796 planCacheSetFilter doesn't work for q... Closed
Related
related to SERVER-12843 Encoding of projection for query plan... Closed
related to DOCS-4428 Queries executed via MongoS will alwa... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Quint Iteration 5
Participants:

 Description   

Queries with projection {a:1.0} should not be considered of a different shape than queries with projection {a:NumberInt(1)}. This can be particularly confusing to users of the plan cache shell helpers, who will see shapes seemingly listed twice when in fact they differ in the BSON type of the projection (as the shell renders them identically).

> db.foo.getPlanCache().clear()
> db.foo.find({a:1,b:1},{a:1})
> db.foo.getPlanCache().listQueryShapes()
[
	{
		"query" : {
			"a" : 1,
			"b" : 1
		},
		"sort" : {
 
		},
		"projection" : {
			"a" : 1
		}
	}
]
> db.foo.find({a:1,b:1},{a:NumberInt(1)})
> db.foo.getPlanCache().listQueryShapes()
[
	{ // first query
		"query" : {
			"a" : 1,
			"b" : 1
		},
		"sort" : {
 
		},
		"projection" : {
			"a" : 1
		}
	},
	{ // second query, but looks the same
		"query" : {
			"a" : 1,
			"b" : 1
		},
		"sort" : {
 
		},
		"projection" : {
			"a" : 1
		}
	}
]
>



 Comments   
Comment by Githook User [ 10/Jun/15 ]

Author:

{u'username': u'coollog', u'name': u'Qingyang Chen', u'email': u'qingyang.chen@10gen.com'}

Message: SERVER-13008 make cache key projection encoding less type-sensitive.

Closes #981

Signed-off-by: David Storch <david.storch@10gen.com>
Branch: master
https://github.com/mongodb/mongo/commit/2400048495d870ead8ef09f2a1393f67c4b66a5e

Comment by Charlie Page [ 19/Dec/14 ]

Note that filterfailure.js only works on 2.6. When 2.8 supports observing the field the test can be updated.

The test will fail when the problem is fixed (for numerics anyway).

Comment by Matt Kangas [ 19/Dec/14 ]

SERVER-16577 is required to observe this failure in 2.7+. See the jstest attached to SERVER-16330 (dup of this ticket)

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