summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/query_planner_test.cpp
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2018-07-17 14:27:02 -0400
committerDavid Storch <david.storch@10gen.com>2018-08-02 09:44:28 -0400
commit51589a332a0e557b6080f38dc605e2e2fa3740b6 (patch)
treef63fa4908cbc8e6309de0abdcdd025abeab2bb79 /src/mongo/db/query/query_planner_test.cpp
parent84cb23553ecca69fb2ec84dbd4aa13bb18f26b47 (diff)
downloadmongo-51589a332a0e557b6080f38dc605e2e2fa3740b6.tar.gz
SERVER-20299 Delete KEEP_MUTATIONS stage.
Removes the associated flagForReview() mechanism from WorkingSet.
Diffstat (limited to 'src/mongo/db/query/query_planner_test.cpp')
-rw-r--r--src/mongo/db/query/query_planner_test.cpp135
1 files changed, 0 insertions, 135 deletions
diff --git a/src/mongo/db/query/query_planner_test.cpp b/src/mongo/db/query/query_planner_test.cpp
index bcf7d2d2368..a754d00f155 100644
--- a/src/mongo/db/query/query_planner_test.cpp
+++ b/src/mongo/db/query/query_planner_test.cpp
@@ -3674,141 +3674,6 @@ TEST_F(QueryPlannerTest, IntersectCompoundInsteadUnusedField2) {
"{ixscan: {filter: null, pattern: {a:1,b:1,c:1}}}}}");
}
-//
-// Test that we add a KeepMutations when we should and and we don't add one when we shouldn't.
-//
-
-// Collection scan doesn't keep any state, so it can't produce flagged data.
-TEST_F(QueryPlannerTest, NoMutationsForCollscan) {
- params.options = QueryPlannerParams::KEEP_MUTATIONS;
- runQuery(fromjson(""));
- assertSolutionExists("{cscan: {dir: 1}}");
-}
-
-// Collscan + sort doesn't produce flagged data either.
-TEST_F(QueryPlannerTest, NoMutationsForSort) {
- params.options = QueryPlannerParams::KEEP_MUTATIONS;
- runQuerySortProj(fromjson(""), fromjson("{a:1}"), BSONObj());
- assertSolutionExists(
- "{sort: {pattern: {a: 1}, limit: 0, node: {sortKeyGen: {node: "
- "{cscan: {dir: 1}}}}}}");
-}
-
-// A basic index scan, fetch, and sort plan cannot produce flagged data.
-TEST_F(QueryPlannerTest, MutationsFromFetchWithSort) {
- params.options = QueryPlannerParams::KEEP_MUTATIONS;
- addIndex(BSON("a" << 1));
- runQuerySortProj(fromjson("{a: 5}"), fromjson("{b:1}"), BSONObj());
- assertSolutionExists(
- "{sort: {pattern: {b:1}, limit: 0, node: {sortKeyGen: {node: "
- "{fetch: {node: {ixscan: {pattern: {a:1}}}}}}}}}");
-}
-
-// Index scan w/covering doesn't require a keep node.
-TEST_F(QueryPlannerTest, NoFetchNoKeep) {
- params.options = QueryPlannerParams::KEEP_MUTATIONS;
- addIndex(BSON("x" << 1));
- // query, sort, proj
- runQuerySortProj(fromjson("{ x : {$gt: 1}}"), BSONObj(), fromjson("{_id: 0, x: 1}"));
-
- // cscan is a soln but we override the params that say to include it.
- ASSERT_EQUALS(getNumSolutions(), 1U);
- assertSolutionExists(
- "{proj: {spec: {_id: 0, x: 1}, node: {ixscan: "
- "{filter: null, pattern: {x: 1}}}}}");
-}
-
-// No keep with geoNear.
-TEST_F(QueryPlannerTest, NoKeepWithGeoNear) {
- params.options = QueryPlannerParams::KEEP_MUTATIONS;
- addIndex(BSON("a"
- << "2d"));
- runQuery(fromjson("{a: {$near: [0,0], $maxDistance:0.3 }}"));
- ASSERT_EQUALS(getNumSolutions(), 1U);
- assertSolutionExists("{geoNear2d: {a: '2d'}}");
-}
-
-// No keep when we have an indexed sort.
-TEST_F(QueryPlannerTest, NoKeepWithIndexedSort) {
- params.options = QueryPlannerParams::KEEP_MUTATIONS;
- addIndex(BSON("a" << 1 << "b" << 1));
- runQuerySortProjSkipNToReturn(fromjson("{a: {$in: [1, 2]}}"), BSON("b" << 1), BSONObj(), 0, 1);
-
- // cscan solution exists but we didn't turn on the "always include a collscan."
- assertNumSolutions(1);
- assertSolutionExists(
- "{fetch: {node: {mergeSort: {nodes: "
- "[{ixscan: {pattern: {a: 1, b: 1}}}, {ixscan: {pattern: {a: 1, b: 1}}}]}}}}");
-}
-
-// No KeepMutations when we have a sort that is not root, like the ntoreturn hack.
-TEST_F(QueryPlannerTest, NoKeepWithNToReturn) {
- params.options = QueryPlannerParams::KEEP_MUTATIONS;
- params.options |= QueryPlannerParams::SPLIT_LIMITED_SORT;
- addIndex(BSON("a" << 1));
- runQuerySortProjSkipNToReturn(fromjson("{a: 1}"), fromjson("{b: 1}"), BSONObj(), 0, 3);
-
- assertSolutionExists(
- "{ensureSorted: {pattern: {b: 1}, node: "
- "{or: {nodes: ["
- "{sort: {pattern: {b: 1}, limit: 3, node: {sortKeyGen: {node: "
- "{fetch: {node: {ixscan: {pattern: {a: 1}}}}}}}}}, "
- "{sort: {pattern: {b: 1}, limit: 0, node: {sortKeyGen: {node: "
- "{fetch: {node: {ixscan: {pattern: {a: 1}}}}}}}}}]}}}}");
-}
-
-// Mergesort plans do not require a keep mutations stage.
-TEST_F(QueryPlannerTest, NoKeepWithMergeSort) {
- params.options = QueryPlannerParams::KEEP_MUTATIONS;
-
- addIndex(BSON("a" << 1 << "b" << 1));
- runQuerySortProj(fromjson("{a: {$in: [1, 2]}}"), BSON("b" << 1), BSONObj());
-
- assertNumSolutions(1U);
- assertSolutionExists(
- "{fetch: {filter: null, node: {mergeSort: {nodes: ["
- "{ixscan: {pattern: {a: 1, b: 1},"
- "bounds: {a: [[1,1,true,true]], b: [['MinKey','MaxKey',true,true]]}}},"
- "{ixscan: {pattern: {a: 1, b: 1},"
- "bounds: {a: [[2,2,true,true]], b: [['MinKey','MaxKey',true,true]]}}}]}}}}");
-}
-
-// Hash-based index intersection plans require a keep mutations stage.
-TEST_F(QueryPlannerTest, AndHashRequiresKeepMutations) {
- params.options = QueryPlannerParams::KEEP_MUTATIONS;
- params.options |= QueryPlannerParams::INDEX_INTERSECTION;
-
- addIndex(BSON("a" << 1));
- addIndex(BSON("b" << 1));
- runQuery(fromjson("{a: {$gte: 0}, b: {$gte: 0}}"));
-
- assertNumSolutions(3U);
- assertSolutionExists("{fetch: {filter: {a: {$gte: 0}}, node: {ixscan: {pattern: {b: 1}}}}}");
- assertSolutionExists("{fetch: {filter: {b: {$gte: 0}}, node: {ixscan: {pattern: {a: 1}}}}}");
- assertSolutionExists(
- "{fetch: {filter: null, node: {keep: {node: {andHash: {nodes: ["
- "{ixscan: {pattern: {a: 1}}},"
- "{ixscan: {pattern: {b: 1}}}]}}}}}}");
-}
-
-// Sort-based index intersection plans require a keep mutations stage.
-TEST_F(QueryPlannerTest, AndSortedRequiresKeepMutations) {
- params.options = QueryPlannerParams::KEEP_MUTATIONS;
- params.options |= QueryPlannerParams::INDEX_INTERSECTION;
-
- addIndex(BSON("a" << 1));
- addIndex(BSON("b" << 1));
- runQuery(fromjson("{a: 2, b: 3}"));
-
- assertNumSolutions(3U);
- assertSolutionExists("{fetch: {filter: {a: 2}, node: {ixscan: {pattern: {b: 1}}}}}");
- assertSolutionExists("{fetch: {filter: {b: 3}, node: {ixscan: {pattern: {a: 1}}}}}");
- assertSolutionExists(
- "{fetch: {filter: null, node: {keep: {node: {andSorted: {nodes: ["
- "{ixscan: {pattern: {a: 1}}},"
- "{ixscan: {pattern: {b: 1}}}]}}}}}}");
-}
-
// Make sure a top-level $or hits the limiting number
// of solutions that we are willing to consider.
TEST_F(QueryPlannerTest, OrEnumerationLimit) {