diff options
author | David Storch <david.storch@10gen.com> | 2014-10-21 10:24:24 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2014-10-21 10:32:59 -0400 |
commit | 011dde7e6eac3b73cb1d2a7f004feee9bed99c46 (patch) | |
tree | 32b20bc3224627c93e5781ba72abb45a1f825b37 /src/mongo/db/commands/parallel_collection_scan.cpp | |
parent | 0bee61d26e44e26c2678d550990a57ce488f222d (diff) | |
download | mongo-011dde7e6eac3b73cb1d2a7f004feee9bed99c46.tar.gz |
SERVER-15541 SERVER-15652 implement timing-based yielding
Diffstat (limited to 'src/mongo/db/commands/parallel_collection_scan.cpp')
-rw-r--r-- | src/mongo/db/commands/parallel_collection_scan.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/mongo/db/commands/parallel_collection_scan.cpp b/src/mongo/db/commands/parallel_collection_scan.cpp index a8f65aa63f9..2f4c8fe34d3 100644 --- a/src/mongo/db/commands/parallel_collection_scan.cpp +++ b/src/mongo/db/commands/parallel_collection_scan.cpp @@ -102,13 +102,17 @@ namespace mongo { for ( size_t i = 0; i < numCursors; i++ ) { WorkingSet* ws = new WorkingSet(); MultiIteratorStage* mis = new MultiIteratorStage(txn, ws, collection); - // Takes ownership of 'ws' and 'mis'. - auto_ptr<PlanExecutor> curExec(new PlanExecutor(txn, ws, mis, collection)); - // Each of the plan executors should yield automatically. We pass "false" to - // indicate that 'curExec' should not register itself, as it will get registered - // by ClientCursor instead. - curExec->setYieldPolicy(PlanExecutor::YIELD_AUTO, false); + PlanExecutor* rawExec; + // Takes ownership of 'ws' and 'mis'. + Status execStatus = PlanExecutor::make(txn, ws, mis, collection, + PlanExecutor::YIELD_AUTO, &rawExec); + invariant(execStatus.isOK()); + auto_ptr<PlanExecutor> curExec(rawExec); + + // The PlanExecutor was registered on construction due to the YIELD_AUTO policy. + // We have to deregister it, as it will be registered with ClientCursor. + curExec->deregisterExec(); // Need to save state while yielding locks between now and newGetMore. curExec->saveState(); |