[SERVER-18461] Range predicates comparing against a BinData value should be covered, but are not in 2.6 Created: 13/May/15  Updated: 19/Sep/15  Resolved: 05/Jun/15

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 2.6.8
Fix Version/s: 2.6.11, 3.0.5, 3.1.4

Type: Bug Priority: Major - P3
Reporter: Sharad Aggarwal Assignee: David Storch
Resolution: Done Votes: 0
Labels: ET, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Steps To Reproduce:

Create a collection with following documents

{ "_id" : BinData(0,"AQAAAAEBAAVlbl9VSwAAAAAAAAhv"), "a" : 1 }
{ "_id" : BinData(0,"AQAAAAEBAAVlbl9VSwAAAAAAAAhz"), "a" : 2 }
 
Create an index on {_id:1, a:1}
 
execute the following query
db.<collection>.find({"$and": [{"_id": {"$lte": new BinData(0,"AQAAAAEBAAVlbl9VSwAAAAAAAAhv")}},{"_id": {"$gte": new BinData(0,"AQAAAAEBAAVlbl9VSwAAAAAAAAhv")}}]}, {"_id":1, "a":1}).hint("_id_1_a_1").explain()

Participants:

 Description   

We only allow covering for predicates that can be answered exactly via an index scan. The "tightness" of the bounds is called EXACT in this case. If the bounds are not EXACT, then in order to answer the predicate we must fetch the full document and pass it through the filter.

The 2.6 and 3.0 query engine does not consider range predicates against BinData values EXACT, which means that such queries cannot be covered. However, the 2.4 query engine would allow such predicates to be answered without fetching the document. We should restore the 2.4 behavior.



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

Author:

{u'username': u'coollog', u'name': u'coollog', u'email': u'qingyang.chen@gmail.com'}

Message: SERVER-18461 cover range predicates comparing BinData in building index bounds

Closes #973

Signed-off-by: David Storch <david.storch@10gen.com>
(cherry picked from commit a641576b7d811577e28eefc6322e93e3e4a27511)
Branch: v2.6
https://github.com/mongodb/mongo/commit/5ae1e8d15d5f776a92eecd27896632415ae38efa

Comment by Githook User [ 25/Jun/15 ]

Author:

{u'username': u'coollog', u'name': u'coollog', u'email': u'qingyang.chen@gmail.com'}

Message: SERVER-18461 cover range predicates comparing BinData in building index bounds

Closes #973

Signed-off-by: David Storch <david.storch@10gen.com>
(cherry picked from commit a641576b7d811577e28eefc6322e93e3e4a27511)
Branch: v3.0
https://github.com/mongodb/mongo/commit/4fd4ba8c325a673e321edab73e75355e1d5f8e8a

Comment by Githook User [ 05/Jun/15 ]

Author:

{u'username': u'coollog', u'name': u'coollog', u'email': u'qingyang.chen@gmail.com'}

Message: SERVER-18461 cover range predicates comparing BinData in building index bounds

Closes #973

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

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