summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
authorJason Rassi <rassi@10gen.com>2014-10-20 18:38:32 -0400
committerJason Rassi <rassi@10gen.com>2014-11-20 12:52:25 -0500
commit4c221b5ce50c3eaabc0348432b6df6c41aeabee5 (patch)
treea2093f79d0409087c2ef4ac3e610da20dc663bbe /src/mongo/dbtests
parent429dc5819eb37e21d9e5c4573aae8421efd50ed7 (diff)
downloadmongo-4c221b5ce50c3eaabc0348432b6df6c41aeabee5.tar.gz
SERVER-15675 PlanStage::invalidate() needs OperationContext
PlanStage::invalidate() is always called by a different thread than the stage's owning thread. The method should use the active OperationContext (the caller's) rather than the stage's OperationContext.
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/query_stage_and.cpp48
-rw-r--r--src/mongo/dbtests/query_stage_collscan.cpp4
-rw-r--r--src/mongo/dbtests/query_stage_count.cpp8
-rw-r--r--src/mongo/dbtests/query_stage_delete.cpp2
-rw-r--r--src/mongo/dbtests/query_stage_merge_sort.cpp16
-rw-r--r--src/mongo/dbtests/query_stage_near.cpp2
-rw-r--r--src/mongo/dbtests/query_stage_sort.cpp10
-rw-r--r--src/mongo/dbtests/query_stage_update.cpp2
8 files changed, 46 insertions, 46 deletions
diff --git a/src/mongo/dbtests/query_stage_and.cpp b/src/mongo/dbtests/query_stage_and.cpp
index 392c296ca2d..30f2c00c547 100644
--- a/src/mongo/dbtests/query_stage_and.cpp
+++ b/src/mongo/dbtests/query_stage_and.cpp
@@ -173,7 +173,7 @@ namespace QueryStageAnd {
addIndex(BSON("bar" << 1));
WorkingSet ws;
- scoped_ptr<AndHashStage> ah(new AndHashStage(&_txn, &ws, NULL, coll));
+ scoped_ptr<AndHashStage> ah(new AndHashStage(&ws, NULL, coll));
// Foo <= 20
IndexScanParams params;
@@ -210,7 +210,7 @@ namespace QueryStageAnd {
size_t memUsageBefore = ah->getMemUsage();
for (set<DiskLoc>::const_iterator it = data.begin(); it != data.end(); ++it) {
if (coll->docFor(&_txn, *it)["foo"].numberInt() == 15) {
- ah->invalidate(*it, INVALIDATION_DELETION);
+ ah->invalidate(&_txn, *it, INVALIDATION_DELETION);
remove(coll->docFor(&_txn, *it));
break;
}
@@ -277,7 +277,7 @@ namespace QueryStageAnd {
addIndex(BSON("baz" << 1));
WorkingSet ws;
- scoped_ptr<AndHashStage> ah(new AndHashStage(&_txn, &ws, NULL, coll));
+ scoped_ptr<AndHashStage> ah(new AndHashStage(&ws, NULL, coll));
// Foo <= 20 (descending)
IndexScanParams params;
@@ -313,7 +313,7 @@ namespace QueryStageAnd {
size_t memUsageBefore = ah->getMemUsage();
for (set<DiskLoc>::const_iterator it = data.begin(); it != data.end(); ++it) {
if (0 == deletedObj.woCompare(coll->docFor(&_txn, *it))) {
- ah->invalidate(*it, INVALIDATION_DELETION);
+ ah->invalidate(&_txn, *it, INVALIDATION_DELETION);
break;
}
}
@@ -363,7 +363,7 @@ namespace QueryStageAnd {
addIndex(BSON("bar" << 1));
WorkingSet ws;
- scoped_ptr<AndHashStage> ah(new AndHashStage(&_txn, &ws, NULL, coll));
+ scoped_ptr<AndHashStage> ah(new AndHashStage(&ws, NULL, coll));
// Foo <= 20
IndexScanParams params;
@@ -418,7 +418,7 @@ namespace QueryStageAnd {
// before hashed AND is done reading the first child (stage has to
// hold 21 keys in buffer for Foo <= 20).
WorkingSet ws;
- scoped_ptr<AndHashStage> ah(new AndHashStage(&_txn, &ws, NULL, coll, 20 * big.size()));
+ scoped_ptr<AndHashStage> ah(new AndHashStage(&ws, NULL, coll, 20 * big.size()));
// Foo <= 20
IndexScanParams params;
@@ -471,7 +471,7 @@ namespace QueryStageAnd {
// 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;
- scoped_ptr<AndHashStage> ah(new AndHashStage(&_txn, &ws, NULL, coll, 5 * big.size()));
+ scoped_ptr<AndHashStage> ah(new AndHashStage(&ws, NULL, coll, 5 * big.size()));
// Foo <= 20
IndexScanParams params;
@@ -519,7 +519,7 @@ namespace QueryStageAnd {
addIndex(BSON("baz" << 1));
WorkingSet ws;
- scoped_ptr<AndHashStage> ah(new AndHashStage(&_txn, &ws, NULL, coll));
+ scoped_ptr<AndHashStage> ah(new AndHashStage(&ws, NULL, coll));
// Foo <= 20
IndexScanParams params;
@@ -586,7 +586,7 @@ namespace QueryStageAnd {
// 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;
- scoped_ptr<AndHashStage> ah(new AndHashStage(&_txn, &ws, NULL, coll, 10 * big.size()));
+ scoped_ptr<AndHashStage> ah(new AndHashStage(&ws, NULL, coll, 10 * big.size()));
// Foo <= 20
IndexScanParams params;
@@ -640,7 +640,7 @@ namespace QueryStageAnd {
addIndex(BSON("bar" << 1));
WorkingSet ws;
- scoped_ptr<AndHashStage> ah(new AndHashStage(&_txn, &ws, NULL, coll));
+ scoped_ptr<AndHashStage> ah(new AndHashStage(&ws, NULL, coll));
// Foo <= 20
IndexScanParams params;
@@ -701,7 +701,7 @@ namespace QueryStageAnd {
addIndex(BSON("bar" << 1));
WorkingSet ws;
- scoped_ptr<AndHashStage> ah(new AndHashStage(&_txn, &ws, NULL, coll));
+ scoped_ptr<AndHashStage> ah(new AndHashStage(&ws, NULL, coll));
// Foo >= 100
IndexScanParams params;
@@ -753,7 +753,7 @@ namespace QueryStageAnd {
StatusWithMatchExpression swme = MatchExpressionParser::parse(filter);
verify(swme.isOK());
auto_ptr<MatchExpression> filterExpr(swme.getValue());
- scoped_ptr<AndHashStage> ah(new AndHashStage(&_txn, &ws, filterExpr.get(), coll));
+ scoped_ptr<AndHashStage> ah(new AndHashStage(&ws, filterExpr.get(), coll));
// Foo <= 20
IndexScanParams params;
@@ -802,7 +802,7 @@ namespace QueryStageAnd {
addIndex(BSON("bar" << 1));
WorkingSet ws;
- scoped_ptr<AndHashStage> ah(new AndHashStage(&_txn, &ws, NULL, coll));
+ scoped_ptr<AndHashStage> ah(new AndHashStage(&ws, NULL, coll));
// Foo <= 20
IndexScanParams params;
@@ -861,7 +861,7 @@ namespace QueryStageAnd {
addIndex(BSON("bar" << 1));
WorkingSet ws;
- scoped_ptr<AndHashStage> ah(new AndHashStage(&_txn, &ws, NULL, coll));
+ scoped_ptr<AndHashStage> ah(new AndHashStage(&ws, NULL, coll));
// Foo <= 20
IndexScanParams params;
@@ -925,7 +925,7 @@ namespace QueryStageAnd {
addIndex(BSON("bar" << 1));
WorkingSet ws;
- scoped_ptr<AndSortedStage> ah(new AndSortedStage(&_txn, &ws, NULL, coll));
+ scoped_ptr<AndSortedStage> ah(new AndSortedStage(&ws, NULL, coll));
// Scan over foo == 1
IndexScanParams params;
@@ -957,7 +957,7 @@ namespace QueryStageAnd {
// very first insert, which should be the very first thing in data. Let's invalidate it
// and make sure it shows up in the flagged results.
ah->saveState();
- ah->invalidate(*data.begin(), INVALIDATION_DELETION);
+ ah->invalidate(&_txn, *data.begin(), INVALIDATION_DELETION);
remove(coll->docFor(&_txn, *data.begin()));
ah->restoreState(&_txn);
@@ -996,7 +996,7 @@ namespace QueryStageAnd {
// Remove a result that's coming up. It's not the 'target' result of the AND so it's
// not flagged.
ah->saveState();
- ah->invalidate(*it, INVALIDATION_DELETION);
+ ah->invalidate(&_txn, *it, INVALIDATION_DELETION);
remove(coll->docFor(&_txn, *it));
ah->restoreState(&_txn);
@@ -1052,7 +1052,7 @@ namespace QueryStageAnd {
addIndex(BSON("baz" << 1));
WorkingSet ws;
- scoped_ptr<AndSortedStage> ah(new AndSortedStage(&_txn, &ws, NULL, coll));
+ scoped_ptr<AndSortedStage> ah(new AndSortedStage(&ws, NULL, coll));
// Scan over foo == 1
IndexScanParams params;
@@ -1097,7 +1097,7 @@ namespace QueryStageAnd {
addIndex(BSON("bar" << 1));
WorkingSet ws;
- scoped_ptr<AndSortedStage> ah(new AndSortedStage(&_txn, &ws, NULL, coll));
+ scoped_ptr<AndSortedStage> ah(new AndSortedStage(&ws, NULL, coll));
// Foo == 7. Should be EOF.
IndexScanParams params;
@@ -1146,7 +1146,7 @@ namespace QueryStageAnd {
addIndex(BSON("bar" << 1));
WorkingSet ws;
- scoped_ptr<AndSortedStage> ah(new AndSortedStage(&_txn, &ws, NULL, coll));
+ scoped_ptr<AndSortedStage> ah(new AndSortedStage(&ws, NULL, coll));
// foo == 7.
IndexScanParams params;
@@ -1195,7 +1195,7 @@ namespace QueryStageAnd {
StatusWithMatchExpression swme = MatchExpressionParser::parse(filterObj);
verify(swme.isOK());
auto_ptr<MatchExpression> filterExpr(swme.getValue());
- scoped_ptr<AndSortedStage> ah(new AndSortedStage(&_txn, &ws, filterExpr.get(), coll));
+ scoped_ptr<AndSortedStage> ah(new AndSortedStage(&ws, filterExpr.get(), coll));
// Scan over foo == 1
IndexScanParams params;
@@ -1237,7 +1237,7 @@ namespace QueryStageAnd {
addIndex(BSON("bar" << 1));
WorkingSet ws;
- scoped_ptr<AndHashStage> ah(new AndHashStage(&_txn, &ws, NULL, coll));
+ scoped_ptr<AndHashStage> ah(new AndHashStage(&ws, NULL, coll));
// Scan over foo == 1
IndexScanParams params;
@@ -1301,7 +1301,7 @@ namespace QueryStageAnd {
addIndex(BSON("bar" << 1));
WorkingSet ws;
- scoped_ptr<AndSortedStage> as(new AndSortedStage(&_txn, &ws, NULL, coll));
+ scoped_ptr<AndSortedStage> as(new AndSortedStage(&ws, NULL, coll));
// Scan over foo == 1
IndexScanParams params;
@@ -1355,7 +1355,7 @@ namespace QueryStageAnd {
addIndex(BSON("bar" << 1));
WorkingSet ws;
- scoped_ptr<AndSortedStage> as(new AndSortedStage(&_txn, &ws, NULL, coll));
+ scoped_ptr<AndSortedStage> as(new AndSortedStage(&ws, NULL, coll));
// Scan over foo == 1
IndexScanParams params;
diff --git a/src/mongo/dbtests/query_stage_collscan.cpp b/src/mongo/dbtests/query_stage_collscan.cpp
index 0d2b5bec74c..f2e406e29fb 100644
--- a/src/mongo/dbtests/query_stage_collscan.cpp
+++ b/src/mongo/dbtests/query_stage_collscan.cpp
@@ -288,7 +288,7 @@ namespace QueryStageCollectionScan {
// Remove locs[count].
scan->saveState();
- scan->invalidate(locs[count], INVALIDATION_DELETION);
+ scan->invalidate(&_txn, locs[count], INVALIDATION_DELETION);
remove(coll->docFor(&_txn, locs[count]));
scan->restoreState(&_txn);
@@ -349,7 +349,7 @@ namespace QueryStageCollectionScan {
// Remove locs[count].
scan->saveState();
- scan->invalidate(locs[count], INVALIDATION_DELETION);
+ scan->invalidate(&_txn, locs[count], INVALIDATION_DELETION);
remove(coll->docFor(&_txn, locs[count]));
scan->restoreState(&_txn);
diff --git a/src/mongo/dbtests/query_stage_count.cpp b/src/mongo/dbtests/query_stage_count.cpp
index 817dd2918cc..3593d0841e3 100644
--- a/src/mongo/dbtests/query_stage_count.cpp
+++ b/src/mongo/dbtests/query_stage_count.cpp
@@ -281,10 +281,10 @@ namespace QueryStageCount {
if (interjection == 0) {
// At this point, our first interjection, we've counted _locs[0]
// and are about to count _locs[1]
- count_stage.invalidate(_locs[interjection], INVALIDATION_DELETION);
+ count_stage.invalidate(&_txn, _locs[interjection], INVALIDATION_DELETION);
remove(_locs[interjection]);
- count_stage.invalidate(_locs[interjection+1], INVALIDATION_DELETION);
+ count_stage.invalidate(&_txn, _locs[interjection+1], INVALIDATION_DELETION);
remove(_locs[interjection+1]);
}
}
@@ -303,11 +303,11 @@ namespace QueryStageCount {
// At the point which this is called we are in between the first and second record
void interject(CountStage& count_stage, int interjection) {
if (interjection == 0) {
- count_stage.invalidate(_locs[0], INVALIDATION_MUTATION);
+ count_stage.invalidate(&_txn, _locs[0], INVALIDATION_MUTATION);
OID id1 = _coll->docFor(&_txn, _locs[0]).getField("_id").OID();
update(_locs[0], BSON("_id" << id1 << "x" << 100));
- count_stage.invalidate(_locs[1], INVALIDATION_MUTATION);
+ count_stage.invalidate(&_txn, _locs[1], INVALIDATION_MUTATION);
OID id2 = _coll->docFor(&_txn, _locs[1]).getField("_id").OID();
update(_locs[1], BSON("_id" << id2 << "x" << 100));
}
diff --git a/src/mongo/dbtests/query_stage_delete.cpp b/src/mongo/dbtests/query_stage_delete.cpp
index 56849e38f70..ed13459cc77 100644
--- a/src/mongo/dbtests/query_stage_delete.cpp
+++ b/src/mongo/dbtests/query_stage_delete.cpp
@@ -142,7 +142,7 @@ namespace QueryStageDelete {
// Remove locs[targetDocIndex];
deleteStage.saveState();
- deleteStage.invalidate(locs[targetDocIndex], INVALIDATION_DELETION);
+ deleteStage.invalidate(&_txn, locs[targetDocIndex], INVALIDATION_DELETION);
BSONObj targetDoc = coll->docFor(&_txn, locs[targetDocIndex]);
ASSERT(!targetDoc.isEmpty());
remove(targetDoc);
diff --git a/src/mongo/dbtests/query_stage_merge_sort.cpp b/src/mongo/dbtests/query_stage_merge_sort.cpp
index e0cb3676077..059cfe9e7e7 100644
--- a/src/mongo/dbtests/query_stage_merge_sort.cpp
+++ b/src/mongo/dbtests/query_stage_merge_sort.cpp
@@ -135,7 +135,7 @@ namespace QueryStageMergeSortTests {
// Sort by c:1
MergeSortStageParams msparams;
msparams.pattern = BSON("c" << 1);
- MergeSortStage* ms = new MergeSortStage(&_txn, msparams, ws, coll);
+ MergeSortStage* ms = new MergeSortStage(msparams, ws, coll);
// a:1
IndexScanParams params;
@@ -204,7 +204,7 @@ namespace QueryStageMergeSortTests {
// Sort by c:1
MergeSortStageParams msparams;
msparams.pattern = BSON("c" << 1);
- MergeSortStage* ms = new MergeSortStage(&_txn, msparams, ws, coll);
+ MergeSortStage* ms = new MergeSortStage(msparams, ws, coll);
// a:1
IndexScanParams params;
@@ -272,7 +272,7 @@ namespace QueryStageMergeSortTests {
MergeSortStageParams msparams;
msparams.dedup = false;
msparams.pattern = BSON("c" << 1);
- MergeSortStage* ms = new MergeSortStage(&_txn, msparams, ws, coll);
+ MergeSortStage* ms = new MergeSortStage(msparams, ws, coll);
// a:1
IndexScanParams params;
@@ -342,7 +342,7 @@ namespace QueryStageMergeSortTests {
// Sort by c:-1
MergeSortStageParams msparams;
msparams.pattern = BSON("c" << -1);
- MergeSortStage* ms = new MergeSortStage(&_txn, msparams, ws, coll);
+ MergeSortStage* ms = new MergeSortStage(msparams, ws, coll);
// a:1
IndexScanParams params;
@@ -411,7 +411,7 @@ namespace QueryStageMergeSortTests {
// Sort by c:1
MergeSortStageParams msparams;
msparams.pattern = BSON("c" << 1);
- MergeSortStage* ms = new MergeSortStage(&_txn, msparams, ws, coll);
+ MergeSortStage* ms = new MergeSortStage(msparams, ws, coll);
// a:1
IndexScanParams params;
@@ -466,7 +466,7 @@ namespace QueryStageMergeSortTests {
// Sort by foo:1
MergeSortStageParams msparams;
msparams.pattern = BSON("foo" << 1);
- MergeSortStage* ms = new MergeSortStage(&_txn, msparams, ws, coll);
+ MergeSortStage* ms = new MergeSortStage(msparams, ws, coll);
IndexScanParams params;
params.bounds.isSimpleRange = true;
@@ -524,7 +524,7 @@ namespace QueryStageMergeSortTests {
// Sort by foo:1
MergeSortStageParams msparams;
msparams.pattern = BSON("foo" << 1);
- auto_ptr<MergeSortStage> ms(new MergeSortStage(&_txn, msparams, &ws, coll));
+ auto_ptr<MergeSortStage> ms(new MergeSortStage(msparams, &ws, coll));
IndexScanParams params;
params.bounds.isSimpleRange = true;
@@ -573,7 +573,7 @@ namespace QueryStageMergeSortTests {
// Invalidate locs[11]. Should force a fetch. We don't get it back.
ms->saveState();
- ms->invalidate(*it, INVALIDATION_DELETION);
+ ms->invalidate(&_txn, *it, INVALIDATION_DELETION);
ms->restoreState(&_txn);
// Make sure locs[11] was fetched for us.
diff --git a/src/mongo/dbtests/query_stage_near.cpp b/src/mongo/dbtests/query_stage_near.cpp
index 28c6bba36d3..961c2022897 100644
--- a/src/mongo/dbtests/query_stage_near.cpp
+++ b/src/mongo/dbtests/query_stage_near.cpp
@@ -88,7 +88,7 @@ namespace {
virtual void restoreState(OperationContext* opCtx) {
}
- virtual void invalidate(const DiskLoc& dl, InvalidationType type) {
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
}
virtual vector<PlanStage*> getChildren() const {
return vector<PlanStage*>();
diff --git a/src/mongo/dbtests/query_stage_sort.cpp b/src/mongo/dbtests/query_stage_sort.cpp
index f4d81acea2d..4dfa777d720 100644
--- a/src/mongo/dbtests/query_stage_sort.cpp
+++ b/src/mongo/dbtests/query_stage_sort.cpp
@@ -127,7 +127,7 @@ namespace QueryStageSortTests {
PlanExecutor::make(&_txn,
ws,
new FetchStage(&_txn, ws,
- new SortStage(&_txn, params, ws, ms), NULL, coll),
+ new SortStage(params, ws, ms), NULL, coll),
coll, PlanExecutor::YIELD_MANUAL, &rawExec);
ASSERT_OK(status);
boost::scoped_ptr<PlanExecutor> exec(rawExec);
@@ -281,7 +281,7 @@ namespace QueryStageSortTests {
params.collection = coll;
params.pattern = BSON("foo" << 1);
params.limit = limit();
- auto_ptr<SortStage> ss(new SortStage(&_txn, params, &ws, ms.get()));
+ auto_ptr<SortStage> ss(new SortStage(params, &ws, ms.get()));
const int firstRead = 10;
@@ -295,7 +295,7 @@ namespace QueryStageSortTests {
// We should have read in the first 'firstRead' locs. Invalidate the first.
ss->saveState();
set<DiskLoc>::iterator it = locs.begin();
- ss->invalidate(*it++, INVALIDATION_DELETION);
+ ss->invalidate(&_txn, *it++, INVALIDATION_DELETION);
ss->restoreState(&_txn);
// Read the rest of the data from the mock stage.
@@ -310,7 +310,7 @@ namespace QueryStageSortTests {
// Let's just invalidate everything now.
ss->saveState();
while (it != locs.end()) {
- ss->invalidate(*it++, INVALIDATION_DELETION);
+ ss->invalidate(&_txn, *it++, INVALIDATION_DELETION);
}
ss->restoreState(&_txn);
@@ -384,7 +384,7 @@ namespace QueryStageSortTests {
ws,
new FetchStage(&_txn,
ws,
- new SortStage(&_txn, params, ws, ms), NULL, coll),
+ new SortStage(params, ws, ms), NULL, coll),
coll, PlanExecutor::YIELD_MANUAL, &rawExec);
boost::scoped_ptr<PlanExecutor> exec(rawExec);
diff --git a/src/mongo/dbtests/query_stage_update.cpp b/src/mongo/dbtests/query_stage_update.cpp
index 0fd932a0c80..75df12f9978 100644
--- a/src/mongo/dbtests/query_stage_update.cpp
+++ b/src/mongo/dbtests/query_stage_update.cpp
@@ -307,7 +307,7 @@ namespace QueryStageUpdate {
// Remove locs[targetDocIndex];
updateStage->saveState();
- updateStage->invalidate(locs[targetDocIndex], INVALIDATION_DELETION);
+ updateStage->invalidate(&_txn, locs[targetDocIndex], INVALIDATION_DELETION);
BSONObj targetDoc = coll->docFor(&_txn, locs[targetDocIndex]);
ASSERT(!targetDoc.isEmpty());
remove(targetDoc);