summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/parallel_collection_scan.cpp
diff options
context:
space:
mode:
authorQingyang Chen <qingyang.chen@10gen.com>2015-06-19 17:20:36 -0400
committerQingyang Chen <qingyang.chen@10gen.com>2015-06-26 10:10:34 -0400
commit159f54fcb550d6ff660efd2832ac5ae8b6fced56 (patch)
tree2b6ac085b3375ce151d92fa1db9b4a38d92da25f /src/mongo/db/commands/parallel_collection_scan.cpp
parent2931e33f4d6efb3aa176eaa951be6c91abce2b43 (diff)
downloadmongo-159f54fcb550d6ff660efd2832ac5ae8b6fced56.tar.gz
SERVER-16889 Modernize getExecutor*(), PlanExecutor::make() signatures
Diffstat (limited to 'src/mongo/db/commands/parallel_collection_scan.cpp')
-rw-r--r--src/mongo/db/commands/parallel_collection_scan.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/mongo/db/commands/parallel_collection_scan.cpp b/src/mongo/db/commands/parallel_collection_scan.cpp
index 33e24b6648e..db4dc3f0170 100644
--- a/src/mongo/db/commands/parallel_collection_scan.cpp
+++ b/src/mongo/db/commands/parallel_collection_scan.cpp
@@ -37,12 +37,14 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/multi_iterator.h"
#include "mongo/db/query/cursor_responses.h"
+#include "mongo/stdx/memory.h"
#include "mongo/util/touch_pages.h"
namespace mongo {
using std::unique_ptr;
using std::string;
+using stdx::make_unique;
class ParallelCollectionScanCmd : public Command {
public:
@@ -106,15 +108,15 @@ public:
OwnedPointerVector<PlanExecutor> execs;
for (size_t i = 0; i < numCursors; i++) {
- WorkingSet* ws = new WorkingSet();
- MultiIteratorStage* mis = new MultiIteratorStage(txn, ws, collection);
+ unique_ptr<WorkingSet> ws = make_unique<WorkingSet>();
+ unique_ptr<MultiIteratorStage> mis =
+ make_unique<MultiIteratorStage>(txn, ws.get(), collection);
- PlanExecutor* rawExec;
// Takes ownership of 'ws' and 'mis'.
- Status execStatus =
- PlanExecutor::make(txn, ws, mis, collection, PlanExecutor::YIELD_AUTO, &rawExec);
- invariant(execStatus.isOK());
- unique_ptr<PlanExecutor> curExec(rawExec);
+ auto statusWithPlanExecutor = PlanExecutor::make(
+ txn, std::move(ws), std::move(mis), collection, PlanExecutor::YIELD_AUTO);
+ invariant(statusWithPlanExecutor.isOK());
+ unique_ptr<PlanExecutor> curExec = std::move(statusWithPlanExecutor.getValue());
// The PlanExecutor was registered on construction due to the YIELD_AUTO policy.
// We have to deregister it, as it will be registered with ClientCursor.