[SERVER-13960] Queries containing $or may miss results if multiple clauses use the same index Created: 15/May/14 Updated: 11/Jul/16 Resolved: 30/May/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 2.6.1, 2.7.0 |
| Fix Version/s: | 2.6.2, 2.7.2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | J Rassi | Assignee: | David Storch |
| Resolution: | Done | Votes: | 2 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Backport Completed: | |||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
Issue Status as of June 2, 2014 ISSUE SUMMARY
then the query may miss results from one of the $or clauses. For example:
USER IMPACT WORKAROUNDS
If query rewrite is possible, using the $in operator provides another workaround:
AFFECTED VERSIONS FIX VERSION RESOLUTION DETAILS Original descriptionFor certain types of query predicates that include the $or operator, the query planner can output a plan with a semantically incorrect query execution tree. Results may be omitted if this query plan is selected. Specifically, if an OR expression contains at least one clause that generates "exact" bounds on an index and at least one clause that generates "inexact" bounds on the same index, then the resulting filter constructed for the index scan may only include the "inexact" predicates. In this case, results unique to the "exact" clauses will not be returned. To reproduce:
Original report from mongodb-user: <https://groups.google.com/forum/#!topic/mongodb-user/psQan0UKWDc>. |
| Comments |
| Comment by Githook User [ 01/Jun/14 ] |
|
Author: {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}Message: (cherry picked from commit 3242afb803a5cc523f16c2c63c3ee1dfc10a5671) |
| Comment by Githook User [ 01/Jun/14 ] |
|
Author: {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}Message: Includes a refactor of QueryPlannerAccess::processIndexScans(...) which makes this (cherry picked from commit bee249ac8907cc9de6b19ba87c3fcb074d84b1a3) |
| Comment by Githook User [ 30/May/14 ] |
|
Author: {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}Message: |
| Comment by Githook User [ 30/May/14 ] |
|
Author: {u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}Message: Includes a refactor of QueryPlannerAccess::processIndexScans(...) which makes this |