summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2015-05-07 11:04:01 -0400
committerDavid Storch <david.storch@10gen.com>2015-05-07 16:37:07 -0400
commit58143382b7f73c66199774e72523f4b0c53b362d (patch)
tree88ee66b5c8a0579346d4846d1efc2869970ec4c7 /src
parent7c51c3a17457f46aa55c4c419c15add471d4e232 (diff)
downloadmongo-58143382b7f73c66199774e72523f4b0c53b362d.tar.gz
SERVER-18364 ensure multikey bounds construction prefers non-negation predicates over negations
Also backports a fix to the query planner unit test library in order to ensure that the unit tests work correctly with this change. (cherry picked from commit 97b5712600ada8439f024f6bf446172f0fc9a7aa)
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/matcher/expression.h7
-rw-r--r--src/mongo/db/query/query_planner_test_lib.cpp8
2 files changed, 10 insertions, 5 deletions
diff --git a/src/mongo/db/matcher/expression.h b/src/mongo/db/matcher/expression.h
index 083a2583208..73f3e48692d 100644
--- a/src/mongo/db/matcher/expression.h
+++ b/src/mongo/db/matcher/expression.h
@@ -47,13 +47,16 @@ namespace mongo {
public:
enum MatchType {
// tree types
- AND, OR, NOR, NOT,
+ AND, OR,
// array types
ELEM_MATCH_OBJECT, ELEM_MATCH_VALUE, SIZE,
// leaf types
- LTE, LT, EQ, GT, GTE, REGEX, MOD, EXISTS, MATCH_IN, NIN,
+ EQ, LTE, LT, GT, GTE, REGEX, MOD, EXISTS, MATCH_IN,
+
+ // Negations.
+ NOT, NIN, NOR,
// special types
TYPE_OPERATOR, GEO, WHERE,
diff --git a/src/mongo/db/query/query_planner_test_lib.cpp b/src/mongo/db/query/query_planner_test_lib.cpp
index 2fe75527574..74b087a1406 100644
--- a/src/mongo/db/query/query_planner_test_lib.cpp
+++ b/src/mongo/db/query/query_planner_test_lib.cpp
@@ -53,9 +53,11 @@ namespace {
if (!swme.isOK()) {
return false;
}
- MatchExpression* root = swme.getValue();
- CanonicalQuery::sortTree(root);
- return trueFilterNode->filter->equivalent(root);
+ const boost::scoped_ptr<MatchExpression> root(swme.getValue());
+ CanonicalQuery::sortTree(root.get());
+ const boost::scoped_ptr<MatchExpression> trueFilter(trueFilterNode->filter->shallowClone());
+ CanonicalQuery::sortTree(trueFilter.get());
+ return trueFilter->equivalent(root.get());
}
void appendIntervalBound(BSONObjBuilder& bob, BSONElement& el) {