mongodb/mongo — pull request #547 by dstorch (2013-11-19 15:16:15+00:00)
Title: SERVER-10471 fix OR with inexact bounds

Adds a fix in QueryPlanner::processIndexScans. The existing behavior can cause the query planner to generate no indexed solution for some OR queries. A specific case is $or with a geo query on a '2dsphere' index. In general, this is an issue for $or queries with inexact index bounds.

The filters for OR branches with inexact index bounds are currently left hanging, violating a precondition of QueryPlanner::buildIndexedOr. This patch adds logic to ensure that the proper FETCH -> IXSCAN is returned after properly clipping off the children of the $or. Doing so ensures that filters are applied only to the appropriate OR branch, as opposed to handling like an AND where filters can be brought above the AND node in the solution tree.

Code review here: http://codereview.10gen.com/5482846265278464/

This patch was tested on MCI here: http://mci.10gen.com/ui/version/528a94833ff1227f75000023_0