summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/idhack.cpp
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2015-06-22 16:37:08 -0400
committerDavid Storch <david.storch@10gen.com>2015-07-01 14:42:17 -0400
commit820289c3c4244666e1829732150d842af775e56d (patch)
tree9844ae54f597514bd8fb49b9fe04831ae700770f /src/mongo/db/exec/idhack.cpp
parent4f4e36b69bfd6ea8615e2c0786a4d1dbca502a74 (diff)
downloadmongo-820289c3c4244666e1829732150d842af775e56d.tar.gz
SERVER-18961 avoid iterating the entire working set when preparing for a WiredTiger snapshot change
Improves performance for query plans with a blocking stage when using the WiredTiger storage engine. In particular, full text search and geoNear queries should benefit.
Diffstat (limited to 'src/mongo/db/exec/idhack.cpp')
-rw-r--r--src/mongo/db/exec/idhack.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/db/exec/idhack.cpp b/src/mongo/db/exec/idhack.cpp
index 51346ecfeb3..8e9e290b624 100644
--- a/src/mongo/db/exec/idhack.cpp
+++ b/src/mongo/db/exec/idhack.cpp
@@ -107,10 +107,10 @@ PlanStage::StageState IDHackStage::work(WorkingSetID* out) {
invariant(_recordCursor);
WorkingSetID id = _idBeingPagedIn;
_idBeingPagedIn = WorkingSet::INVALID_ID;
- WorkingSetMember* member = _workingSet->get(id);
- invariant(WorkingSetCommon::fetchIfUnfetched(_txn, member, _recordCursor));
+ invariant(WorkingSetCommon::fetchIfUnfetched(_txn, _workingSet, id, _recordCursor));
+ WorkingSetMember* member = _workingSet->get(id);
return advance(id, member, out);
}
@@ -141,8 +141,8 @@ PlanStage::StageState IDHackStage::work(WorkingSetID* out) {
// Create a new WSM for the result document.
id = _workingSet->allocate();
WorkingSetMember* member = _workingSet->get(id);
- member->state = WorkingSetMember::LOC_AND_IDX;
member->loc = loc;
+ _workingSet->transitionToLocAndIdx(id);
if (!_recordCursor)
_recordCursor = _collection->getCursor(_txn);
@@ -159,7 +159,7 @@ PlanStage::StageState IDHackStage::work(WorkingSetID* out) {
}
// The doc was already in memory, so we go ahead and return it.
- if (!WorkingSetCommon::fetch(_txn, member, _recordCursor)) {
+ if (!WorkingSetCommon::fetch(_txn, _workingSet, id, _recordCursor)) {
// _id is immutable so the index would return the only record that could
// possibly match the query.
_workingSet->free(id);