summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/catalog/collection.cpp10
-rw-r--r--src/mongo/db/catalog/collection_cursor_cache.cpp7
-rw-r--r--src/mongo/db/catalog/collection_cursor_cache.h3
-rw-r--r--src/mongo/db/exec/and_hash.cpp21
-rw-r--r--src/mongo/db/exec/and_hash.h9
-rw-r--r--src/mongo/db/exec/and_sorted.cpp15
-rw-r--r--src/mongo/db/exec/and_sorted.h6
-rw-r--r--src/mongo/db/exec/cached_plan.cpp8
-rw-r--r--src/mongo/db/exec/cached_plan.h2
-rw-r--r--src/mongo/db/exec/collection_scan.cpp4
-rw-r--r--src/mongo/db/exec/collection_scan.h2
-rw-r--r--src/mongo/db/exec/count.cpp4
-rw-r--r--src/mongo/db/exec/count.h2
-rw-r--r--src/mongo/db/exec/count_scan.cpp2
-rw-r--r--src/mongo/db/exec/count_scan.h2
-rw-r--r--src/mongo/db/exec/delete.cpp4
-rw-r--r--src/mongo/db/exec/delete.h2
-rw-r--r--src/mongo/db/exec/distinct_scan.cpp2
-rw-r--r--src/mongo/db/exec/distinct_scan.h2
-rw-r--r--src/mongo/db/exec/eof.cpp2
-rw-r--r--src/mongo/db/exec/eof.h2
-rw-r--r--src/mongo/db/exec/fetch.cpp6
-rw-r--r--src/mongo/db/exec/fetch.h2
-rw-r--r--src/mongo/db/exec/group.cpp4
-rw-r--r--src/mongo/db/exec/group.h2
-rw-r--r--src/mongo/db/exec/idhack.cpp2
-rw-r--r--src/mongo/db/exec/idhack.h2
-rw-r--r--src/mongo/db/exec/index_scan.cpp2
-rw-r--r--src/mongo/db/exec/index_scan.h2
-rw-r--r--src/mongo/db/exec/keep_mutations.cpp6
-rw-r--r--src/mongo/db/exec/keep_mutations.h2
-rw-r--r--src/mongo/db/exec/limit.cpp4
-rw-r--r--src/mongo/db/exec/limit.h2
-rw-r--r--src/mongo/db/exec/merge_sort.cpp15
-rw-r--r--src/mongo/db/exec/merge_sort.h6
-rw-r--r--src/mongo/db/exec/mock_stage.cpp2
-rw-r--r--src/mongo/db/exec/mock_stage.h2
-rw-r--r--src/mongo/db/exec/mock_stage_test.cpp2
-rw-r--r--src/mongo/db/exec/multi_iterator.cpp4
-rw-r--r--src/mongo/db/exec/multi_iterator.h2
-rw-r--r--src/mongo/db/exec/multi_plan.cpp16
-rw-r--r--src/mongo/db/exec/multi_plan.h2
-rw-r--r--src/mongo/db/exec/near.cpp6
-rw-r--r--src/mongo/db/exec/near.h2
-rw-r--r--src/mongo/db/exec/oplogstart.cpp4
-rw-r--r--src/mongo/db/exec/oplogstart.h2
-rw-r--r--src/mongo/db/exec/or.cpp4
-rw-r--r--src/mongo/db/exec/or.h2
-rw-r--r--src/mongo/db/exec/pipeline_proxy.cpp6
-rw-r--r--src/mongo/db/exec/pipeline_proxy.h2
-rw-r--r--src/mongo/db/exec/plan_stage.h7
-rw-r--r--src/mongo/db/exec/projection.cpp6
-rw-r--r--src/mongo/db/exec/projection.h2
-rw-r--r--src/mongo/db/exec/shard_filter.cpp6
-rw-r--r--src/mongo/db/exec/shard_filter.h2
-rw-r--r--src/mongo/db/exec/skip.cpp4
-rw-r--r--src/mongo/db/exec/skip.h2
-rw-r--r--src/mongo/db/exec/sort.cpp13
-rw-r--r--src/mongo/db/exec/sort.h6
-rw-r--r--src/mongo/db/exec/sort_test.cpp4
-rw-r--r--src/mongo/db/exec/stagedebug_cmd.cpp10
-rw-r--r--src/mongo/db/exec/subplan.cpp4
-rw-r--r--src/mongo/db/exec/subplan.h2
-rw-r--r--src/mongo/db/exec/text.cpp4
-rw-r--r--src/mongo/db/exec/text.h2
-rw-r--r--src/mongo/db/exec/update.cpp4
-rw-r--r--src/mongo/db/exec/update.h2
-rw-r--r--src/mongo/db/query/plan_executor.cpp4
-rw-r--r--src/mongo/db/query/plan_executor.h2
-rw-r--r--src/mongo/db/query/stage_builder.cpp8
-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
-rw-r--r--src/mongo/s/d_migrate.cpp7
79 files changed, 210 insertions, 209 deletions
diff --git a/src/mongo/db/catalog/collection.cpp b/src/mongo/db/catalog/collection.cpp
index 3e00dd56bb6..3ee01cbb42c 100644
--- a/src/mongo/db/catalog/collection.cpp
+++ b/src/mongo/db/catalog/collection.cpp
@@ -253,7 +253,7 @@ namespace mongo {
BSONObj doc = docFor( txn, loc );
/* check if any cursors point to us. if so, advance them. */
- _cursorCache.invalidateDocument(loc, INVALIDATION_DELETION);
+ _cursorCache.invalidateDocument(txn, loc, INVALIDATION_DELETION);
_indexCatalog.unindexRecord(txn, doc, loc, false);
@@ -281,7 +281,7 @@ namespace mongo {
}
/* check if any cursors point to us. if so, advance them. */
- _cursorCache.invalidateDocument(loc, INVALIDATION_DELETION);
+ _cursorCache.invalidateDocument(txn, loc, INVALIDATION_DELETION);
_indexCatalog.unindexRecord(txn, doc, loc, noWarn);
@@ -390,7 +390,7 @@ namespace mongo {
}
// Broadcast the mutation so that query results stay correct.
- _cursorCache.invalidateDocument(oldLocation, INVALIDATION_MUTATION);
+ _cursorCache.invalidateDocument(txn, oldLocation, INVALIDATION_MUTATION);
return newLocation;
}
@@ -400,7 +400,7 @@ namespace mongo {
const char* oldBuffer,
size_t oldSize ) {
moveCounter.increment();
- _cursorCache.invalidateDocument(oldLocation, INVALIDATION_DELETION);
+ _cursorCache.invalidateDocument(txn, oldLocation, INVALIDATION_DELETION);
_indexCatalog.unindexRecord(txn, BSONObj(oldBuffer), oldLocation, true);
return Status::OK();
}
@@ -413,7 +413,7 @@ namespace mongo {
const mutablebson::DamageVector& damages ) {
// Broadcast the mutation so that query results stay correct.
- _cursorCache.invalidateDocument(loc, INVALIDATION_MUTATION);
+ _cursorCache.invalidateDocument(txn, loc, INVALIDATION_MUTATION);
return _recordStore->updateWithDamages( txn, loc, oldRec, damageSource, damages );
}
diff --git a/src/mongo/db/catalog/collection_cursor_cache.cpp b/src/mongo/db/catalog/collection_cursor_cache.cpp
index 700064b1b7d..582ca22c715 100644
--- a/src/mongo/db/catalog/collection_cursor_cache.cpp
+++ b/src/mongo/db/catalog/collection_cursor_cache.cpp
@@ -346,7 +346,8 @@ namespace mongo {
}
}
- void CollectionCursorCache::invalidateDocument( const DiskLoc& dl,
+ void CollectionCursorCache::invalidateDocument( OperationContext* txn,
+ const DiskLoc& dl,
InvalidationType type ) {
if ( supportsDocLocking() ) {
// If a storage engine supports doc locking, then we do not need to invalidate.
@@ -361,13 +362,13 @@ namespace mongo {
++it ) {
PlanExecutor* exec = *it;
- exec->invalidate(dl, type);
+ exec->invalidate(txn, dl, type);
}
for ( CursorMap::const_iterator i = _cursors.begin(); i != _cursors.end(); ++i ) {
PlanExecutor* exec = i->second->getExecutor();
if ( exec ) {
- exec->invalidate(dl, type);
+ exec->invalidate(txn, dl, type);
}
}
}
diff --git a/src/mongo/db/catalog/collection_cursor_cache.h b/src/mongo/db/catalog/collection_cursor_cache.h
index e0aa6f9ad51..e9822b46c01 100644
--- a/src/mongo/db/catalog/collection_cursor_cache.h
+++ b/src/mongo/db/catalog/collection_cursor_cache.h
@@ -65,7 +65,8 @@ namespace mongo {
* Broadcast a document invalidation to all relevant PlanExecutor(s). invalidateDocument
* must called *before* the provided DiskLoc is about to be deleted or mutated.
*/
- void invalidateDocument( const DiskLoc& dl,
+ void invalidateDocument( OperationContext* txn,
+ const DiskLoc& dl,
InvalidationType type );
/*
diff --git a/src/mongo/db/exec/and_hash.cpp b/src/mongo/db/exec/and_hash.cpp
index b1737ee6d1c..531ff3c432c 100644
--- a/src/mongo/db/exec/and_hash.cpp
+++ b/src/mongo/db/exec/and_hash.cpp
@@ -52,12 +52,10 @@ namespace mongo {
// static
const char* AndHashStage::kStageType = "AND_HASH";
- AndHashStage::AndHashStage(OperationContext* txn,
- WorkingSet* ws,
+ AndHashStage::AndHashStage(WorkingSet* ws,
const MatchExpression* filter,
const Collection* collection)
- : _txn(txn),
- _collection(collection),
+ : _collection(collection),
_ws(ws),
_filter(filter),
_hashingChildren(true),
@@ -66,13 +64,11 @@ namespace mongo {
_memUsage(0),
_maxMemUsage(kDefaultMaxMemUsageBytes) {}
- AndHashStage::AndHashStage(OperationContext* txn,
- WorkingSet* ws,
+ AndHashStage::AndHashStage(WorkingSet* ws,
const MatchExpression* filter,
const Collection* collection,
size_t maxMemUsage)
- : _txn(txn),
- _collection(collection),
+ : _collection(collection),
_ws(ws),
_filter(filter),
_hashingChildren(true),
@@ -454,7 +450,6 @@ namespace mongo {
}
void AndHashStage::restoreState(OperationContext* opCtx) {
- _txn = opCtx;
++_commonStats.unyields;
for (size_t i = 0; i < _children.size(); ++i) {
@@ -462,13 +457,13 @@ namespace mongo {
}
}
- void AndHashStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void AndHashStage::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_commonStats.invalidates;
if (isEOF()) { return; }
for (size_t i = 0; i < _children.size(); ++i) {
- _children[i]->invalidate(dl, type);
+ _children[i]->invalidate(txn, dl, type);
}
// Invalidation can happen to our warmup results. If that occurs just
@@ -477,7 +472,7 @@ namespace mongo {
if (WorkingSet::INVALID_ID != _lookAheadResults[i]) {
WorkingSetMember* member = _ws->get(_lookAheadResults[i]);
if (member->hasLoc() && member->loc == dl) {
- WorkingSetCommon::fetchAndInvalidateLoc(_txn, member, _collection);
+ WorkingSetCommon::fetchAndInvalidateLoc(txn, member, _collection);
_ws->flagForReview(_lookAheadResults[i]);
_lookAheadResults[i] = WorkingSet::INVALID_ID;
}
@@ -507,7 +502,7 @@ namespace mongo {
_memUsage -= member->getMemUsage();
// The loc is about to be invalidated. Fetch it and clear the loc.
- WorkingSetCommon::fetchAndInvalidateLoc(_txn, member, _collection);
+ WorkingSetCommon::fetchAndInvalidateLoc(txn, member, _collection);
// Add the WSID to the to-be-reviewed list in the WS.
_ws->flagForReview(id);
diff --git a/src/mongo/db/exec/and_hash.h b/src/mongo/db/exec/and_hash.h
index 6f9e62f8931..1a16c4bd846 100644
--- a/src/mongo/db/exec/and_hash.h
+++ b/src/mongo/db/exec/and_hash.h
@@ -52,16 +52,14 @@ namespace mongo {
*/
class AndHashStage : public PlanStage {
public:
- AndHashStage(OperationContext* txn,
- WorkingSet* ws,
+ AndHashStage(WorkingSet* ws,
const MatchExpression* filter,
const Collection* collection);
/**
* For testing only. Allows tests to set memory usage threshold.
*/
- AndHashStage(OperationContext* txn,
- WorkingSet* ws,
+ AndHashStage(WorkingSet* ws,
const MatchExpression* filter,
const Collection* collection,
size_t maxMemUsage);
@@ -81,7 +79,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
@@ -103,7 +101,6 @@ namespace mongo {
StageState workChild(size_t childNo, WorkingSetID* out);
// Not owned by us.
- OperationContext* _txn;
const Collection* _collection;
// Not owned by us.
diff --git a/src/mongo/db/exec/and_sorted.cpp b/src/mongo/db/exec/and_sorted.cpp
index 6cae3b1f038..5405ff76fe0 100644
--- a/src/mongo/db/exec/and_sorted.cpp
+++ b/src/mongo/db/exec/and_sorted.cpp
@@ -39,12 +39,10 @@ namespace mongo {
// static
const char* AndSortedStage::kStageType = "AND_SORTED";
- AndSortedStage::AndSortedStage(OperationContext* txn,
- WorkingSet* ws,
+ AndSortedStage::AndSortedStage(WorkingSet* ws,
const MatchExpression* filter,
const Collection* collection)
- : _txn(txn),
- _collection(collection),
+ : _collection(collection),
_ws(ws),
_filter(filter),
_targetNode(numeric_limits<size_t>::max()),
@@ -278,7 +276,6 @@ namespace mongo {
}
void AndSortedStage::restoreState(OperationContext* opCtx) {
- _txn = opCtx;
++_commonStats.unyields;
for (size_t i = 0; i < _children.size(); ++i) {
@@ -286,13 +283,15 @@ namespace mongo {
}
}
- void AndSortedStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void AndSortedStage::invalidate(OperationContext* txn,
+ const DiskLoc& dl,
+ InvalidationType type) {
++_commonStats.invalidates;
if (isEOF()) { return; }
for (size_t i = 0; i < _children.size(); ++i) {
- _children[i]->invalidate(dl, type);
+ _children[i]->invalidate(txn, dl, type);
}
if (dl == _targetLoc) {
@@ -303,7 +302,7 @@ namespace mongo {
++_specificStats.flagged;
// The DiskLoc could still be a valid result so flag it and save it for later.
- WorkingSetCommon::fetchAndInvalidateLoc(_txn, _ws->get(_targetId), _collection);
+ WorkingSetCommon::fetchAndInvalidateLoc(txn, _ws->get(_targetId), _collection);
_ws->flagForReview(_targetId);
_targetId = WorkingSet::INVALID_ID;
diff --git a/src/mongo/db/exec/and_sorted.h b/src/mongo/db/exec/and_sorted.h
index 870cbd1b1ab..106095b6325 100644
--- a/src/mongo/db/exec/and_sorted.h
+++ b/src/mongo/db/exec/and_sorted.h
@@ -53,8 +53,7 @@ namespace mongo {
*/
class AndSortedStage : public PlanStage {
public:
- AndSortedStage(OperationContext* txn,
- WorkingSet* ws, const MatchExpression* filter, const Collection* collection);
+ AndSortedStage(WorkingSet* ws, const MatchExpression* filter, const Collection* collection);
virtual ~AndSortedStage();
void addChild(PlanStage* child);
@@ -64,7 +63,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
@@ -87,7 +86,6 @@ namespace mongo {
PlanStage::StageState moveTowardTargetLoc(WorkingSetID* out);
// Not owned by us.
- OperationContext* _txn;
const Collection* _collection;
// Not owned by us.
diff --git a/src/mongo/db/exec/cached_plan.cpp b/src/mongo/db/exec/cached_plan.cpp
index c05992db36f..42dce27c931 100644
--- a/src/mongo/db/exec/cached_plan.cpp
+++ b/src/mongo/db/exec/cached_plan.cpp
@@ -127,12 +127,14 @@ namespace mongo {
++_commonStats.unyields;
}
- void CachedPlanStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void CachedPlanStage::invalidate(OperationContext* txn,
+ const DiskLoc& dl,
+ InvalidationType type) {
if (! _usingBackupChild) {
- _mainChildPlan->invalidate(dl, type);
+ _mainChildPlan->invalidate(txn, dl, type);
}
if (NULL != _backupChildPlan.get()) {
- _backupChildPlan->invalidate(dl, type);
+ _backupChildPlan->invalidate(txn, dl, type);
}
++_commonStats.invalidates;
}
diff --git a/src/mongo/db/exec/cached_plan.h b/src/mongo/db/exec/cached_plan.h
index b776dc156d2..0cc2fabdc47 100644
--- a/src/mongo/db/exec/cached_plan.h
+++ b/src/mongo/db/exec/cached_plan.h
@@ -64,7 +64,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/collection_scan.cpp b/src/mongo/db/exec/collection_scan.cpp
index df49cadb07c..b0c1267c8c4 100644
--- a/src/mongo/db/exec/collection_scan.cpp
+++ b/src/mongo/db/exec/collection_scan.cpp
@@ -179,7 +179,9 @@ namespace mongo {
return _iter->isEOF();
}
- void CollectionScan::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void CollectionScan::invalidate(OperationContext* txn,
+ const DiskLoc& dl,
+ InvalidationType type) {
++_commonStats.invalidates;
// We don't care about mutations since we apply any filters to the result when we (possibly)
diff --git a/src/mongo/db/exec/collection_scan.h b/src/mongo/db/exec/collection_scan.h
index f79327f7c6c..46b02f415c0 100644
--- a/src/mongo/db/exec/collection_scan.h
+++ b/src/mongo/db/exec/collection_scan.h
@@ -55,7 +55,7 @@ namespace mongo {
virtual StageState work(WorkingSetID* out);
virtual bool isEOF();
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
diff --git a/src/mongo/db/exec/count.cpp b/src/mongo/db/exec/count.cpp
index 1f4cbd3d48e..6bcd3d63ce6 100644
--- a/src/mongo/db/exec/count.cpp
+++ b/src/mongo/db/exec/count.cpp
@@ -178,10 +178,10 @@ namespace mongo {
}
}
- void CountStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void CountStage::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_commonStats.invalidates;
if (_child.get()) {
- _child->invalidate(dl, type);
+ _child->invalidate(txn, dl, type);
}
}
diff --git a/src/mongo/db/exec/count.h b/src/mongo/db/exec/count.h
index e4ad071c826..a099ca71394 100644
--- a/src/mongo/db/exec/count.h
+++ b/src/mongo/db/exec/count.h
@@ -88,7 +88,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/count_scan.cpp b/src/mongo/db/exec/count_scan.cpp
index 1b278f9b541..cff8b4ccaaa 100644
--- a/src/mongo/db/exec/count_scan.cpp
+++ b/src/mongo/db/exec/count_scan.cpp
@@ -201,7 +201,7 @@ namespace mongo {
checkEnd();
}
- void CountScan::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void CountScan::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_commonStats.invalidates;
// The only state we're responsible for holding is what DiskLocs to drop. If a document
diff --git a/src/mongo/db/exec/count_scan.h b/src/mongo/db/exec/count_scan.h
index 70ebb289dd5..b5399199116 100644
--- a/src/mongo/db/exec/count_scan.h
+++ b/src/mongo/db/exec/count_scan.h
@@ -75,7 +75,7 @@ namespace mongo {
virtual bool isEOF();
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/delete.cpp b/src/mongo/db/exec/delete.cpp
index fb24f9ec29c..d13b8bf2ff8 100644
--- a/src/mongo/db/exec/delete.cpp
+++ b/src/mongo/db/exec/delete.cpp
@@ -175,9 +175,9 @@ namespace mongo {
repl::getGlobalReplicationCoordinator()->canAcceptWritesForDatabase(ns.db()));
}
- void DeleteStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void DeleteStage::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_commonStats.invalidates;
- _child->invalidate(dl, type);
+ _child->invalidate(txn, dl, type);
}
vector<PlanStage*> DeleteStage::getChildren() const {
diff --git a/src/mongo/db/exec/delete.h b/src/mongo/db/exec/delete.h
index 17dbc79a316..12a62697261 100644
--- a/src/mongo/db/exec/delete.h
+++ b/src/mongo/db/exec/delete.h
@@ -79,7 +79,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/distinct_scan.cpp b/src/mongo/db/exec/distinct_scan.cpp
index 9129d82bd6a..ddbe6a49103 100644
--- a/src/mongo/db/exec/distinct_scan.cpp
+++ b/src/mongo/db/exec/distinct_scan.cpp
@@ -201,7 +201,7 @@ namespace mongo {
}
}
- void DistinctScan::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void DistinctScan::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_commonStats.invalidates;
}
diff --git a/src/mongo/db/exec/distinct_scan.h b/src/mongo/db/exec/distinct_scan.h
index 54e87fbf000..83a85811782 100644
--- a/src/mongo/db/exec/distinct_scan.h
+++ b/src/mongo/db/exec/distinct_scan.h
@@ -104,7 +104,7 @@ namespace mongo {
virtual bool isEOF();
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/eof.cpp b/src/mongo/db/exec/eof.cpp
index 46d9ba8c334..0ab4cbb166c 100644
--- a/src/mongo/db/exec/eof.cpp
+++ b/src/mongo/db/exec/eof.cpp
@@ -60,7 +60,7 @@ namespace mongo {
++_commonStats.unyields;
}
- void EOFStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void EOFStage::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_commonStats.invalidates;
}
diff --git a/src/mongo/db/exec/eof.h b/src/mongo/db/exec/eof.h
index 25798a504a2..78c9aa6b1e7 100644
--- a/src/mongo/db/exec/eof.h
+++ b/src/mongo/db/exec/eof.h
@@ -47,7 +47,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/fetch.cpp b/src/mongo/db/exec/fetch.cpp
index b1bde6dafc4..112bcbec1d3 100644
--- a/src/mongo/db/exec/fetch.cpp
+++ b/src/mongo/db/exec/fetch.cpp
@@ -162,10 +162,10 @@ namespace mongo {
_child->restoreState(opCtx);
}
- void FetchStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void FetchStage::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_commonStats.invalidates;
- _child->invalidate(dl, type);
+ _child->invalidate(txn, dl, type);
// It's possible that the loc getting invalidated is the one we're about to
// fetch. In this case we do a "forced fetch" and put the WSM in owned object state.
@@ -173,7 +173,7 @@ namespace mongo {
WorkingSetMember* member = _ws->get(_idBeingPagedIn);
if (member->hasLoc() && (member->loc == dl)) {
// Fetch it now and kill the diskloc.
- WorkingSetCommon::fetchAndInvalidateLoc(_txn, member, _collection);
+ WorkingSetCommon::fetchAndInvalidateLoc(txn, member, _collection);
}
}
}
diff --git a/src/mongo/db/exec/fetch.h b/src/mongo/db/exec/fetch.h
index 9a26c575733..b6374c49ed2 100644
--- a/src/mongo/db/exec/fetch.h
+++ b/src/mongo/db/exec/fetch.h
@@ -58,7 +58,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/group.cpp b/src/mongo/db/exec/group.cpp
index 037a70f86c0..af6b5958384 100644
--- a/src/mongo/db/exec/group.cpp
+++ b/src/mongo/db/exec/group.cpp
@@ -267,9 +267,9 @@ namespace mongo {
_child->restoreState(opCtx);
}
- void GroupStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void GroupStage::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_commonStats.invalidates;
- _child->invalidate(dl, type);
+ _child->invalidate(txn, dl, type);
}
vector<PlanStage*> GroupStage::getChildren() const {
diff --git a/src/mongo/db/exec/group.h b/src/mongo/db/exec/group.h
index fb713c66d8a..96e06274ab4 100644
--- a/src/mongo/db/exec/group.h
+++ b/src/mongo/db/exec/group.h
@@ -90,7 +90,7 @@ namespace mongo {
virtual bool isEOF();
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/idhack.cpp b/src/mongo/db/exec/idhack.cpp
index 36b326cf10d..261bfeac369 100644
--- a/src/mongo/db/exec/idhack.cpp
+++ b/src/mongo/db/exec/idhack.cpp
@@ -181,7 +181,7 @@ namespace mongo {
++_commonStats.unyields;
}
- void IDHackStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void IDHackStage::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_commonStats.invalidates;
// It's possible that the loc getting invalidated is the one we're about to
diff --git a/src/mongo/db/exec/idhack.h b/src/mongo/db/exec/idhack.h
index ef328213666..a05cfe56365 100644
--- a/src/mongo/db/exec/idhack.h
+++ b/src/mongo/db/exec/idhack.h
@@ -55,7 +55,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
/**
* ID Hack has a very strict criteria for the queries it supports.
diff --git a/src/mongo/db/exec/index_scan.cpp b/src/mongo/db/exec/index_scan.cpp
index 98b58bcb54a..b6cb55d54d9 100644
--- a/src/mongo/db/exec/index_scan.cpp
+++ b/src/mongo/db/exec/index_scan.cpp
@@ -276,7 +276,7 @@ namespace mongo {
}
}
- void IndexScan::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void IndexScan::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_commonStats.invalidates;
// The only state we're responsible for holding is what DiskLocs to drop. If a document
diff --git a/src/mongo/db/exec/index_scan.h b/src/mongo/db/exec/index_scan.h
index 4121010d3f4..771982ea3b0 100644
--- a/src/mongo/db/exec/index_scan.h
+++ b/src/mongo/db/exec/index_scan.h
@@ -110,7 +110,7 @@ namespace mongo {
virtual bool isEOF();
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/keep_mutations.cpp b/src/mongo/db/exec/keep_mutations.cpp
index 01f877a58e8..025e1ee5e27 100644
--- a/src/mongo/db/exec/keep_mutations.cpp
+++ b/src/mongo/db/exec/keep_mutations.cpp
@@ -124,9 +124,11 @@ namespace mongo {
_child->restoreState(opCtx);
}
- void KeepMutationsStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void KeepMutationsStage::invalidate(OperationContext* txn,
+ const DiskLoc& dl,
+ InvalidationType type) {
++_commonStats.invalidates;
- _child->invalidate(dl, type);
+ _child->invalidate(txn, dl, type);
}
vector<PlanStage*> KeepMutationsStage::getChildren() const {
diff --git a/src/mongo/db/exec/keep_mutations.h b/src/mongo/db/exec/keep_mutations.h
index 25dff6a0b0f..735f8738d99 100644
--- a/src/mongo/db/exec/keep_mutations.h
+++ b/src/mongo/db/exec/keep_mutations.h
@@ -53,7 +53,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/limit.cpp b/src/mongo/db/exec/limit.cpp
index 6d9e0d87e9a..b92cb45b548 100644
--- a/src/mongo/db/exec/limit.cpp
+++ b/src/mongo/db/exec/limit.cpp
@@ -98,9 +98,9 @@ namespace mongo {
_child->restoreState(opCtx);
}
- void LimitStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void LimitStage::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_commonStats.invalidates;
- _child->invalidate(dl, type);
+ _child->invalidate(txn, dl, type);
}
vector<PlanStage*> LimitStage::getChildren() const {
diff --git a/src/mongo/db/exec/limit.h b/src/mongo/db/exec/limit.h
index b0068d46b6e..6d0936e412b 100644
--- a/src/mongo/db/exec/limit.h
+++ b/src/mongo/db/exec/limit.h
@@ -51,7 +51,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/merge_sort.cpp b/src/mongo/db/exec/merge_sort.cpp
index 6c39f2f3615..f30991aeaba 100644
--- a/src/mongo/db/exec/merge_sort.cpp
+++ b/src/mongo/db/exec/merge_sort.cpp
@@ -38,12 +38,10 @@ namespace mongo {
// static
const char* MergeSortStage::kStageType = "SORT_MERGE";
- MergeSortStage::MergeSortStage(OperationContext* txn,
- const MergeSortStageParams& params,
+ MergeSortStage::MergeSortStage(const MergeSortStageParams& params,
WorkingSet* ws,
const Collection* collection)
- : _txn(txn),
- _collection(collection),
+ : _collection(collection),
_ws(ws),
_pattern(params.pattern),
_dedup(params.dedup),
@@ -198,17 +196,18 @@ namespace mongo {
}
void MergeSortStage::restoreState(OperationContext* opCtx) {
- _txn = opCtx;
++_commonStats.unyields;
for (size_t i = 0; i < _children.size(); ++i) {
_children[i]->restoreState(opCtx);
}
}
- void MergeSortStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void MergeSortStage::invalidate(OperationContext* txn,
+ const DiskLoc& dl,
+ InvalidationType type) {
++_commonStats.invalidates;
for (size_t i = 0; i < _children.size(); ++i) {
- _children[i]->invalidate(dl, type);
+ _children[i]->invalidate(txn, dl, type);
}
// Go through our data and see if we're holding on to the invalidated loc.
@@ -216,7 +215,7 @@ namespace mongo {
WorkingSetMember* member = _ws->get(valueIt->id);
if (member->hasLoc() && (dl == member->loc)) {
// Force a fetch and flag. We could possibly merge this result back in later.
- WorkingSetCommon::fetchAndInvalidateLoc(_txn, member, _collection);
+ WorkingSetCommon::fetchAndInvalidateLoc(txn, member, _collection);
_ws->flagForReview(valueIt->id);
++_specificStats.forcedFetches;
}
diff --git a/src/mongo/db/exec/merge_sort.h b/src/mongo/db/exec/merge_sort.h
index 55d7a08660b..f27958365ee 100644
--- a/src/mongo/db/exec/merge_sort.h
+++ b/src/mongo/db/exec/merge_sort.h
@@ -55,8 +55,7 @@ namespace mongo {
*/
class MergeSortStage : public PlanStage {
public:
- MergeSortStage(OperationContext* txn,
- const MergeSortStageParams& params,
+ MergeSortStage(const MergeSortStageParams& params,
WorkingSet* ws,
const Collection* collection);
virtual ~MergeSortStage();
@@ -68,7 +67,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
@@ -84,7 +83,6 @@ namespace mongo {
private:
// Not owned by us.
- OperationContext* _txn;
const Collection* _collection;
// Not owned by us.
diff --git a/src/mongo/db/exec/mock_stage.cpp b/src/mongo/db/exec/mock_stage.cpp
index 89d78e39445..e95680bd2cd 100644
--- a/src/mongo/db/exec/mock_stage.cpp
+++ b/src/mongo/db/exec/mock_stage.cpp
@@ -72,7 +72,7 @@ namespace mongo {
++_commonStats.unyields;
}
- void MockStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void MockStage::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_commonStats.invalidates;
}
diff --git a/src/mongo/db/exec/mock_stage.h b/src/mongo/db/exec/mock_stage.h
index 38bbc4ca4ac..f3347c84d9a 100644
--- a/src/mongo/db/exec/mock_stage.h
+++ b/src/mongo/db/exec/mock_stage.h
@@ -60,7 +60,7 @@ namespace mongo {
// have correct yielding behavior.
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/mock_stage_test.cpp b/src/mongo/db/exec/mock_stage_test.cpp
index ceb7c5215ff..8a3c3b07d24 100644
--- a/src/mongo/db/exec/mock_stage_test.cpp
+++ b/src/mongo/db/exec/mock_stage_test.cpp
@@ -94,7 +94,7 @@ namespace {
// invalidates
const DiskLoc dl(0, 0);
- mock->invalidate(dl, INVALIDATION_MUTATION);
+ mock->invalidate(NULL, dl, INVALIDATION_MUTATION);
ASSERT_EQUALS(stats->invalidates, 1U);
// and now we are d1U, but must trigger EOF with getStats()
diff --git a/src/mongo/db/exec/multi_iterator.cpp b/src/mongo/db/exec/multi_iterator.cpp
index ea81e984512..fa3d10fbbb8 100644
--- a/src/mongo/db/exec/multi_iterator.cpp
+++ b/src/mongo/db/exec/multi_iterator.cpp
@@ -110,7 +110,9 @@ namespace mongo {
}
}
- void MultiIteratorStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void MultiIteratorStage::invalidate(OperationContext* txn,
+ const DiskLoc& dl,
+ InvalidationType type) {
switch ( type ) {
case INVALIDATION_DELETION:
for (size_t i = 0; i < _iterators.size(); i++) {
diff --git a/src/mongo/db/exec/multi_iterator.h b/src/mongo/db/exec/multi_iterator.h
index ba2aab31665..343c8c23cc5 100644
--- a/src/mongo/db/exec/multi_iterator.h
+++ b/src/mongo/db/exec/multi_iterator.h
@@ -62,7 +62,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
//
// These should not be used.
diff --git a/src/mongo/db/exec/multi_plan.cpp b/src/mongo/db/exec/multi_plan.cpp
index 43686fe1116..04488cfdec3 100644
--- a/src/mongo/db/exec/multi_plan.cpp
+++ b/src/mongo/db/exec/multi_plan.cpp
@@ -445,23 +445,25 @@ namespace mongo {
}
}
- void MultiPlanStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void MultiPlanStage::invalidate(OperationContext* txn,
+ const DiskLoc& dl,
+ InvalidationType type) {
if (_failure) { return; }
if (bestPlanChosen()) {
CandidatePlan& bestPlan = _candidates[_bestPlanIdx];
- bestPlan.root->invalidate(dl, type);
- invalidateHelper(_txn, bestPlan.ws, dl, &bestPlan.results, _collection);
+ bestPlan.root->invalidate(txn, dl, type);
+ invalidateHelper(txn, bestPlan.ws, dl, &bestPlan.results, _collection);
if (hasBackupPlan()) {
CandidatePlan& backupPlan = _candidates[_backupPlanIdx];
- backupPlan.root->invalidate(dl, type);
- invalidateHelper(_txn, backupPlan.ws, dl, &backupPlan.results, _collection);
+ backupPlan.root->invalidate(txn, dl, type);
+ invalidateHelper(txn, backupPlan.ws, dl, &backupPlan.results, _collection);
}
}
else {
for (size_t ix = 0; ix < _candidates.size(); ++ix) {
- _candidates[ix].root->invalidate(dl, type);
- invalidateHelper(_txn, _candidates[ix].ws, dl, &_candidates[ix].results, _collection);
+ _candidates[ix].root->invalidate(txn, dl, type);
+ invalidateHelper(txn, _candidates[ix].ws, dl, &_candidates[ix].results, _collection);
}
}
}
diff --git a/src/mongo/db/exec/multi_plan.h b/src/mongo/db/exec/multi_plan.h
index a3d2c7839d7..97da7eee427 100644
--- a/src/mongo/db/exec/multi_plan.h
+++ b/src/mongo/db/exec/multi_plan.h
@@ -63,7 +63,7 @@ namespace mongo {
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/near.cpp b/src/mongo/db/exec/near.cpp
index a8050e7e89f..52e4c5858e4 100644
--- a/src/mongo/db/exec/near.cpp
+++ b/src/mongo/db/exec/near.cpp
@@ -317,10 +317,10 @@ namespace mongo {
}
}
- void NearStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void NearStage::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_stats->common.invalidates;
for (size_t i = 0; i < _childrenIntervals.size(); i++) {
- _childrenIntervals[i]->covering->invalidate(dl, type);
+ _childrenIntervals[i]->covering->invalidate(txn, dl, type);
}
// If a result is in _resultBuffer and has a DiskLoc it will be in _nextIntervalSeen as
@@ -332,7 +332,7 @@ namespace mongo {
WorkingSetMember* member = _workingSet->get(seenIt->second);
verify(member->hasLoc());
- WorkingSetCommon::fetchAndInvalidateLoc(_txn, member, _collection);
+ WorkingSetCommon::fetchAndInvalidateLoc(txn, member, _collection);
verify(!member->hasLoc());
// Don't keep it around in the seen map since there's no valid DiskLoc anymore
diff --git a/src/mongo/db/exec/near.h b/src/mongo/db/exec/near.h
index fbb2a6d9cd0..4edc3dfc8f5 100644
--- a/src/mongo/db/exec/near.h
+++ b/src/mongo/db/exec/near.h
@@ -85,7 +85,7 @@ namespace mongo {
virtual void saveState();
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;
diff --git a/src/mongo/db/exec/oplogstart.cpp b/src/mongo/db/exec/oplogstart.cpp
index 053ff806dde..5d33bd4f4ba 100644
--- a/src/mongo/db/exec/oplogstart.cpp
+++ b/src/mongo/db/exec/oplogstart.cpp
@@ -141,13 +141,13 @@ namespace mongo {
bool OplogStart::isEOF() { return _done; }
- void OplogStart::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void OplogStart::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
if (_needInit) { return; }
if (INVALIDATION_DELETION != type) { return; }
if (_cs) {
- _cs->invalidate(dl, type);
+ _cs->invalidate(txn, dl, type);
}
for (size_t i = 0; i < _subIterators.size(); i++) {
diff --git a/src/mongo/db/exec/oplogstart.h b/src/mongo/db/exec/oplogstart.h
index 17ae3f1d02c..a04e8a940f8 100644
--- a/src/mongo/db/exec/oplogstart.h
+++ b/src/mongo/db/exec/oplogstart.h
@@ -69,7 +69,7 @@ namespace mongo {
virtual StageState work(WorkingSetID* out);
virtual bool isEOF();
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
diff --git a/src/mongo/db/exec/or.cpp b/src/mongo/db/exec/or.cpp
index 94b59f40c1e..e115edbbef0 100644
--- a/src/mongo/db/exec/or.cpp
+++ b/src/mongo/db/exec/or.cpp
@@ -155,13 +155,13 @@ namespace mongo {
}
}
- void OrStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void OrStage::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_commonStats.invalidates;
if (isEOF()) { return; }
for (size_t i = 0; i < _children.size(); ++i) {
- _children[i]->invalidate(dl, type);
+ _children[i]->invalidate(txn, dl, type);
}
// If we see DL again it is not the same record as it once was so we still want to
diff --git a/src/mongo/db/exec/or.h b/src/mongo/db/exec/or.h
index 8c15e8b04dc..71272a3c95f 100644
--- a/src/mongo/db/exec/or.h
+++ b/src/mongo/db/exec/or.h
@@ -56,7 +56,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/pipeline_proxy.cpp b/src/mongo/db/exec/pipeline_proxy.cpp
index 0bb97680c2f..dce1651015f 100644
--- a/src/mongo/db/exec/pipeline_proxy.cpp
+++ b/src/mongo/db/exec/pipeline_proxy.cpp
@@ -81,10 +81,12 @@ namespace mongo {
return true;
}
- void PipelineProxyStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void PipelineProxyStage::invalidate(OperationContext* txn,
+ const DiskLoc& dl,
+ InvalidationType type) {
// propagate to child executor if still in use
if (boost::shared_ptr<PlanExecutor> exec = _childExec.lock()) {
- exec->invalidate(dl, type);
+ exec->invalidate(txn, dl, type);
}
}
diff --git a/src/mongo/db/exec/pipeline_proxy.h b/src/mongo/db/exec/pipeline_proxy.h
index 84e61a862ba..4427166e419 100644
--- a/src/mongo/db/exec/pipeline_proxy.h
+++ b/src/mongo/db/exec/pipeline_proxy.h
@@ -52,7 +52,7 @@ namespace mongo {
virtual bool isEOF();
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
//
// Manage our OperationContext. We intentionally don't propagate to the child
diff --git a/src/mongo/db/exec/plan_stage.h b/src/mongo/db/exec/plan_stage.h
index a135a4b1414..71432c06efa 100644
--- a/src/mongo/db/exec/plan_stage.h
+++ b/src/mongo/db/exec/plan_stage.h
@@ -201,9 +201,6 @@ namespace mongo {
* any saved state and be ready to handle calls to work().
*
* Can only be called after saveState.
- *
- * XXX: We may not need to pass down 'opCtx' if getMore'd queries use the same
- * OperationContext they were created with.
*/
virtual void restoreState(OperationContext* opCtx) = 0;
@@ -214,7 +211,9 @@ namespace mongo {
*
* Can only be called after a saveState but before a restoreState.
*/
- virtual void invalidate(const DiskLoc& dl, InvalidationType type) = 0;
+ virtual void invalidate(OperationContext* txn,
+ const DiskLoc& dl,
+ InvalidationType type) = 0;
/**
* Retrieve a list of this stage's children. This stage keeps ownership of
diff --git a/src/mongo/db/exec/projection.cpp b/src/mongo/db/exec/projection.cpp
index d32e80e005a..2ab07c40843 100644
--- a/src/mongo/db/exec/projection.cpp
+++ b/src/mongo/db/exec/projection.cpp
@@ -256,9 +256,11 @@ namespace mongo {
_child->restoreState(opCtx);
}
- void ProjectionStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void ProjectionStage::invalidate(OperationContext* txn,
+ const DiskLoc& dl,
+ InvalidationType type) {
++_commonStats.invalidates;
- _child->invalidate(dl, type);
+ _child->invalidate(txn, dl, type);
}
vector<PlanStage*> ProjectionStage::getChildren() const {
diff --git a/src/mongo/db/exec/projection.h b/src/mongo/db/exec/projection.h
index 51037d1b3b1..41b000ef482 100644
--- a/src/mongo/db/exec/projection.h
+++ b/src/mongo/db/exec/projection.h
@@ -85,7 +85,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/shard_filter.cpp b/src/mongo/db/exec/shard_filter.cpp
index 3ce8eff00c7..4dc828b1a58 100644
--- a/src/mongo/db/exec/shard_filter.cpp
+++ b/src/mongo/db/exec/shard_filter.cpp
@@ -131,9 +131,11 @@ namespace mongo {
_child->restoreState(opCtx);
}
- void ShardFilterStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void ShardFilterStage::invalidate(OperationContext* txn,
+ const DiskLoc& dl,
+ InvalidationType type) {
++_commonStats.invalidates;
- _child->invalidate(dl, type);
+ _child->invalidate(txn, dl, type);
}
vector<PlanStage*> ShardFilterStage::getChildren() const {
diff --git a/src/mongo/db/exec/shard_filter.h b/src/mongo/db/exec/shard_filter.h
index 556732d0715..0125c4343c1 100644
--- a/src/mongo/db/exec/shard_filter.h
+++ b/src/mongo/db/exec/shard_filter.h
@@ -81,7 +81,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/skip.cpp b/src/mongo/db/exec/skip.cpp
index 1439f530045..d16801adf36 100644
--- a/src/mongo/db/exec/skip.cpp
+++ b/src/mongo/db/exec/skip.cpp
@@ -101,9 +101,9 @@ namespace mongo {
_child->restoreState(opCtx);
}
- void SkipStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void SkipStage::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_commonStats.invalidates;
- _child->invalidate(dl, type);
+ _child->invalidate(txn, dl, type);
}
vector<PlanStage*> SkipStage::getChildren() const {
diff --git a/src/mongo/db/exec/skip.h b/src/mongo/db/exec/skip.h
index 41be7286e72..785697088b4 100644
--- a/src/mongo/db/exec/skip.h
+++ b/src/mongo/db/exec/skip.h
@@ -50,7 +50,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/sort.cpp b/src/mongo/db/exec/sort.cpp
index 6dea39ec8f2..2105c370fcf 100644
--- a/src/mongo/db/exec/sort.cpp
+++ b/src/mongo/db/exec/sort.cpp
@@ -280,12 +280,10 @@ namespace mongo {
return lhs.loc < rhs.loc;
}
- SortStage::SortStage(OperationContext* txn,
- const SortStageParams& params,
+ SortStage::SortStage(const SortStageParams& params,
WorkingSet* ws,
PlanStage* child)
- : _txn(txn),
- _collection(params.collection),
+ : _collection(params.collection),
_ws(ws),
_child(child),
_pattern(params.pattern),
@@ -429,14 +427,13 @@ namespace mongo {
}
void SortStage::restoreState(OperationContext* opCtx) {
- _txn = opCtx;
++_commonStats.unyields;
_child->restoreState(opCtx);
}
- void SortStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void SortStage::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_commonStats.invalidates;
- _child->invalidate(dl, type);
+ _child->invalidate(txn, dl, type);
// If we have a deletion, we can fetch and carry on.
// If we have a mutation, it's easier to fetch and use the previous document.
@@ -453,7 +450,7 @@ namespace mongo {
WorkingSetMember* member = _ws->get(it->second);
verify(member->loc == dl);
- WorkingSetCommon::fetchAndInvalidateLoc(_txn, member, _collection);
+ WorkingSetCommon::fetchAndInvalidateLoc(txn, member, _collection);
// Remove the DiskLoc from our set of active DLs.
_wsidByDiskLoc.erase(it);
diff --git a/src/mongo/db/exec/sort.h b/src/mongo/db/exec/sort.h
index 9a10ced5c2a..601f8d0e85e 100644
--- a/src/mongo/db/exec/sort.h
+++ b/src/mongo/db/exec/sort.h
@@ -142,8 +142,7 @@ namespace mongo {
*/
class SortStage : public PlanStage {
public:
- SortStage(OperationContext* txn,
- const SortStageParams& params,
+ SortStage(const SortStageParams& params,
WorkingSet* ws,
PlanStage* child);
@@ -154,7 +153,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
@@ -175,7 +174,6 @@ namespace mongo {
//
// Not owned by us.
- OperationContext* _txn;
const Collection* _collection;
// Not owned by us.
diff --git a/src/mongo/db/exec/sort_test.cpp b/src/mongo/db/exec/sort_test.cpp
index 61afd9f9e9c..c890fb4dd15 100644
--- a/src/mongo/db/exec/sort_test.cpp
+++ b/src/mongo/db/exec/sort_test.cpp
@@ -47,7 +47,7 @@ namespace {
// MockStage will be owned by SortStage.
MockStage* ms = new MockStage(&ws);
SortStageParams params;
- SortStage sort(NULL, params, &ws, ms);
+ SortStage sort(params, &ws, ms);
// Check initial EOF state.
ASSERT_TRUE(ms->isEOF());
@@ -109,7 +109,7 @@ namespace {
params.query = fromjson(queryStr);
params.limit = limit;
- SortStage sort(NULL, params, &ws, ms);
+ SortStage sort(params, &ws, ms);
WorkingSetID id = WorkingSet::INVALID_ID;
PlanStage::StageState state = PlanStage::NEED_TIME;
diff --git a/src/mongo/db/exec/stagedebug_cmd.cpp b/src/mongo/db/exec/stagedebug_cmd.cpp
index e39024a5205..493b28cb567 100644
--- a/src/mongo/db/exec/stagedebug_cmd.cpp
+++ b/src/mongo/db/exec/stagedebug_cmd.cpp
@@ -228,7 +228,7 @@ namespace mongo {
uassert(16921, "Nodes argument must be provided to AND",
nodeArgs["nodes"].isABSONObj());
- auto_ptr<AndHashStage> andStage(new AndHashStage(txn, workingSet, matcher, collection));
+ auto_ptr<AndHashStage> andStage(new AndHashStage(workingSet, matcher, collection));
int nodesAdded = 0;
BSONObjIterator it(nodeArgs["nodes"].Obj());
@@ -253,8 +253,8 @@ namespace mongo {
uassert(16924, "Nodes argument must be provided to AND",
nodeArgs["nodes"].isABSONObj());
- auto_ptr<AndSortedStage> andStage(new AndSortedStage(txn, workingSet,
- matcher, collection));
+ auto_ptr<AndSortedStage> andStage(new AndSortedStage(workingSet, matcher,
+ collection));
int nodesAdded = 0;
BSONObjIterator it(nodeArgs["nodes"].Obj());
@@ -372,8 +372,8 @@ namespace mongo {
params.pattern = nodeArgs["pattern"].Obj();
// Dedup is true by default.
- auto_ptr<MergeSortStage> mergeStage(new MergeSortStage(txn, params,
- workingSet, collection));
+ auto_ptr<MergeSortStage> mergeStage(new MergeSortStage(params, workingSet,
+ collection));
BSONObjIterator it(nodeArgs["nodes"].Obj());
while (it.more()) {
diff --git a/src/mongo/db/exec/subplan.cpp b/src/mongo/db/exec/subplan.cpp
index eb834239d24..a8d27dd3faf 100644
--- a/src/mongo/db/exec/subplan.cpp
+++ b/src/mongo/db/exec/subplan.cpp
@@ -516,14 +516,14 @@ namespace mongo {
}
}
- void SubplanStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void SubplanStage::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_commonStats.invalidates;
if (_killed) {
return;
}
if (NULL != _child.get()) {
- _child->invalidate(dl, type);
+ _child->invalidate(txn, dl, type);
}
}
diff --git a/src/mongo/db/exec/subplan.h b/src/mongo/db/exec/subplan.h
index 15c81c7f62f..106464d1e58 100644
--- a/src/mongo/db/exec/subplan.h
+++ b/src/mongo/db/exec/subplan.h
@@ -67,7 +67,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/text.cpp b/src/mongo/db/exec/text.cpp
index a3cfae5c336..60441eb2a81 100644
--- a/src/mongo/db/exec/text.cpp
+++ b/src/mongo/db/exec/text.cpp
@@ -125,12 +125,12 @@ namespace mongo {
}
}
- void TextStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void TextStage::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_commonStats.invalidates;
// Propagate invalidate to children.
for (size_t i = 0; i < _scanners.size(); ++i) {
- _scanners.mutableVector()[i]->invalidate(dl, type);
+ _scanners.mutableVector()[i]->invalidate(txn, dl, type);
}
// We store the score keyed by DiskLoc. We have to toss out our state when the DiskLoc
diff --git a/src/mongo/db/exec/text.h b/src/mongo/db/exec/text.h
index 15d2be2d0cb..8ef53bd680c 100644
--- a/src/mongo/db/exec/text.h
+++ b/src/mongo/db/exec/text.h
@@ -110,7 +110,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/exec/update.cpp b/src/mongo/db/exec/update.cpp
index fab80fe18d8..5cdc0e9aeba 100644
--- a/src/mongo/db/exec/update.cpp
+++ b/src/mongo/db/exec/update.cpp
@@ -856,9 +856,9 @@ namespace mongo {
uassertStatusOK(restoreUpdateState(opCtx));
}
- void UpdateStage::invalidate(const DiskLoc& dl, InvalidationType type) {
+ void UpdateStage::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
++_commonStats.invalidates;
- _child->invalidate(dl, type);
+ _child->invalidate(txn, dl, type);
}
vector<PlanStage*> UpdateStage::getChildren() const {
diff --git a/src/mongo/db/exec/update.h b/src/mongo/db/exec/update.h
index 99345279c01..8fd8fc3df2d 100644
--- a/src/mongo/db/exec/update.h
+++ b/src/mongo/db/exec/update.h
@@ -87,7 +87,7 @@ namespace mongo {
virtual void saveState();
virtual void restoreState(OperationContext* opCtx);
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
virtual std::vector<PlanStage*> getChildren() const;
diff --git a/src/mongo/db/query/plan_executor.cpp b/src/mongo/db/query/plan_executor.cpp
index 7863d53964f..3a46d47a9ce 100644
--- a/src/mongo/db/query/plan_executor.cpp
+++ b/src/mongo/db/query/plan_executor.cpp
@@ -251,8 +251,8 @@ namespace mongo {
return !_killed;
}
- void PlanExecutor::invalidate(const DiskLoc& dl, InvalidationType type) {
- if (!_killed) { _root->invalidate(dl, type); }
+ void PlanExecutor::invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type) {
+ if (!_killed) { _root->invalidate(txn, dl, type); }
}
PlanExecutor::ExecState PlanExecutor::getNext(BSONObj* objOut, DiskLoc* dlOut) {
diff --git a/src/mongo/db/query/plan_executor.h b/src/mongo/db/query/plan_executor.h
index 40bb3787dba..50a11c0d2f8 100644
--- a/src/mongo/db/query/plan_executor.h
+++ b/src/mongo/db/query/plan_executor.h
@@ -296,7 +296,7 @@ namespace mongo {
* state. As such, if the plan yields, it must be notified of relevant writes so that
* we can ensure that it doesn't crash if we try to access invalid state.
*/
- void invalidate(const DiskLoc& dl, InvalidationType type);
+ void invalidate(OperationContext* txn, const DiskLoc& dl, InvalidationType type);
/**
* Helper method to aid in displaying an ExecState for debug or other recreational purposes.
diff --git a/src/mongo/db/query/stage_builder.cpp b/src/mongo/db/query/stage_builder.cpp
index e097f5ab7f4..549a8f461d9 100644
--- a/src/mongo/db/query/stage_builder.cpp
+++ b/src/mongo/db/query/stage_builder.cpp
@@ -109,7 +109,7 @@ namespace mongo {
params.pattern = sn->pattern;
params.query = sn->query;
params.limit = sn->limit;
- return new SortStage(txn, params, ws, childStage);
+ return new SortStage(params, ws, childStage);
}
else if (STAGE_PROJECTION == root->getType()) {
const ProjectionNode* pn = static_cast<const ProjectionNode*>(root);
@@ -150,7 +150,7 @@ namespace mongo {
}
else if (STAGE_AND_HASH == root->getType()) {
const AndHashNode* ahn = static_cast<const AndHashNode*>(root);
- auto_ptr<AndHashStage> ret(new AndHashStage(txn, ws, ahn->filter.get(), collection));
+ auto_ptr<AndHashStage> ret(new AndHashStage(ws, ahn->filter.get(), collection));
for (size_t i = 0; i < ahn->children.size(); ++i) {
PlanStage* childStage = buildStages(txn, collection, qsol, ahn->children[i], ws);
if (NULL == childStage) { return NULL; }
@@ -170,7 +170,7 @@ namespace mongo {
}
else if (STAGE_AND_SORTED == root->getType()) {
const AndSortedNode* asn = static_cast<const AndSortedNode*>(root);
- auto_ptr<AndSortedStage> ret(new AndSortedStage(txn, ws, asn->filter.get(), collection));
+ auto_ptr<AndSortedStage> ret(new AndSortedStage(ws, asn->filter.get(), collection));
for (size_t i = 0; i < asn->children.size(); ++i) {
PlanStage* childStage = buildStages(txn, collection, qsol, asn->children[i], ws);
if (NULL == childStage) { return NULL; }
@@ -183,7 +183,7 @@ namespace mongo {
MergeSortStageParams params;
params.dedup = msn->dedup;
params.pattern = msn->sort;
- auto_ptr<MergeSortStage> ret(new MergeSortStage(txn, params, ws, collection));
+ auto_ptr<MergeSortStage> ret(new MergeSortStage(params, ws, collection));
for (size_t i = 0; i < msn->children.size(); ++i) {
PlanStage* childStage = buildStages(txn, collection, qsol, msn->children[i], ws);
if (NULL == childStage) { return NULL; }
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);
diff --git a/src/mongo/s/d_migrate.cpp b/src/mongo/s/d_migrate.cpp
index 34c303ab6ad..528f57764d8 100644
--- a/src/mongo/s/d_migrate.cpp
+++ b/src/mongo/s/d_migrate.cpp
@@ -695,7 +695,9 @@ namespace mongo {
*/
class DeleteNotificationStage : public PlanStage {
public:
- virtual void invalidate(const DiskLoc& dl, InvalidationType type);
+ virtual void invalidate(OperationContext* txn,
+ const DiskLoc& dl,
+ InvalidationType type);
virtual StageState work(WorkingSetID* out) {
invariant( false );
@@ -737,7 +739,8 @@ namespace mongo {
} migrateFromStatus;
- void MigrateFromStatus::DeleteNotificationStage::invalidate(const DiskLoc& dl,
+ void MigrateFromStatus::DeleteNotificationStage::invalidate(OperationContext *txn,
+ const DiskLoc& dl,
InvalidationType type) {
if ( type == INVALIDATION_DELETION ) {
migrateFromStatus.aboutToDelete( dl );