summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2018-10-30 12:30:20 -0400
committerDavid Storch <david.storch@10gen.com>2018-11-07 15:05:49 -0500
commitf0b39d9184094661fcaa1049531b80b5ad6b3995 (patch)
tree6fcab5eb450ca32fc7683de08bac184cf9dda15d /src/mongo/dbtests
parent56248d50536a25d63526662683b221df8137ab36 (diff)
downloadmongo-f0b39d9184094661fcaa1049531b80b5ad6b3995.tar.gz
SERVER-37446 Change PlanStages which don't require a collection to avoid keeping a Collection*.
In order to prevent COUNT stage from requiring a Collection*, splits fast count into a new RECORD_STORE_FAST_COUNT stage.
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/query_stage_and.cpp42
-rw-r--r--src/mongo/dbtests/query_stage_count.cpp4
-rw-r--r--src/mongo/dbtests/query_stage_merge_sort.cpp20
-rw-r--r--src/mongo/dbtests/query_stage_sort.cpp4
4 files changed, 32 insertions, 38 deletions
diff --git a/src/mongo/dbtests/query_stage_and.cpp b/src/mongo/dbtests/query_stage_and.cpp
index 73712aa7525..9ddb35f4a88 100644
--- a/src/mongo/dbtests/query_stage_and.cpp
+++ b/src/mongo/dbtests/query_stage_and.cpp
@@ -198,7 +198,7 @@ public:
addIndex(BSON("bar" << 1));
WorkingSet ws;
- auto ah = make_unique<AndHashStage>(&_opCtx, &ws, coll);
+ auto ah = make_unique<AndHashStage>(&_opCtx, &ws);
// Foo <= 20.
auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll));
@@ -285,7 +285,7 @@ public:
addIndex(BSON("baz" << 1));
WorkingSet ws;
- auto ah = make_unique<AndHashStage>(&_opCtx, &ws, coll);
+ auto ah = make_unique<AndHashStage>(&_opCtx, &ws);
// Foo <= 20 (descending).
auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll));
@@ -365,7 +365,7 @@ public:
addIndex(BSON("bar" << 1));
WorkingSet ws;
- auto ah = make_unique<AndHashStage>(&_opCtx, &ws, coll);
+ auto ah = make_unique<AndHashStage>(&_opCtx, &ws);
// Foo <= 20
auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll));
@@ -414,7 +414,7 @@ public:
// before hashed AND is done reading the first child (stage has to
// hold 21 keys in buffer for Foo <= 20).
WorkingSet ws;
- auto ah = make_unique<AndHashStage>(&_opCtx, &ws, coll, 20 * big.size());
+ auto ah = make_unique<AndHashStage>(&_opCtx, &ws, 20 * big.size());
// Foo <= 20
auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1 << "big" << 1), coll));
@@ -461,7 +461,7 @@ public:
// keys in last child's index are not buffered. There are 6 keys
// that satisfy the criteria Foo <= 20 and Bar >= 10 and 5 <= baz <= 15.
WorkingSet ws;
- auto ah = make_unique<AndHashStage>(&_opCtx, &ws, coll, 5 * big.size());
+ auto ah = make_unique<AndHashStage>(&_opCtx, &ws, 5 * big.size());
// Foo <= 20
auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll));
@@ -503,7 +503,7 @@ public:
addIndex(BSON("baz" << 1));
WorkingSet ws;
- auto ah = make_unique<AndHashStage>(&_opCtx, &ws, coll);
+ auto ah = make_unique<AndHashStage>(&_opCtx, &ws);
// Foo <= 20
auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll));
@@ -561,7 +561,7 @@ public:
// before hashed AND is done reading the second child (stage has to
// hold 11 keys in buffer for Foo <= 20 and Bar >= 10).
WorkingSet ws;
- auto ah = make_unique<AndHashStage>(&_opCtx, &ws, coll, 10 * big.size());
+ auto ah = make_unique<AndHashStage>(&_opCtx, &ws, 10 * big.size());
// Foo <= 20
auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll));
@@ -606,7 +606,7 @@ public:
addIndex(BSON("bar" << 1));
WorkingSet ws;
- auto ah = make_unique<AndHashStage>(&_opCtx, &ws, coll);
+ auto ah = make_unique<AndHashStage>(&_opCtx, &ws);
// Foo <= 20
auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll));
@@ -663,7 +663,7 @@ public:
addIndex(BSON("bar" << 1));
WorkingSet ws;
- auto ah = make_unique<AndHashStage>(&_opCtx, &ws, coll);
+ auto ah = make_unique<AndHashStage>(&_opCtx, &ws);
// Foo >= 100
auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll));
@@ -710,7 +710,7 @@ public:
addIndex(BSON("bar" << 1));
WorkingSet ws;
- auto ah = make_unique<AndHashStage>(&_opCtx, &ws, coll);
+ auto ah = make_unique<AndHashStage>(&_opCtx, &ws);
// Foo <= 20
auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll));
@@ -762,7 +762,7 @@ public:
addIndex(BSON("bar" << 1));
WorkingSet ws;
- auto ah = make_unique<AndHashStage>(&_opCtx, &ws, coll);
+ auto ah = make_unique<AndHashStage>(&_opCtx, &ws);
// Foo <= 20
auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll));
@@ -810,7 +810,7 @@ public:
// Child2: NEED_TIME, DEAD
{
WorkingSet ws;
- const auto andHashStage = make_unique<AndHashStage>(&_opCtx, &ws, coll);
+ const auto andHashStage = make_unique<AndHashStage>(&_opCtx, &ws);
auto childStage1 = make_unique<QueuedDataStage>(&_opCtx, &ws);
{
@@ -843,7 +843,7 @@ public:
// Child2: Data
{
WorkingSet ws;
- const auto andHashStage = make_unique<AndHashStage>(&_opCtx, &ws, coll);
+ const auto andHashStage = make_unique<AndHashStage>(&_opCtx, &ws);
auto childStage1 = make_unique<QueuedDataStage>(&_opCtx, &ws);
@@ -884,7 +884,7 @@ public:
// Child2: Data, DEAD
{
WorkingSet ws;
- const auto andHashStage = make_unique<AndHashStage>(&_opCtx, &ws, coll);
+ const auto andHashStage = make_unique<AndHashStage>(&_opCtx, &ws);
auto childStage1 = make_unique<QueuedDataStage>(&_opCtx, &ws);
{
@@ -948,7 +948,7 @@ public:
addIndex(BSON("bar" << 1));
WorkingSet ws;
- auto ah = make_unique<AndSortedStage>(&_opCtx, &ws, coll);
+ auto ah = make_unique<AndSortedStage>(&_opCtx, &ws);
// Scan over foo == 1.
auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll));
@@ -1065,7 +1065,7 @@ public:
addIndex(BSON("baz" << 1));
WorkingSet ws;
- auto ah = make_unique<AndSortedStage>(&_opCtx, &ws, coll);
+ auto ah = make_unique<AndSortedStage>(&_opCtx, &ws);
// Scan over foo == 1
auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll));
@@ -1110,7 +1110,7 @@ public:
addIndex(BSON("bar" << 1));
WorkingSet ws;
- auto ah = make_unique<AndSortedStage>(&_opCtx, &ws, coll);
+ auto ah = make_unique<AndSortedStage>(&_opCtx, &ws);
// Foo == 7. Should be EOF.
auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll));
@@ -1153,7 +1153,7 @@ public:
addIndex(BSON("bar" << 1));
WorkingSet ws;
- auto ah = make_unique<AndSortedStage>(&_opCtx, &ws, coll);
+ auto ah = make_unique<AndSortedStage>(&_opCtx, &ws);
// foo == 7.
auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll));
@@ -1192,7 +1192,7 @@ public:
addIndex(BSON("bar" << 1));
WorkingSet ws;
- auto ah = make_unique<AndHashStage>(&_opCtx, &ws, coll);
+ auto ah = make_unique<AndHashStage>(&_opCtx, &ws);
// Scan over foo == 1
auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll));
@@ -1254,7 +1254,7 @@ public:
addIndex(BSON("bar" << 1));
WorkingSet ws;
- unique_ptr<AndSortedStage> as = make_unique<AndSortedStage>(&_opCtx, &ws, coll);
+ unique_ptr<AndSortedStage> as = make_unique<AndSortedStage>(&_opCtx, &ws);
// Scan over foo == 1
auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll));
@@ -1306,7 +1306,7 @@ public:
addIndex(BSON("bar" << 1));
WorkingSet ws;
- unique_ptr<AndSortedStage> as = make_unique<AndSortedStage>(&_opCtx, &ws, coll);
+ unique_ptr<AndSortedStage> as = make_unique<AndSortedStage>(&_opCtx, &ws);
// Scan over foo == 1
auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll));
diff --git a/src/mongo/dbtests/query_stage_count.cpp b/src/mongo/dbtests/query_stage_count.cpp
index 82d7cef339e..f20a4fc0142 100644
--- a/src/mongo/dbtests/query_stage_count.cpp
+++ b/src/mongo/dbtests/query_stage_count.cpp
@@ -161,13 +161,11 @@ public:
scan = createCollScan(expression.get(), ws.get());
}
- const bool useRecordStoreCount = false;
- CountStageParams params(request, useRecordStoreCount);
+ CountStageParams params(request);
CountStage countStage(&_opCtx, _coll, std::move(params), ws.get(), scan);
const CountStats* stats = runCount(countStage);
- ASSERT_FALSE(stats->recordStoreCount);
ASSERT_EQUALS(stats->nCounted, expected_n);
ASSERT_EQUALS(stats->nSkipped, request.getSkip());
}
diff --git a/src/mongo/dbtests/query_stage_merge_sort.cpp b/src/mongo/dbtests/query_stage_merge_sort.cpp
index 95ea033516b..49ba59c0ac4 100644
--- a/src/mongo/dbtests/query_stage_merge_sort.cpp
+++ b/src/mongo/dbtests/query_stage_merge_sort.cpp
@@ -165,7 +165,7 @@ public:
// Sort by c:1
MergeSortStageParams msparams;
msparams.pattern = BSON("c" << 1);
- MergeSortStage* ms = new MergeSortStage(&_opCtx, msparams, ws.get(), coll);
+ MergeSortStage* ms = new MergeSortStage(&_opCtx, msparams, ws.get());
// a:1
auto params = makeIndexScanParams(&_opCtx, getIndex(firstIndex, coll));
@@ -230,7 +230,7 @@ public:
// Sort by c:1
MergeSortStageParams msparams;
msparams.pattern = BSON("c" << 1);
- MergeSortStage* ms = new MergeSortStage(&_opCtx, msparams, ws.get(), coll);
+ MergeSortStage* ms = new MergeSortStage(&_opCtx, msparams, ws.get());
// a:1
auto params = makeIndexScanParams(&_opCtx, getIndex(firstIndex, coll));
@@ -294,7 +294,7 @@ public:
MergeSortStageParams msparams;
msparams.dedup = false;
msparams.pattern = BSON("c" << 1);
- MergeSortStage* ms = new MergeSortStage(&_opCtx, msparams, ws.get(), coll);
+ MergeSortStage* ms = new MergeSortStage(&_opCtx, msparams, ws.get());
// a:1
auto params = makeIndexScanParams(&_opCtx, getIndex(firstIndex, coll));
@@ -360,7 +360,7 @@ public:
// Sort by c:-1
MergeSortStageParams msparams;
msparams.pattern = BSON("c" << -1);
- MergeSortStage* ms = new MergeSortStage(&_opCtx, msparams, ws.get(), coll);
+ MergeSortStage* ms = new MergeSortStage(&_opCtx, msparams, ws.get());
// a:1
auto params = makeIndexScanParams(&_opCtx, getIndex(firstIndex, coll));
@@ -428,7 +428,7 @@ public:
// Sort by c:1
MergeSortStageParams msparams;
msparams.pattern = BSON("c" << 1);
- MergeSortStage* ms = new MergeSortStage(&_opCtx, msparams, ws.get(), coll);
+ MergeSortStage* ms = new MergeSortStage(&_opCtx, msparams, ws.get());
// a:1
auto params = makeIndexScanParams(&_opCtx, getIndex(firstIndex, coll));
@@ -478,7 +478,7 @@ public:
// Sort by foo:1
MergeSortStageParams msparams;
msparams.pattern = BSON("foo" << 1);
- MergeSortStage* ms = new MergeSortStage(&_opCtx, msparams, ws.get(), coll);
+ MergeSortStage* ms = new MergeSortStage(&_opCtx, msparams, ws.get());
int numIndices = 20;
for (int i = 0; i < numIndices; ++i) {
@@ -530,7 +530,7 @@ public:
// Sort by foo:1
MergeSortStageParams msparams;
msparams.pattern = BSON("foo" << 1);
- auto ms = make_unique<MergeSortStage>(&_opCtx, msparams, &ws, coll);
+ auto ms = make_unique<MergeSortStage>(&_opCtx, msparams, &ws);
// Index 'a'+i has foo equal to 'i'.
@@ -658,7 +658,7 @@ public:
WorkingSetMember* member;
MergeSortStageParams msparams;
msparams.pattern = BSON("a" << 1);
- auto ms = stdx::make_unique<MergeSortStage>(&_opCtx, msparams, &ws, coll);
+ auto ms = stdx::make_unique<MergeSortStage>(&_opCtx, msparams, &ws);
// First child scans [5, 10].
{
@@ -757,7 +757,7 @@ public:
MergeSortStageParams msparams;
msparams.pattern = BSON("c" << 1 << "d" << 1);
msparams.collator = nullptr;
- MergeSortStage* ms = new MergeSortStage(&_opCtx, msparams, ws.get(), coll);
+ MergeSortStage* ms = new MergeSortStage(&_opCtx, msparams, ws.get());
// a:1
auto params = makeIndexScanParams(&_opCtx, getIndex(firstIndex, coll));
@@ -825,7 +825,7 @@ public:
msparams.pattern = BSON("c" << 1 << "d" << 1);
CollatorInterfaceMock collator(CollatorInterfaceMock::MockType::kReverseString);
msparams.collator = &collator;
- MergeSortStage* ms = new MergeSortStage(&_opCtx, msparams, ws.get(), coll);
+ MergeSortStage* ms = new MergeSortStage(&_opCtx, msparams, ws.get());
// a:1
auto params = makeIndexScanParams(&_opCtx, getIndex(firstIndex, coll));
diff --git a/src/mongo/dbtests/query_stage_sort.cpp b/src/mongo/dbtests/query_stage_sort.cpp
index dec254e9a50..fea7abfc6a0 100644
--- a/src/mongo/dbtests/query_stage_sort.cpp
+++ b/src/mongo/dbtests/query_stage_sort.cpp
@@ -117,7 +117,6 @@ public:
insertVarietyOfObjects(ws.get(), queuedDataStage.get(), coll);
SortStageParams params;
- params.collection = coll;
params.pattern = BSON("foo" << 1);
params.limit = limit();
@@ -156,7 +155,6 @@ public:
insertVarietyOfObjects(ws.get(), queuedDataStage.get(), coll);
SortStageParams params;
- params.collection = coll;
params.pattern = BSON("foo" << direction);
params.limit = limit();
@@ -556,9 +554,7 @@ public:
}
SortStageParams params;
- params.collection = coll;
params.pattern = BSON("b" << -1 << "c" << 1 << "a" << 1);
- params.limit = 0;
auto keyGenStage = make_unique<SortKeyGeneratorStage>(
&_opCtx, queuedDataStage.release(), ws.get(), params.pattern, nullptr);