[SERVER-17158] sort component of internal plan cache key syntax is ambiguous Created: 03/Feb/15  Updated: 19/Sep/15  Resolved: 19/Mar/15

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 3.0.0-rc7
Fix Version/s: 3.1.1

Type: Bug Priority: Major - P3
Reporter: Thomas Rueckstiess Assignee: James Wahlin
Resolution: Done Votes: 0
Labels: neweng, pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-13007 Query plan cache key not unique to qu... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Quint Iteration 3.1.1
Participants:

 Description   

The internal representation for the sort order of a plan cache key as defined in canonical_query.cpp:269-276 is ambiguous because it does not use any separators for multiple keys.

These two queries produce the same cache key and could therefore incorrectly use a wrong cached plan:

db.coll.find( {a: {$gt: 1}, b:1} ).sort( {a:1, b:1} )
db.coll.find( {a: {$gt: 1}, b:1} ).sort( {aab:1} )

Both produce the internal key: an[eqb,gta]~aaab.

This could be avoided with a separator between multiple sort keys, e.g.

an[eqb,gta]~aaab
an[eqb,gta]~aa,ab



 Comments   
Comment by Githook User [ 19/Mar/15 ]

Author:

{u'name': u'james.wahlin@10gen.com', u'email': u'james.wahlin@10gen.com'}

Message: SERVER-17158 add delimiter to planCacheKey for sort args

Closes #938

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

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