summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2014-07-11 16:54:17 -0400
committerDavid Storch <david.storch@10gen.com>2014-07-11 17:19:01 -0400
commitf6a6dec8f14ef75980d1512bb6d5e30fab6b73db (patch)
tree6caed27b76b3d752206a00bcb7a60fdbf2a621bb
parentde724781deb23468c909acc73d98961b9c8e53c5 (diff)
downloadmongo-f6a6dec8f14ef75980d1512bb6d5e30fab6b73db.tar.gz
SERVER-14311 fix plan ranking dbtest
-rw-r--r--src/mongo/dbtests/plan_ranking.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/mongo/dbtests/plan_ranking.cpp b/src/mongo/dbtests/plan_ranking.cpp
index 29a01c306c8..6bedd12b617 100644
--- a/src/mongo/dbtests/plan_ranking.cpp
+++ b/src/mongo/dbtests/plan_ranking.cpp
@@ -731,25 +731,26 @@ namespace PlanRankingTests {
class PlanRankingAccountForKeySkips : public PlanRankingTestBase {
public:
void run() {
- for (int i = 0; i < 4; ++i) {
- insert(BSON("a" << 1 << "b" << 1));
+ for (int i = 0; i < 100; ++i) {
+ insert(BSON("a" << i << "b" << i << "c" << i));
}
- // Second index has intervening fields which leads to more
- // skipping of keys. We should pick a plan that uses the first.
- addIndex(BSON("a" << 1 << "b" << 1));
- addIndex(BSON("a" << 1 << "x" << 1 << "y" << 1 << "z" << 1 << "b" << 1));
+ // These indices look equivalent to the ranker for the query below unless we account
+ // for key skipping. We should pick index {a: 1} if we account for key skipping
+ // properly.
+ addIndex(BSON("b" << 1 << "c" << 1));
+ addIndex(BSON("a" << 1));
CanonicalQuery* cq;
ASSERT(CanonicalQuery::canonicalize(ns,
- fromjson("{a: 1, b: 1}"),
+ fromjson("{a: 9, b: {$ne: 10}, c: 9}"),
&cq).isOK());
ASSERT(NULL != cq);
// Expect to use index {a: 1, b: 1}.
QuerySolution* soln = pickBestPlan(cq);
ASSERT(QueryPlannerTestLib::solutionMatches(
- "{fetch: {node: {ixscan: {pattern: {a: 1, b: 1}}}}}",
+ "{fetch: {node: {ixscan: {pattern: {a: 1}}}}}",
soln->root.get()));
}
};