diff options
author | ADAM David Alan Martin <adam.martin@10gen.com> | 2019-06-10 01:21:01 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2019-06-10 01:59:35 -0400 |
commit | c36f9ecb91e49da7e637863889804fc4e6c6c05e (patch) | |
tree | 64d8aadb6d29042d4f4e7366bc1457e4e0612383 /src/mongo/dbtests | |
parent | c9548e729c8fecd9d7a9a5dd341da0433194ac73 (diff) | |
download | mongo-c36f9ecb91e49da7e637863889804fc4e6c6c05e.tar.gz |
SERVER-39339 Remove `stdx/memory.h`
Diffstat (limited to 'src/mongo/dbtests')
31 files changed, 206 insertions, 200 deletions
diff --git a/src/mongo/dbtests/cursor_manager_test.cpp b/src/mongo/dbtests/cursor_manager_test.cpp index 6a3ebd83cc6..72934d8348a 100644 --- a/src/mongo/dbtests/cursor_manager_test.cpp +++ b/src/mongo/dbtests/cursor_manager_test.cpp @@ -58,9 +58,9 @@ const NamespaceString kTestNss{"test.collection"}; class CursorManagerTest : public unittest::Test { public: CursorManagerTest() - : _queryServiceContext(stdx::make_unique<QueryTestServiceContext>()), + : _queryServiceContext(std::make_unique<QueryTestServiceContext>()), _opCtx(_queryServiceContext->makeOperationContext()) { - _opCtx->getServiceContext()->setPreciseClockSource(stdx::make_unique<ClockSourceMock>()); + _opCtx->getServiceContext()->setPreciseClockSource(std::make_unique<ClockSourceMock>()); _clock = static_cast<ClockSourceMock*>(_opCtx->getServiceContext()->getPreciseClockSource()); } @@ -71,8 +71,8 @@ public: std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> makeFakePlanExecutor( OperationContext* opCtx) { - auto workingSet = stdx::make_unique<WorkingSet>(); - auto queuedDataStage = stdx::make_unique<QueuedDataStage>(opCtx, workingSet.get()); + auto workingSet = std::make_unique<WorkingSet>(); + auto queuedDataStage = std::make_unique<QueuedDataStage>(opCtx, workingSet.get()); return unittest::assertGet(PlanExecutor::make(opCtx, std::move(workingSet), std::move(queuedDataStage), diff --git a/src/mongo/dbtests/dbtests.cpp b/src/mongo/dbtests/dbtests.cpp index 1fefee04e74..c61f4d390b2 100644 --- a/src/mongo/dbtests/dbtests.cpp +++ b/src/mongo/dbtests/dbtests.cpp @@ -35,6 +35,8 @@ #include "mongo/dbtests/dbtests.h" +#include <memory> + #include "mongo/base/init.h" #include "mongo/base/initializer.h" #include "mongo/db/auth/authorization_manager.h" @@ -53,7 +55,6 @@ #include "mongo/db/wire_version.h" #include "mongo/dbtests/framework.h" #include "mongo/scripting/engine.h" -#include "mongo/stdx/memory.h" #include "mongo/transport/transport_layer_manager.h" #include "mongo/util/clock_source_mock.h" #include "mongo/util/quick_exit.h" @@ -179,10 +180,10 @@ int dbtestsMain(int argc, char** argv, char** envp) { const auto service = getGlobalServiceContext(); service->setServiceEntryPoint(std::make_unique<ServiceEntryPointMongod>(service)); - auto logicalClock = stdx::make_unique<LogicalClock>(service); + auto logicalClock = std::make_unique<LogicalClock>(service); LogicalClock::set(service, std::move(logicalClock)); - auto fastClock = stdx::make_unique<ClockSourceMock>(); + auto fastClock = std::make_unique<ClockSourceMock>(); // Timestamps are split into two 32-bit integers, seconds and "increments". Currently (but // maybe not for eternity), a Timestamp with a value of `0` seconds is always considered // "null" by `Timestamp::isNull`, regardless of its increment value. Ticking the @@ -191,7 +192,7 @@ int dbtestsMain(int argc, char** argv, char** envp) { fastClock->advance(Seconds(1)); service->setFastClockSource(std::move(fastClock)); - auto preciseClock = stdx::make_unique<ClockSourceMock>(); + auto preciseClock = std::make_unique<ClockSourceMock>(); // See above. preciseClock->advance(Seconds(1)); service->setPreciseClockSource(std::move(preciseClock)); @@ -207,9 +208,9 @@ int dbtestsMain(int argc, char** argv, char** envp) { ->setFollowerMode(repl::MemberState::RS_PRIMARY) .ignore(); - auto storageMock = stdx::make_unique<repl::StorageInterfaceMock>(); + auto storageMock = std::make_unique<repl::StorageInterfaceMock>(); repl::DropPendingCollectionReaper::set( - service, stdx::make_unique<repl::DropPendingCollectionReaper>(storageMock.get())); + service, std::make_unique<repl::DropPendingCollectionReaper>(storageMock.get())); AuthorizationManager::get(service)->setAuthEnabled(false); ScriptEngine::setup(); diff --git a/src/mongo/dbtests/deferred_writer.cpp b/src/mongo/dbtests/deferred_writer.cpp index 576cd28f6b5..fe3122e5b54 100644 --- a/src/mongo/dbtests/deferred_writer.cpp +++ b/src/mongo/dbtests/deferred_writer.cpp @@ -135,7 +135,7 @@ public: */ RaiiWrapper getWriter(CollectionOptions options = CollectionOptions(), int64_t maxSize = 200'000) { - return RaiiWrapper(stdx::make_unique<DeferredWriter>(kTestNamespace, options, maxSize)); + return RaiiWrapper(std::make_unique<DeferredWriter>(kTestNamespace, options, maxSize)); } virtual void run(void) = 0; diff --git a/src/mongo/dbtests/documentsourcetests.cpp b/src/mongo/dbtests/documentsourcetests.cpp index b35bbda4d32..daba3a54f84 100644 --- a/src/mongo/dbtests/documentsourcetests.cpp +++ b/src/mongo/dbtests/documentsourcetests.cpp @@ -91,7 +91,7 @@ protected: dbtests::WriteContextForTests ctx(opCtx(), nss.ns()); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); if (hint) { qr->setHint(*hint); } @@ -330,14 +330,14 @@ TEST_F(DocumentSourceCursorTest, TailableAwaitDataCursorShouldErrorAfterTimeout) // Make a tailable collection scan wrapped up in a PlanExecutor. AutoGetCollectionForRead readLock(opCtx(), nss); - auto workingSet = stdx::make_unique<WorkingSet>(); + auto workingSet = std::make_unique<WorkingSet>(); CollectionScanParams collScanParams; collScanParams.tailable = true; auto filter = BSON("a" << 1); auto matchExpression = uassertStatusOK(MatchExpressionParser::parse(filter, ctx())); - auto collectionScan = stdx::make_unique<CollectionScan>( + auto collectionScan = std::make_unique<CollectionScan>( opCtx(), readLock.getCollection(), collScanParams, workingSet.get(), matchExpression.get()); - auto queryRequest = stdx::make_unique<QueryRequest>(nss); + auto queryRequest = std::make_unique<QueryRequest>(nss); queryRequest->setFilter(filter); queryRequest->setTailableMode(TailableModeEnum::kTailableAndAwaitData); auto canonicalQuery = unittest::assertGet( @@ -369,13 +369,13 @@ TEST_F(DocumentSourceCursorTest, NonAwaitDataCursorShouldErrorAfterTimeout) { // Make a tailable collection scan wrapped up in a PlanExecutor. AutoGetCollectionForRead readLock(opCtx(), nss); - auto workingSet = stdx::make_unique<WorkingSet>(); + auto workingSet = std::make_unique<WorkingSet>(); CollectionScanParams collScanParams; auto filter = BSON("a" << 1); auto matchExpression = uassertStatusOK(MatchExpressionParser::parse(filter, ctx())); - auto collectionScan = stdx::make_unique<CollectionScan>( + auto collectionScan = std::make_unique<CollectionScan>( opCtx(), readLock.getCollection(), collScanParams, workingSet.get(), matchExpression.get()); - auto queryRequest = stdx::make_unique<QueryRequest>(nss); + auto queryRequest = std::make_unique<QueryRequest>(nss); queryRequest->setFilter(filter); auto canonicalQuery = unittest::assertGet( CanonicalQuery::canonicalize(opCtx(), std::move(queryRequest), nullptr)); @@ -413,14 +413,14 @@ TEST_F(DocumentSourceCursorTest, TailableAwaitDataCursorShouldErrorAfterBeingKil // Make a tailable collection scan wrapped up in a PlanExecutor. AutoGetCollectionForRead readLock(opCtx(), nss); - auto workingSet = stdx::make_unique<WorkingSet>(); + auto workingSet = std::make_unique<WorkingSet>(); CollectionScanParams collScanParams; collScanParams.tailable = true; auto filter = BSON("a" << 1); auto matchExpression = uassertStatusOK(MatchExpressionParser::parse(filter, ctx())); - auto collectionScan = stdx::make_unique<CollectionScan>( + auto collectionScan = std::make_unique<CollectionScan>( opCtx(), readLock.getCollection(), collScanParams, workingSet.get(), matchExpression.get()); - auto queryRequest = stdx::make_unique<QueryRequest>(nss); + auto queryRequest = std::make_unique<QueryRequest>(nss); queryRequest->setFilter(filter); queryRequest->setTailableMode(TailableModeEnum::kTailableAndAwaitData); auto canonicalQuery = unittest::assertGet( @@ -451,13 +451,13 @@ TEST_F(DocumentSourceCursorTest, NormalCursorShouldErrorAfterBeingKilled) { // Make a tailable collection scan wrapped up in a PlanExecutor. AutoGetCollectionForRead readLock(opCtx(), nss); - auto workingSet = stdx::make_unique<WorkingSet>(); + auto workingSet = std::make_unique<WorkingSet>(); CollectionScanParams collScanParams; auto filter = BSON("a" << 1); auto matchExpression = uassertStatusOK(MatchExpressionParser::parse(filter, ctx())); - auto collectionScan = stdx::make_unique<CollectionScan>( + auto collectionScan = std::make_unique<CollectionScan>( opCtx(), readLock.getCollection(), collScanParams, workingSet.get(), matchExpression.get()); - auto queryRequest = stdx::make_unique<QueryRequest>(nss); + auto queryRequest = std::make_unique<QueryRequest>(nss); queryRequest->setFilter(filter); auto canonicalQuery = unittest::assertGet( CanonicalQuery::canonicalize(opCtx(), std::move(queryRequest), nullptr)); diff --git a/src/mongo/dbtests/framework.cpp b/src/mongo/dbtests/framework.cpp index 69760dd428e..f3d0b6f2ebb 100644 --- a/src/mongo/dbtests/framework.cpp +++ b/src/mongo/dbtests/framework.cpp @@ -113,7 +113,7 @@ int runDbTests(int argc, char** argv) { Collection::Factory::set(globalServiceContext, std::make_unique<CollectionImpl::FactoryImpl>()); IndexBuildsCoordinator::set(globalServiceContext, std::make_unique<IndexBuildsCoordinatorMongod>()); - auto registry = stdx::make_unique<OpObserverRegistry>(); + auto registry = std::make_unique<OpObserverRegistry>(); globalServiceContext->setOpObserver(std::move(registry)); int ret = unittest::Suite::run(frameworkGlobalParams.suites, diff --git a/src/mongo/dbtests/logical_sessions_tests.cpp b/src/mongo/dbtests/logical_sessions_tests.cpp index 65625e34ffe..a9da89f05bb 100644 --- a/src/mongo/dbtests/logical_sessions_tests.cpp +++ b/src/mongo/dbtests/logical_sessions_tests.cpp @@ -38,7 +38,6 @@ #include "mongo/db/operation_context.h" #include "mongo/db/sessions_collection_standalone.h" #include "mongo/dbtests/dbtests.h" -#include "mongo/stdx/memory.h" #include "mongo/util/time_support.h" namespace mongo { @@ -87,7 +86,7 @@ StatusWith<LogicalSessionRecord> fetchRecord(OperationContext* opCtx, class SessionsCollectionStandaloneTest { public: SessionsCollectionStandaloneTest() - : _collection(stdx::make_unique<SessionsCollectionStandalone>()) { + : _collection(std::make_unique<SessionsCollectionStandalone>()) { _opCtx = cc().makeOperationContext(); DBDirectClient db(opCtx()); db.remove(ns(), BSONObj()); diff --git a/src/mongo/dbtests/mock/mock_conn_registry.cpp b/src/mongo/dbtests/mock/mock_conn_registry.cpp index 0717e8951aa..9faf584bb10 100644 --- a/src/mongo/dbtests/mock/mock_conn_registry.cpp +++ b/src/mongo/dbtests/mock/mock_conn_registry.cpp @@ -81,7 +81,7 @@ void MockConnRegistry::clear() { std::unique_ptr<MockDBClientConnection> MockConnRegistry::connect(const std::string& connStr) { stdx::lock_guard<stdx::mutex> sl(_registryMutex); fassert(16534, _registry.count(connStr) == 1); - return stdx::make_unique<MockDBClientConnection>(_registry[connStr], true); + return std::make_unique<MockDBClientConnection>(_registry[connStr], true); } MockConnRegistry::MockConnHook::MockConnHook(MockConnRegistry* registry) : _registry(registry) {} diff --git a/src/mongo/dbtests/mock/mock_remote_db_server.cpp b/src/mongo/dbtests/mock/mock_remote_db_server.cpp index 5b6a884ba8d..f1253cc7fd9 100644 --- a/src/mongo/dbtests/mock/mock_remote_db_server.cpp +++ b/src/mongo/dbtests/mock/mock_remote_db_server.cpp @@ -31,12 +31,12 @@ #include "mongo/dbtests/mock/mock_remote_db_server.h" +#include <memory> #include <tuple> #include "mongo/dbtests/mock/mock_dbclient_connection.h" #include "mongo/rpc/metadata.h" #include "mongo/rpc/op_msg_rpc_impls.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/net/socket_exception.h" #include "mongo/util/str.h" @@ -171,7 +171,7 @@ rpc::UniqueReply MockRemoteDBServer::runCommand(InstanceID id, const OpMsgReques // We need to construct a reply message - it will always be read through a view so it // doesn't matter whether we use OpMsgReplyBuilder or LegacyReplyBuilder auto message = rpc::OpMsgReplyBuilder{}.setCommandReply(reply).done(); - auto replyView = stdx::make_unique<rpc::OpMsgReply>(&message); + auto replyView = std::make_unique<rpc::OpMsgReply>(&message); return rpc::UniqueReply(std::move(message), std::move(replyView)); } diff --git a/src/mongo/dbtests/plan_executor_invalidation_test.cpp b/src/mongo/dbtests/plan_executor_invalidation_test.cpp index 5918628d4fc..2cc4eccd7fa 100644 --- a/src/mongo/dbtests/plan_executor_invalidation_test.cpp +++ b/src/mongo/dbtests/plan_executor_invalidation_test.cpp @@ -79,7 +79,7 @@ public: new CollectionScan(&_opCtx, collection(), params, ws.get(), NULL)); // Create a plan executor to hold it - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); auto statusWithCQ = CanonicalQuery::canonicalize(&_opCtx, std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue()); diff --git a/src/mongo/dbtests/plan_ranking.cpp b/src/mongo/dbtests/plan_ranking.cpp index af13d03fb61..9e965b270c3 100644 --- a/src/mongo/dbtests/plan_ranking.cpp +++ b/src/mongo/dbtests/plan_ranking.cpp @@ -34,6 +34,7 @@ #include "mongo/platform/basic.h" #include <iostream> +#include <memory> #include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" @@ -51,7 +52,6 @@ #include "mongo/db/query/query_planner_test_lib.h" #include "mongo/db/query/stage_builder.h" #include "mongo/dbtests/dbtests.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -197,7 +197,7 @@ public: // Run the query {a:4, b:1}. { - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(BSON("a" << 100 << "b" << 1)); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); verify(statusWithCQ.isOK()); @@ -216,7 +216,7 @@ public: // And run the same query again. { - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(BSON("a" << 100 << "b" << 1)); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); verify(statusWithCQ.isOK()); @@ -251,7 +251,7 @@ public: addIndex(BSON("b" << 1)); // Run the query {a:1, b:{$gt:1}. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(BSON("a" << 1 << "b" << BSON("$gt" << 1))); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); verify(statusWithCQ.isOK()); @@ -291,7 +291,7 @@ public: addIndex(BSON("a" << 1 << "b" << 1)); // Query for a==27 with projection that wants 'a' and 'b'. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(BSON("a" << 27)); qr->setProj(BSON("_id" << 0 << "a" << 1 << "b" << 1)); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); @@ -326,7 +326,7 @@ public: addIndex(BSON("b" << 1)); // There is no data that matches this query but we don't know that until EOF. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(BSON("a" << 1 << "b" << 1 << "c" << 99)); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); @@ -363,7 +363,7 @@ public: // There is no data that matches this query ({a:2}). Both scans will hit EOF before // returning any data. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(BSON("a" << 2)); qr->setProj(BSON("_id" << 0 << "a" << 1 << "b" << 1)); @@ -398,7 +398,7 @@ public: addIndex(BSON("b" << 1)); // Run the query {a:N+1, b:1}. (No such document.) - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(BSON("a" << N + 1 << "b" << 1)); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); verify(statusWithCQ.isOK()); @@ -434,7 +434,7 @@ public: addIndex(BSON("b" << 1)); // Run the query {a:N+1, b:1}. (No such document.) - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(BSON("a" << BSON("$gte" << N + 1) << "b" << 1)); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); verify(statusWithCQ.isOK()); @@ -463,7 +463,7 @@ public: // Run a query with a sort. The blocking sort won't produce any data during the // evaluation period. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(BSON("_id" << BSON("$gte" << 20 << "$lte" << 200))); qr->setSort(BSON("c" << 1)); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); @@ -493,7 +493,7 @@ public: } // Look for A Space Odyssey. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(BSON("foo" << 2001)); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); verify(statusWithCQ.isOK()); @@ -526,7 +526,7 @@ public: addIndex(BSON("d" << 1 << "e" << 1)); // Query: find({a: 1}).sort({d: 1}) - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(BSON("a" << 1)); qr->setSort(BSON("d" << 1)); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); @@ -564,7 +564,7 @@ public: // Solutions using either 'a' or 'b' will take a long time to start producing // results. However, an index scan on 'b' will start producing results sooner // than an index scan on 'a'. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson("{a: 1, b: 1, c: {$gte: 5000}}")); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); @@ -596,7 +596,7 @@ public: addIndex(BSON("b" << 1 << "c" << 1)); addIndex(BSON("a" << 1)); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson("{a: 9, b: {$ne: 10}, c: 9}")); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); diff --git a/src/mongo/dbtests/query_plan_executor.cpp b/src/mongo/dbtests/query_plan_executor.cpp index 0f67fa60656..d790c24dca0 100644 --- a/src/mongo/dbtests/query_plan_executor.cpp +++ b/src/mongo/dbtests/query_plan_executor.cpp @@ -30,6 +30,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/catalog/index_catalog.h" @@ -52,7 +54,6 @@ #include "mongo/db/query/plan_executor.h" #include "mongo/db/query/query_solution.h" #include "mongo/dbtests/dbtests.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace { @@ -60,7 +61,6 @@ namespace { using std::shared_ptr; using std::string; using std::unique_ptr; -using stdx::make_unique; static const NamespaceString nss("unittests.QueryPlanExecutor"); @@ -106,7 +106,7 @@ public: unique_ptr<WorkingSet> ws(new WorkingSet()); // Canonicalize the query. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(filterObj); qr->setTailableMode(tailableMode); auto statusWithCQ = CanonicalQuery::canonicalize(&_opCtx, std::move(qr)); @@ -154,7 +154,7 @@ public: IndexScan* ix = new IndexScan(&_opCtx, ixparams, ws.get(), NULL); unique_ptr<PlanStage> root(new FetchStage(&_opCtx, ws.get(), ix, NULL, coll)); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); auto statusWithCQ = CanonicalQuery::canonicalize(&_opCtx, std::move(qr)); verify(statusWithCQ.isOK()); unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue()); @@ -218,8 +218,8 @@ TEST_F(PlanExecutorTest, DropIndexScanAgg) { auto pipeline = assertGet(Pipeline::create({cursorSource}, expCtx)); // Create the output PlanExecutor that pulls results from the pipeline. - auto ws = make_unique<WorkingSet>(); - auto proxy = make_unique<PipelineProxyStage>(&_opCtx, std::move(pipeline), ws.get()); + auto ws = std::make_unique<WorkingSet>(); + auto proxy = std::make_unique<PipelineProxyStage>(&_opCtx, std::move(pipeline), ws.get()); auto statusWithPlanExecutor = PlanExecutor::make( &_opCtx, std::move(ws), std::move(proxy), collection, PlanExecutor::NO_YIELD); diff --git a/src/mongo/dbtests/query_stage_and.cpp b/src/mongo/dbtests/query_stage_and.cpp index 26a868c477b..aab96cdff95 100644 --- a/src/mongo/dbtests/query_stage_and.cpp +++ b/src/mongo/dbtests/query_stage_and.cpp @@ -35,6 +35,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" @@ -51,7 +53,6 @@ #include "mongo/db/json.h" #include "mongo/db/matcher/expression_parser.h" #include "mongo/dbtests/dbtests.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace QueryStageAnd { @@ -59,7 +60,6 @@ namespace QueryStageAnd { using std::set; using std::shared_ptr; using std::unique_ptr; -using stdx::make_unique; class QueryStageAndBase { public: @@ -199,7 +199,7 @@ public: addIndex(BSON("bar" << 1)); WorkingSet ws; - auto ah = make_unique<AndHashStage>(&_opCtx, &ws); + auto ah = std::make_unique<AndHashStage>(&_opCtx, &ws); // Foo <= 20. auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll)); @@ -286,7 +286,7 @@ public: addIndex(BSON("baz" << 1)); WorkingSet ws; - auto ah = make_unique<AndHashStage>(&_opCtx, &ws); + auto ah = std::make_unique<AndHashStage>(&_opCtx, &ws); // Foo <= 20 (descending). auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll)); @@ -366,7 +366,7 @@ public: addIndex(BSON("bar" << 1)); WorkingSet ws; - auto ah = make_unique<AndHashStage>(&_opCtx, &ws); + auto ah = std::make_unique<AndHashStage>(&_opCtx, &ws); // Foo <= 20 auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll)); @@ -415,7 +415,7 @@ public: // before hashed AND is done reading the first child (stage has to // hold 21 keys in buffer for Foo <= 20). WorkingSet ws; - auto ah = make_unique<AndHashStage>(&_opCtx, &ws, 20 * big.size()); + auto ah = std::make_unique<AndHashStage>(&_opCtx, &ws, 20 * big.size()); // Foo <= 20 auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1 << "big" << 1), coll)); @@ -462,7 +462,7 @@ public: // 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; - auto ah = make_unique<AndHashStage>(&_opCtx, &ws, 5 * big.size()); + auto ah = std::make_unique<AndHashStage>(&_opCtx, &ws, 5 * big.size()); // Foo <= 20 auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll)); @@ -504,7 +504,7 @@ public: addIndex(BSON("baz" << 1)); WorkingSet ws; - auto ah = make_unique<AndHashStage>(&_opCtx, &ws); + auto ah = std::make_unique<AndHashStage>(&_opCtx, &ws); // Foo <= 20 auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll)); @@ -562,7 +562,7 @@ public: // 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; - auto ah = make_unique<AndHashStage>(&_opCtx, &ws, 10 * big.size()); + auto ah = std::make_unique<AndHashStage>(&_opCtx, &ws, 10 * big.size()); // Foo <= 20 auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll)); @@ -607,7 +607,7 @@ public: addIndex(BSON("bar" << 1)); WorkingSet ws; - auto ah = make_unique<AndHashStage>(&_opCtx, &ws); + auto ah = std::make_unique<AndHashStage>(&_opCtx, &ws); // Foo <= 20 auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll)); @@ -664,7 +664,7 @@ public: addIndex(BSON("bar" << 1)); WorkingSet ws; - auto ah = make_unique<AndHashStage>(&_opCtx, &ws); + auto ah = std::make_unique<AndHashStage>(&_opCtx, &ws); // Foo >= 100 auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll)); @@ -711,7 +711,7 @@ public: addIndex(BSON("bar" << 1)); WorkingSet ws; - auto ah = make_unique<AndHashStage>(&_opCtx, &ws); + auto ah = std::make_unique<AndHashStage>(&_opCtx, &ws); // Foo <= 20 auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll)); @@ -763,7 +763,7 @@ public: addIndex(BSON("bar" << 1)); WorkingSet ws; - auto ah = make_unique<AndHashStage>(&_opCtx, &ws); + auto ah = std::make_unique<AndHashStage>(&_opCtx, &ws); // Foo <= 20 auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll)); @@ -811,9 +811,9 @@ public: // Child2: NEED_TIME, FAILURE { WorkingSet ws; - const auto andHashStage = make_unique<AndHashStage>(&_opCtx, &ws); + const auto andHashStage = std::make_unique<AndHashStage>(&_opCtx, &ws); - auto childStage1 = make_unique<QueuedDataStage>(&_opCtx, &ws); + auto childStage1 = std::make_unique<QueuedDataStage>(&_opCtx, &ws); { WorkingSetID id = ws.allocate(); WorkingSetMember* wsm = ws.get(id); @@ -823,7 +823,7 @@ public: childStage1->pushBack(id); } - auto childStage2 = make_unique<QueuedDataStage>(&_opCtx, &ws); + auto childStage2 = std::make_unique<QueuedDataStage>(&_opCtx, &ws); childStage2->pushBack(PlanStage::NEED_TIME); childStage2->pushBack(PlanStage::FAILURE); @@ -844,9 +844,9 @@ public: // Child2: Data { WorkingSet ws; - const auto andHashStage = make_unique<AndHashStage>(&_opCtx, &ws); + const auto andHashStage = std::make_unique<AndHashStage>(&_opCtx, &ws); - auto childStage1 = make_unique<QueuedDataStage>(&_opCtx, &ws); + auto childStage1 = std::make_unique<QueuedDataStage>(&_opCtx, &ws); { WorkingSetID id = ws.allocate(); @@ -858,7 +858,7 @@ public: } childStage1->pushBack(PlanStage::FAILURE); - auto childStage2 = make_unique<QueuedDataStage>(&_opCtx, &ws); + auto childStage2 = std::make_unique<QueuedDataStage>(&_opCtx, &ws); { WorkingSetID id = ws.allocate(); WorkingSetMember* wsm = ws.get(id); @@ -885,9 +885,9 @@ public: // Child2: Data, FAILURE { WorkingSet ws; - const auto andHashStage = make_unique<AndHashStage>(&_opCtx, &ws); + const auto andHashStage = std::make_unique<AndHashStage>(&_opCtx, &ws); - auto childStage1 = make_unique<QueuedDataStage>(&_opCtx, &ws); + auto childStage1 = std::make_unique<QueuedDataStage>(&_opCtx, &ws); { WorkingSetID id = ws.allocate(); WorkingSetMember* wsm = ws.get(id); @@ -897,7 +897,7 @@ public: childStage1->pushBack(id); } - auto childStage2 = make_unique<QueuedDataStage>(&_opCtx, &ws); + auto childStage2 = std::make_unique<QueuedDataStage>(&_opCtx, &ws); { WorkingSetID id = ws.allocate(); WorkingSetMember* wsm = ws.get(id); @@ -949,7 +949,7 @@ public: addIndex(BSON("bar" << 1)); WorkingSet ws; - auto ah = make_unique<AndSortedStage>(&_opCtx, &ws); + auto ah = std::make_unique<AndSortedStage>(&_opCtx, &ws); // Scan over foo == 1. auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll)); @@ -1066,7 +1066,7 @@ public: addIndex(BSON("baz" << 1)); WorkingSet ws; - auto ah = make_unique<AndSortedStage>(&_opCtx, &ws); + auto ah = std::make_unique<AndSortedStage>(&_opCtx, &ws); // Scan over foo == 1 auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll)); @@ -1111,7 +1111,7 @@ public: addIndex(BSON("bar" << 1)); WorkingSet ws; - auto ah = make_unique<AndSortedStage>(&_opCtx, &ws); + auto ah = std::make_unique<AndSortedStage>(&_opCtx, &ws); // Foo == 7. Should be EOF. auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll)); @@ -1154,7 +1154,7 @@ public: addIndex(BSON("bar" << 1)); WorkingSet ws; - auto ah = make_unique<AndSortedStage>(&_opCtx, &ws); + auto ah = std::make_unique<AndSortedStage>(&_opCtx, &ws); // foo == 7. auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll)); @@ -1193,7 +1193,7 @@ public: addIndex(BSON("bar" << 1)); WorkingSet ws; - auto ah = make_unique<AndHashStage>(&_opCtx, &ws); + auto ah = std::make_unique<AndHashStage>(&_opCtx, &ws); // Scan over foo == 1 auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll)); @@ -1255,7 +1255,7 @@ public: addIndex(BSON("bar" << 1)); WorkingSet ws; - unique_ptr<AndSortedStage> as = make_unique<AndSortedStage>(&_opCtx, &ws); + unique_ptr<AndSortedStage> as = std::make_unique<AndSortedStage>(&_opCtx, &ws); // Scan over foo == 1 auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll)); @@ -1307,7 +1307,7 @@ public: addIndex(BSON("bar" << 1)); WorkingSet ws; - unique_ptr<AndSortedStage> as = make_unique<AndSortedStage>(&_opCtx, &ws); + unique_ptr<AndSortedStage> as = std::make_unique<AndSortedStage>(&_opCtx, &ws); // Scan over foo == 1 auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("foo" << 1), coll)); diff --git a/src/mongo/dbtests/query_stage_cached_plan.cpp b/src/mongo/dbtests/query_stage_cached_plan.cpp index 6b617565423..49f6d6429cc 100644 --- a/src/mongo/dbtests/query_stage_cached_plan.cpp +++ b/src/mongo/dbtests/query_stage_cached_plan.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" @@ -48,7 +50,6 @@ #include "mongo/db/query/query_knobs_gen.h" #include "mongo/db/query/query_planner_params.h" #include "mongo/dbtests/dbtests.h" -#include "mongo/stdx/memory.h" namespace QueryStageCachedPlan { @@ -58,7 +59,7 @@ namespace { std::unique_ptr<CanonicalQuery> canonicalQueryFromFilterObj(OperationContext* opCtx, const NamespaceString& nss, BSONObj filter) { - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(filter); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx, std::move(qr)); uassertStatusOK(statusWithCQ.getStatus()); @@ -150,7 +151,7 @@ public: const size_t decisionWorks = 10; const size_t mockWorks = 1U + static_cast<size_t>(internalQueryCacheEvictionRatio * decisionWorks); - auto mockChild = stdx::make_unique<QueuedDataStage>(&_opCtx, &_ws); + auto mockChild = std::make_unique<QueuedDataStage>(&_opCtx, &_ws); for (size_t i = 0; i < mockWorks; i++) { mockChild->pushBack(PlanStage::NEED_TIME); } @@ -181,7 +182,7 @@ TEST_F(QueryStageCachedPlan, QueryStageCachedPlanFailure) { ASSERT(collection); // Query can be answered by either index on "a" or index on "b". - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson("{a: {$gte: 8}, b: 1}")); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); @@ -197,7 +198,7 @@ TEST_F(QueryStageCachedPlan, QueryStageCachedPlanFailure) { fillOutPlannerParams(&_opCtx, collection, cq.get(), &plannerParams); // Queued data stage will return a failure during the cached plan trial period. - auto mockChild = stdx::make_unique<QueuedDataStage>(&_opCtx, &_ws); + auto mockChild = std::make_unique<QueuedDataStage>(&_opCtx, &_ws); mockChild->pushBack(PlanStage::FAILURE); // High enough so that we shouldn't trigger a replan based on works. @@ -227,7 +228,7 @@ TEST_F(QueryStageCachedPlan, QueryStageCachedPlanHitMaxWorks) { ASSERT(collection); // Query can be answered by either index on "a" or index on "b". - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson("{a: {$gte: 8}, b: 1}")); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); @@ -247,7 +248,7 @@ TEST_F(QueryStageCachedPlan, QueryStageCachedPlanHitMaxWorks) { const size_t decisionWorks = 10; const size_t mockWorks = 1U + static_cast<size_t>(internalQueryCacheEvictionRatio * decisionWorks); - auto mockChild = stdx::make_unique<QueuedDataStage>(&_opCtx, &_ws); + auto mockChild = std::make_unique<QueuedDataStage>(&_opCtx, &_ws); for (size_t i = 0; i < mockWorks; i++) { mockChild->pushBack(PlanStage::NEED_TIME); } @@ -437,7 +438,7 @@ TEST_F(QueryStageCachedPlan, ThrowsOnYieldRecoveryWhenIndexIsDroppedBeforePlanSe ASSERT(collection); // Query can be answered by either index on "a" or index on "b". - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); const std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue()); @@ -479,7 +480,7 @@ TEST_F(QueryStageCachedPlan, DoesNotThrowOnYieldRecoveryWhenIndexIsDroppedAferPl ASSERT(collection); // Query can be answered by either index on "a" or index on "b". - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); const std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue()); diff --git a/src/mongo/dbtests/query_stage_collscan.cpp b/src/mongo/dbtests/query_stage_collscan.cpp index 0312bb411da..615f30f6869 100644 --- a/src/mongo/dbtests/query_stage_collscan.cpp +++ b/src/mongo/dbtests/query_stage_collscan.cpp @@ -33,6 +33,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" @@ -47,14 +49,12 @@ #include "mongo/db/query/plan_executor.h" #include "mongo/db/storage/record_store.h" #include "mongo/dbtests/dbtests.h" -#include "mongo/stdx/memory.h" #include "mongo/util/fail_point_service.h" namespace QueryStageCollectionScan { using std::unique_ptr; using std::vector; -using stdx::make_unique; static const NamespaceString nss{"unittests.QueryStageCollectionScan"}; @@ -102,9 +102,9 @@ public: unique_ptr<MatchExpression> filterExpr = std::move(statusWithMatcher.getValue()); // Make a scan and have the runner own it. - unique_ptr<WorkingSet> ws = make_unique<WorkingSet>(); - unique_ptr<PlanStage> ps = - make_unique<CollectionScan>(&_opCtx, collection, params, ws.get(), filterExpr.get()); + unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>(); + unique_ptr<PlanStage> ps = std::make_unique<CollectionScan>( + &_opCtx, collection, params, ws.get(), filterExpr.get()); auto statusWithPlanExecutor = PlanExecutor::make( &_opCtx, std::move(ws), std::move(ps), collection, PlanExecutor::NO_YIELD); @@ -216,9 +216,9 @@ public: params.tailable = false; // Make a scan and have the runner own it. - unique_ptr<WorkingSet> ws = make_unique<WorkingSet>(); + unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>(); unique_ptr<PlanStage> ps = - make_unique<CollectionScan>(&_opCtx, collection, params, ws.get(), nullptr); + std::make_unique<CollectionScan>(&_opCtx, collection, params, ws.get(), nullptr); auto statusWithPlanExecutor = PlanExecutor::make( &_opCtx, std::move(ws), std::move(ps), collection, PlanExecutor::NO_YIELD); @@ -251,9 +251,9 @@ public: params.direction = CollectionScanParams::BACKWARD; params.tailable = false; - unique_ptr<WorkingSet> ws = make_unique<WorkingSet>(); + unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>(); unique_ptr<PlanStage> ps = - make_unique<CollectionScan>(&_opCtx, collection, params, ws.get(), nullptr); + std::make_unique<CollectionScan>(&_opCtx, collection, params, ws.get(), nullptr); auto statusWithPlanExecutor = PlanExecutor::make( &_opCtx, std::move(ws), std::move(ps), collection, PlanExecutor::NO_YIELD); diff --git a/src/mongo/dbtests/query_stage_delete.cpp b/src/mongo/dbtests/query_stage_delete.cpp index 08f0297e9d0..f10b7390243 100644 --- a/src/mongo/dbtests/query_stage_delete.cpp +++ b/src/mongo/dbtests/query_stage_delete.cpp @@ -33,6 +33,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/client.h" @@ -45,13 +47,11 @@ #include "mongo/db/query/canonical_query.h" #include "mongo/db/service_context.h" #include "mongo/dbtests/dbtests.h" -#include "mongo/stdx/memory.h" namespace QueryStageDelete { using std::unique_ptr; using std::vector; -using stdx::make_unique; static const NamespaceString nss("unittests.QueryStageDelete"); @@ -103,7 +103,7 @@ public: } unique_ptr<CanonicalQuery> canonicalize(const BSONObj& query) { - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(query); auto statusWithCQ = CanonicalQuery::canonicalize(&_opCtx, std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); @@ -193,7 +193,7 @@ public: ASSERT(coll); const int targetDocIndex = 0; const BSONObj query = BSON("foo" << BSON("$gte" << targetDocIndex)); - const auto ws = make_unique<WorkingSet>(); + const auto ws = std::make_unique<WorkingSet>(); const unique_ptr<CanonicalQuery> cq(canonicalize(query)); // Get the RecordIds that would be returned by an in-order scan. @@ -202,7 +202,7 @@ public: // Configure a QueuedDataStage to pass the first object in the collection back in a // RID_AND_OBJ state. - auto qds = make_unique<QueuedDataStage>(&_opCtx, ws.get()); + auto qds = std::make_unique<QueuedDataStage>(&_opCtx, ws.get()); WorkingSetID id = ws->allocate(); WorkingSetMember* member = ws->get(id); member->recordId = recordIds[targetDocIndex]; @@ -216,7 +216,7 @@ public: deleteParams->returnDeleted = true; deleteParams->canonicalQuery = cq.get(); - const auto deleteStage = make_unique<DeleteStage>( + const auto deleteStage = std::make_unique<DeleteStage>( &_opCtx, std::move(deleteParams), ws.get(), coll, qds.release()); const DeleteStats* stats = static_cast<const DeleteStats*>(deleteStage->getSpecificStats()); diff --git a/src/mongo/dbtests/query_stage_ensure_sorted.cpp b/src/mongo/dbtests/query_stage_ensure_sorted.cpp index 83722fa0d7a..49e9383442f 100644 --- a/src/mongo/dbtests/query_stage_ensure_sorted.cpp +++ b/src/mongo/dbtests/query_stage_ensure_sorted.cpp @@ -29,13 +29,14 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/exec/ensure_sorted.h" #include "mongo/db/exec/queued_data_stage.h" #include "mongo/db/exec/sort_key_generator.h" #include "mongo/db/json.h" #include "mongo/db/query/collation/collator_interface_mock.h" #include "mongo/db/query/query_test_service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -60,7 +61,7 @@ public: auto opCtx = _serviceContext.makeOperationContext(); WorkingSet ws; - auto queuedDataStage = stdx::make_unique<QueuedDataStage>(opCtx.get(), &ws); + auto queuedDataStage = std::make_unique<QueuedDataStage>(opCtx.get(), &ws); BSONObj inputObj = fromjson(inputStr); BSONElement inputElt = inputObj["input"]; ASSERT(inputElt.isABSONObj()); @@ -79,7 +80,7 @@ public: // Initialization. BSONObj pattern = fromjson(patternStr); - auto sortKeyGen = stdx::make_unique<SortKeyGeneratorStage>( + auto sortKeyGen = std::make_unique<SortKeyGeneratorStage>( opCtx.get(), queuedDataStage.release(), &ws, pattern, collator); EnsureSortedStage ess(opCtx.get(), pattern, &ws, sortKeyGen.release()); WorkingSetID id = WorkingSet::INVALID_ID; @@ -115,8 +116,8 @@ TEST_F(QueryStageEnsureSortedTest, EnsureSortedEmptyWorkingSet) { auto opCtx = _serviceContext.makeOperationContext(); WorkingSet ws; - auto queuedDataStage = stdx::make_unique<QueuedDataStage>(opCtx.get(), &ws); - auto sortKeyGen = stdx::make_unique<SortKeyGeneratorStage>( + auto queuedDataStage = std::make_unique<QueuedDataStage>(opCtx.get(), &ws); + auto sortKeyGen = std::make_unique<SortKeyGeneratorStage>( opCtx.get(), queuedDataStage.release(), &ws, BSONObj(), nullptr); EnsureSortedStage ess(opCtx.get(), BSONObj(), &ws, sortKeyGen.release()); diff --git a/src/mongo/dbtests/query_stage_fetch.cpp b/src/mongo/dbtests/query_stage_fetch.cpp index 4efe707f0cd..2eb09c39057 100644 --- a/src/mongo/dbtests/query_stage_fetch.cpp +++ b/src/mongo/dbtests/query_stage_fetch.cpp @@ -33,6 +33,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" @@ -45,14 +47,12 @@ #include "mongo/db/json.h" #include "mongo/db/matcher/expression_parser.h" #include "mongo/dbtests/dbtests.h" -#include "mongo/stdx/memory.h" namespace QueryStageFetch { using std::set; using std::shared_ptr; using std::unique_ptr; -using stdx::make_unique; class QueryStageFetchBase { public: @@ -115,7 +115,7 @@ public: ASSERT_EQUALS(size_t(1), recordIds.size()); // Create a mock stage that returns the WSM. - auto mockStage = make_unique<QueuedDataStage>(&_opCtx, &ws); + auto mockStage = std::make_unique<QueuedDataStage>(&_opCtx, &ws); // Mock data. { @@ -180,7 +180,7 @@ public: ASSERT_EQUALS(size_t(1), recordIds.size()); // Create a mock stage that returns the WSM. - auto mockStage = make_unique<QueuedDataStage>(&_opCtx, &ws); + auto mockStage = std::make_unique<QueuedDataStage>(&_opCtx, &ws); // Mock data. { diff --git a/src/mongo/dbtests/query_stage_limit_skip.cpp b/src/mongo/dbtests/query_stage_limit_skip.cpp index 6514666f926..5fbd93b68d3 100644 --- a/src/mongo/dbtests/query_stage_limit_skip.cpp +++ b/src/mongo/dbtests/query_stage_limit_skip.cpp @@ -34,6 +34,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/client/dbclient_cursor.h" #include "mongo/db/client.h" #include "mongo/db/exec/limit.h" @@ -42,7 +44,6 @@ #include "mongo/db/exec/skip.h" #include "mongo/db/json.h" #include "mongo/dbtests/dbtests.h" -#include "mongo/stdx/memory.h" using namespace mongo; @@ -51,13 +52,12 @@ namespace { using std::max; using std::min; using std::unique_ptr; -using stdx::make_unique; static const int N = 50; /* Populate a QueuedDataStage and return it. Caller owns it. */ QueuedDataStage* getMS(OperationContext* opCtx, WorkingSet* ws) { - auto ms = make_unique<QueuedDataStage>(opCtx, ws); + auto ms = std::make_unique<QueuedDataStage>(opCtx, ws); // Put N ADVANCED results into the mock stage, and some other stalling results (YIELD/TIME). for (int i = 0; i < N; ++i) { @@ -97,11 +97,12 @@ public: for (int i = 0; i < 2 * N; ++i) { WorkingSet ws; - unique_ptr<PlanStage> skip = make_unique<SkipStage>(_opCtx, i, &ws, getMS(_opCtx, &ws)); + unique_ptr<PlanStage> skip = + std::make_unique<SkipStage>(_opCtx, i, &ws, getMS(_opCtx, &ws)); ASSERT_EQUALS(max(0, N - i), countResults(skip.get())); unique_ptr<PlanStage> limit = - make_unique<LimitStage>(_opCtx, i, &ws, getMS(_opCtx, &ws)); + std::make_unique<LimitStage>(_opCtx, i, &ws, getMS(_opCtx, &ws)); ASSERT_EQUALS(min(N, i), countResults(limit.get())); } } diff --git a/src/mongo/dbtests/query_stage_merge_sort.cpp b/src/mongo/dbtests/query_stage_merge_sort.cpp index 05678ce2c64..aa6cb5e174a 100644 --- a/src/mongo/dbtests/query_stage_merge_sort.cpp +++ b/src/mongo/dbtests/query_stage_merge_sort.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" @@ -45,7 +47,6 @@ #include "mongo/db/query/collation/collator_interface_mock.h" #include "mongo/db/query/plan_executor.h" #include "mongo/dbtests/dbtests.h" -#include "mongo/stdx/memory.h" /** * This file tests db/exec/merge_sort.cpp @@ -56,7 +57,7 @@ namespace QueryStageMergeSortTests { using std::set; using std::string; using std::unique_ptr; -using stdx::make_unique; +using std::make_unique; class QueryStageMergeSortTestBase { public: @@ -661,14 +662,14 @@ public: WorkingSetMember* member; MergeSortStageParams msparams; msparams.pattern = BSON("a" << 1); - auto ms = stdx::make_unique<MergeSortStage>(&_opCtx, msparams, &ws); + auto ms = std::make_unique<MergeSortStage>(&_opCtx, msparams, &ws); // First child scans [5, 10]. { auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("a" << 1), coll)); params.bounds.startKey = BSON("" << 5); params.bounds.endKey = BSON("" << 10); - auto fetchStage = stdx::make_unique<FetchStage>( + auto fetchStage = std::make_unique<FetchStage>( &_opCtx, &ws, new IndexScan(&_opCtx, params, &ws, nullptr), nullptr, coll); ms->addChild(fetchStage.release()); } @@ -678,7 +679,7 @@ public: auto params = makeIndexScanParams(&_opCtx, getIndex(BSON("a" << 1), coll)); params.bounds.startKey = BSON("" << 4); params.bounds.endKey = BSON("" << 10); - auto fetchStage = stdx::make_unique<FetchStage>( + auto fetchStage = std::make_unique<FetchStage>( &_opCtx, &ws, new IndexScan(&_opCtx, params, &ws, nullptr), nullptr, coll); ms->addChild(fetchStage.release()); } diff --git a/src/mongo/dbtests/query_stage_multiplan.cpp b/src/mongo/dbtests/query_stage_multiplan.cpp index 6e664bb0b3b..622d284045b 100644 --- a/src/mongo/dbtests/query_stage_multiplan.cpp +++ b/src/mongo/dbtests/query_stage_multiplan.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/catalog/index_catalog.h" @@ -53,12 +55,11 @@ #include "mongo/db/query/query_planner_test_lib.h" #include "mongo/db/query/stage_builder.h" #include "mongo/dbtests/dbtests.h" -#include "mongo/stdx/memory.h" #include "mongo/util/clock_source_mock.h" namespace mongo { -const std::unique_ptr<ClockSource> clockSource = stdx::make_unique<ClockSourceMock>(); +const std::unique_ptr<ClockSource> clockSource = std::make_unique<ClockSourceMock>(); // How we access the external setParameter testing bool. extern AtomicWord<bool> internalQueryForceIntersectionPlans; @@ -67,15 +68,14 @@ namespace { using std::unique_ptr; using std::vector; -using stdx::make_unique; static const NamespaceString nss("unittests.QueryStageMultiPlan"); std::unique_ptr<QuerySolution> createQuerySolution() { - auto soln = stdx::make_unique<QuerySolution>(); - soln->cacheData = stdx::make_unique<SolutionCacheData>(); + auto soln = std::make_unique<QuerySolution>(); + soln->cacheData = std::make_unique<SolutionCacheData>(); soln->cacheData->solnType = SolutionCacheData::COLLSCAN_SOLN; - soln->cacheData->tree = stdx::make_unique<PlanCacheIndexTree>(); + soln->cacheData->tree = std::make_unique<PlanCacheIndexTree>(); return soln; } @@ -123,7 +123,7 @@ protected: std::unique_ptr<CanonicalQuery> makeCanonicalQuery(OperationContext* opCtx, NamespaceString nss, BSONObj filter) { - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(filter); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx, std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); @@ -195,7 +195,7 @@ std::unique_ptr<MultiPlanStage> runMultiPlanner(OperationContext* opCtx, // Hand the plans off to the MPS. auto cq = makeCanonicalQuery(opCtx, nss, BSON("foo" << desiredFooValue)); - unique_ptr<MultiPlanStage> mps = make_unique<MultiPlanStage>(opCtx, coll, cq.get()); + unique_ptr<MultiPlanStage> mps = std::make_unique<MultiPlanStage>(opCtx, coll, cq.get()); mps->addPlan(createQuerySolution(), ixScanRoot.release(), sharedWs.get()); mps->addPlan(createQuerySolution(), collScanRoot.release(), sharedWs.get()); @@ -243,7 +243,7 @@ TEST_F(QueryStageMultiPlanTest, MPSCollectionScanVsHighlySelectiveIXScan) { auto cq = makeCanonicalQuery(_opCtx.get(), nss, filterObj); unique_ptr<MultiPlanStage> mps = - make_unique<MultiPlanStage>(_opCtx.get(), ctx.getCollection(), cq.get()); + std::make_unique<MultiPlanStage>(_opCtx.get(), ctx.getCollection(), cq.get()); mps->addPlan(createQuerySolution(), ixScanRoot.release(), sharedWs.get()); mps->addPlan(createQuerySolution(), collScanRoot.release(), sharedWs.get()); @@ -372,7 +372,7 @@ TEST_F(QueryStageMultiPlanTest, MPSBackupPlan) { Collection* collection = ctx.getCollection(); // Query for both 'a' and 'b' and sort on 'b'. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(BSON("a" << 1 << "b" << 1)); qr->setSort(BSON("b" << 1)); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); @@ -470,9 +470,9 @@ TEST_F(QueryStageMultiPlanTest, MPSExplainAllPlans) { const int nDocs = 500; - auto ws = stdx::make_unique<WorkingSet>(); - auto firstPlan = stdx::make_unique<QueuedDataStage>(_opCtx.get(), ws.get()); - auto secondPlan = stdx::make_unique<QueuedDataStage>(_opCtx.get(), ws.get()); + auto ws = std::make_unique<WorkingSet>(); + auto firstPlan = std::make_unique<QueuedDataStage>(_opCtx.get(), ws.get()); + auto secondPlan = std::make_unique<QueuedDataStage>(_opCtx.get(), ws.get()); for (int i = 0; i < nDocs; ++i) { addMember(firstPlan.get(), ws.get(), BSON("x" << 1)); @@ -484,15 +484,15 @@ TEST_F(QueryStageMultiPlanTest, MPSExplainAllPlans) { AutoGetCollectionForReadCommand ctx(_opCtx.get(), nss); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(BSON("x" << 1)); auto cq = uassertStatusOK(CanonicalQuery::canonicalize(opCtx(), std::move(qr))); unique_ptr<MultiPlanStage> mps = - make_unique<MultiPlanStage>(_opCtx.get(), ctx.getCollection(), cq.get()); + std::make_unique<MultiPlanStage>(_opCtx.get(), ctx.getCollection(), cq.get()); // Put each plan into the MultiPlanStage. Takes ownership of 'firstPlan' and 'secondPlan'. - mps->addPlan(stdx::make_unique<QuerySolution>(), firstPlan.release(), ws.get()); - mps->addPlan(stdx::make_unique<QuerySolution>(), secondPlan.release(), ws.get()); + mps->addPlan(std::make_unique<QuerySolution>(), firstPlan.release(), ws.get()); + mps->addPlan(std::make_unique<QuerySolution>(), secondPlan.release(), ws.get()); // Making a PlanExecutor chooses the best plan. auto exec = uassertStatusOK(PlanExecutor::make( @@ -542,7 +542,7 @@ TEST_F(QueryStageMultiPlanTest, MPSSummaryStats) { Collection* coll = ctx.getCollection(); // Create the executor (Matching all documents). - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(BSON("foo" << BSON("$gte" << 0))); auto cq = uassertStatusOK(CanonicalQuery::canonicalize(opCtx(), std::move(qr))); auto exec = @@ -586,7 +586,7 @@ TEST_F(QueryStageMultiPlanTest, ShouldReportErrorIfExceedsTimeLimitDuringPlannin getCollScanPlan(_opCtx.get(), coll, sharedWs.get(), filter.get()); - auto queryRequest = stdx::make_unique<QueryRequest>(nss); + auto queryRequest = std::make_unique<QueryRequest>(nss); queryRequest->setFilter(filterObj); auto canonicalQuery = uassertStatusOK(CanonicalQuery::canonicalize(opCtx(), std::move(queryRequest))); @@ -626,7 +626,7 @@ TEST_F(QueryStageMultiPlanTest, ShouldReportErrorIfKilledDuringPlanning) { unique_ptr<PlanStage> collScanRoot = getCollScanPlan(_opCtx.get(), coll, sharedWs.get(), filter.get()); - auto queryRequest = stdx::make_unique<QueryRequest>(nss); + auto queryRequest = std::make_unique<QueryRequest>(nss); queryRequest->setFilter(BSON("foo" << BSON("$gte" << 0))); auto canonicalQuery = uassertStatusOK(CanonicalQuery::canonicalize(opCtx(), std::move(queryRequest))); diff --git a/src/mongo/dbtests/query_stage_near.cpp b/src/mongo/dbtests/query_stage_near.cpp index e4296c2c8de..4af68aad624 100644 --- a/src/mongo/dbtests/query_stage_near.cpp +++ b/src/mongo/dbtests/query_stage_near.cpp @@ -45,7 +45,6 @@ #include "mongo/db/exec/queued_data_stage.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/dbtests/dbtests.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace { @@ -54,7 +53,6 @@ using namespace mongo; using std::shared_ptr; using std::unique_ptr; using std::vector; -using stdx::make_unique; const std::string kTestNamespace = "test.coll"; const BSONObj kTestKeyPattern = BSON("testIndex" << 1); @@ -105,7 +103,7 @@ public: _pos(0) {} void addInterval(vector<BSONObj> data, double min, double max) { - _intervals.push_back(stdx::make_unique<MockInterval>(data, min, max)); + _intervals.push_back(std::make_unique<MockInterval>(data, min, max)); } virtual StatusWith<CoveredInterval*> nextInterval(OperationContext* opCtx, @@ -118,7 +116,7 @@ public: bool lastInterval = _pos == static_cast<int>(_intervals.size()); - auto queuedStage = make_unique<QueuedDataStage>(opCtx, workingSet); + auto queuedStage = std::make_unique<QueuedDataStage>(opCtx, workingSet); for (unsigned int i = 0; i < interval.data.size(); i++) { // Add all documents from the lastInterval into the QueuedDataStage. diff --git a/src/mongo/dbtests/query_stage_sort.cpp b/src/mongo/dbtests/query_stage_sort.cpp index 1c0c9c4de5f..a50de5f0d3f 100644 --- a/src/mongo/dbtests/query_stage_sort.cpp +++ b/src/mongo/dbtests/query_stage_sort.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/client/dbclient_cursor.h" #include "mongo/db/bson/dotted_path_support.h" #include "mongo/db/catalog/collection.h" @@ -43,7 +45,6 @@ #include "mongo/db/json.h" #include "mongo/db/query/plan_executor.h" #include "mongo/dbtests/dbtests.h" -#include "mongo/stdx/memory.h" /** * This file tests db/exec/sort.cpp @@ -53,7 +54,6 @@ namespace QueryStageSortTests { using std::set; using std::unique_ptr; -using stdx::make_unique; namespace dps = ::mongo::dotted_path_support; @@ -111,18 +111,18 @@ public: unique_ptr<PlanExecutor, PlanExecutor::Deleter> makePlanExecutorWithSortStage( Collection* coll) { // Build the mock scan stage which feeds the data. - auto ws = make_unique<WorkingSet>(); - auto queuedDataStage = make_unique<QueuedDataStage>(&_opCtx, ws.get()); + auto ws = std::make_unique<WorkingSet>(); + auto queuedDataStage = std::make_unique<QueuedDataStage>(&_opCtx, ws.get()); insertVarietyOfObjects(ws.get(), queuedDataStage.get(), coll); SortStageParams params; params.pattern = BSON("foo" << 1); params.limit = limit(); - auto keyGenStage = make_unique<SortKeyGeneratorStage>( + auto keyGenStage = std::make_unique<SortKeyGeneratorStage>( &_opCtx, queuedDataStage.release(), ws.get(), params.pattern, nullptr); - auto ss = make_unique<SortStage>(&_opCtx, params, ws.get(), keyGenStage.release()); + auto ss = std::make_unique<SortStage>(&_opCtx, params, ws.get(), keyGenStage.release()); // The PlanExecutor will be automatically registered on construction due to the auto // yield policy, so it can receive invalidations when we remove documents later. @@ -147,8 +147,8 @@ public: * If limit is not zero, we limit the output of the sort stage to 'limit' results. */ void sortAndCheck(int direction, Collection* coll) { - auto ws = make_unique<WorkingSet>(); - auto queuedDataStage = make_unique<QueuedDataStage>(&_opCtx, ws.get()); + auto ws = std::make_unique<WorkingSet>(); + auto queuedDataStage = std::make_unique<QueuedDataStage>(&_opCtx, ws.get()); // Insert a mix of the various types of data. insertVarietyOfObjects(ws.get(), queuedDataStage.get(), coll); @@ -157,13 +157,14 @@ public: params.pattern = BSON("foo" << direction); params.limit = limit(); - auto keyGenStage = make_unique<SortKeyGeneratorStage>( + auto keyGenStage = std::make_unique<SortKeyGeneratorStage>( &_opCtx, queuedDataStage.release(), ws.get(), params.pattern, nullptr); - auto sortStage = make_unique<SortStage>(&_opCtx, params, ws.get(), keyGenStage.release()); + auto sortStage = + std::make_unique<SortStage>(&_opCtx, params, ws.get(), keyGenStage.release()); auto fetchStage = - make_unique<FetchStage>(&_opCtx, ws.get(), sortStage.release(), nullptr, coll); + std::make_unique<FetchStage>(&_opCtx, ws.get(), sortStage.release(), nullptr, coll); // Must fetch so we can look at the doc as a BSONObj. auto statusWithPlanExecutor = PlanExecutor::make( @@ -532,8 +533,8 @@ public: wuow.commit(); } - auto ws = make_unique<WorkingSet>(); - auto queuedDataStage = make_unique<QueuedDataStage>(&_opCtx, ws.get()); + auto ws = std::make_unique<WorkingSet>(); + auto queuedDataStage = std::make_unique<QueuedDataStage>(&_opCtx, ws.get()); for (int i = 0; i < numObj(); ++i) { { @@ -556,13 +557,14 @@ public: SortStageParams params; params.pattern = BSON("b" << -1 << "c" << 1 << "a" << 1); - auto keyGenStage = make_unique<SortKeyGeneratorStage>( + auto keyGenStage = std::make_unique<SortKeyGeneratorStage>( &_opCtx, queuedDataStage.release(), ws.get(), params.pattern, nullptr); - auto sortStage = make_unique<SortStage>(&_opCtx, params, ws.get(), keyGenStage.release()); + auto sortStage = + std::make_unique<SortStage>(&_opCtx, params, ws.get(), keyGenStage.release()); auto fetchStage = - make_unique<FetchStage>(&_opCtx, ws.get(), sortStage.release(), nullptr, coll); + std::make_unique<FetchStage>(&_opCtx, ws.get(), sortStage.release(), nullptr, coll); // We don't get results back since we're sorting some parallel arrays. auto statusWithPlanExecutor = PlanExecutor::make( diff --git a/src/mongo/dbtests/query_stage_sort_key_generator.cpp b/src/mongo/dbtests/query_stage_sort_key_generator.cpp index 7d73f858953..adc2bb2db50 100644 --- a/src/mongo/dbtests/query_stage_sort_key_generator.cpp +++ b/src/mongo/dbtests/query_stage_sort_key_generator.cpp @@ -29,13 +29,14 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/exec/queued_data_stage.h" #include "mongo/db/exec/sort_key_generator.h" #include "mongo/db/exec/working_set_computed_data.h" #include "mongo/db/json.h" #include "mongo/db/query/collation/collator_interface_mock.h" #include "mongo/db/query/query_test_service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -70,7 +71,7 @@ BSONObj extractSortKey(const char* sortSpec, const char* doc, const CollatorInte WorkingSet workingSet; - auto mockStage = stdx::make_unique<QueuedDataStage>(opCtx.get(), &workingSet); + auto mockStage = std::make_unique<QueuedDataStage>(opCtx.get(), &workingSet); auto wsid = workingSet.allocate(); auto wsm = workingSet.get(wsid); wsm->obj = Snapshotted<BSONObj>(SnapshotId(), fromjson(doc)); @@ -98,7 +99,7 @@ BSONObj extractSortKeyCovered(const char* sortSpec, WorkingSet workingSet; - auto mockStage = stdx::make_unique<QueuedDataStage>(opCtx.get(), &workingSet); + auto mockStage = std::make_unique<QueuedDataStage>(opCtx.get(), &workingSet); auto wsid = workingSet.allocate(); auto wsm = workingSet.get(wsid); wsm->keyData.push_back(ikd); diff --git a/src/mongo/dbtests/query_stage_subplan.cpp b/src/mongo/dbtests/query_stage_subplan.cpp index e04a5c6b3db..c369ce03b7f 100644 --- a/src/mongo/dbtests/query_stage_subplan.cpp +++ b/src/mongo/dbtests/query_stage_subplan.cpp @@ -129,7 +129,7 @@ TEST_F(QueryStageSubplanTest, QueryStageSubplanGeo2dOr) { "{$or: [{a: {$geoWithin: {$centerSphere: [[0,0],10]}}}," "{a: {$geoWithin: {$centerSphere: [[1,1],10]}}}]}"); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(query); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); @@ -166,7 +166,7 @@ void assertSubplanFromCache(QueryStageSubplanTest* test, const dbtests::WriteCon Collection* collection = ctx.getCollection(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(query); auto statusWithCQ = CanonicalQuery::canonicalize(test->opCtx(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); @@ -251,7 +251,7 @@ TEST_F(QueryStageSubplanTest, QueryStageSubplanDontCacheZeroResults) { Collection* collection = ctx.getCollection(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(query); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); @@ -307,7 +307,7 @@ TEST_F(QueryStageSubplanTest, QueryStageSubplanDontCacheTies) { Collection* collection = ctx.getCollection(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(query); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); @@ -479,7 +479,7 @@ TEST_F(QueryStageSubplanTest, QueryStageSubplanPlanRootedOrNE) { insert(BSON("_id" << 3 << "a" << 3)); insert(BSON("_id" << 4)); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson("{$or: [{a: 1}, {a: {$ne:1}}]}")); qr->setSort(BSON("d" << 1)); auto cq = unittest::assertGet(CanonicalQuery::canonicalize(opCtx(), std::move(qr))); @@ -513,7 +513,7 @@ TEST_F(QueryStageSubplanTest, QueryStageSubplanPlanRootedOrNE) { TEST_F(QueryStageSubplanTest, ShouldReportErrorIfExceedsTimeLimitDuringPlanning) { dbtests::WriteContextForTests ctx(opCtx(), nss.ns()); // Build a query with a rooted $or. - auto queryRequest = stdx::make_unique<QueryRequest>(nss); + auto queryRequest = std::make_unique<QueryRequest>(nss); queryRequest->setFilter(BSON("$or" << BSON_ARRAY(BSON("p1" << 1) << BSON("p2" << 2)))); auto canonicalQuery = uassertStatusOK(CanonicalQuery::canonicalize(opCtx(), std::move(queryRequest))); @@ -546,7 +546,7 @@ TEST_F(QueryStageSubplanTest, ShouldReportErrorIfExceedsTimeLimitDuringPlanning) TEST_F(QueryStageSubplanTest, ShouldReportErrorIfKilledDuringPlanning) { dbtests::WriteContextForTests ctx(opCtx(), nss.ns()); // Build a query with a rooted $or. - auto queryRequest = stdx::make_unique<QueryRequest>(nss); + auto queryRequest = std::make_unique<QueryRequest>(nss); queryRequest->setFilter(BSON("$or" << BSON_ARRAY(BSON("p1" << 1) << BSON("p2" << 2)))); auto canonicalQuery = uassertStatusOK(CanonicalQuery::canonicalize(opCtx(), std::move(queryRequest))); @@ -583,7 +583,7 @@ TEST_F(QueryStageSubplanTest, ShouldThrowOnRestoreIfIndexDroppedBeforePlanSelect } // Build a query with a rooted $or. - auto queryRequest = stdx::make_unique<QueryRequest>(nss); + auto queryRequest = std::make_unique<QueryRequest>(nss); queryRequest->setFilter(BSON("$or" << BSON_ARRAY(BSON("p1" << 1) << BSON("p2" << 2)))); auto canonicalQuery = uassertStatusOK(CanonicalQuery::canonicalize(opCtx(), std::move(queryRequest))); @@ -627,7 +627,7 @@ TEST_F(QueryStageSubplanTest, ShouldNotThrowOnRestoreIfIndexDroppedAfterPlanSele } // Build a query with a rooted $or. - auto queryRequest = stdx::make_unique<QueryRequest>(nss); + auto queryRequest = std::make_unique<QueryRequest>(nss); queryRequest->setFilter(BSON("$or" << BSON_ARRAY(BSON("p1" << 1) << BSON("p2" << 2)))); auto canonicalQuery = uassertStatusOK(CanonicalQuery::canonicalize(opCtx(), std::move(queryRequest))); diff --git a/src/mongo/dbtests/query_stage_tests.cpp b/src/mongo/dbtests/query_stage_tests.cpp index ae30d3ef2d2..ec2a54934e3 100644 --- a/src/mongo/dbtests/query_stage_tests.cpp +++ b/src/mongo/dbtests/query_stage_tests.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/client/dbclient_cursor.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" @@ -43,7 +45,6 @@ #include "mongo/db/namespace_string.h" #include "mongo/db/query/plan_executor.h" #include "mongo/dbtests/dbtests.h" -#include "mongo/stdx/memory.h" /** * This file tests db/exec/index_scan.cpp @@ -90,9 +91,9 @@ public: verify(statusWithMatcher.isOK()); unique_ptr<MatchExpression> filterExpr = std::move(statusWithMatcher.getValue()); - unique_ptr<WorkingSet> ws = stdx::make_unique<WorkingSet>(); + unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>(); unique_ptr<IndexScan> ix = - stdx::make_unique<IndexScan>(&_opCtx, params, ws.get(), filterExpr.get()); + std::make_unique<IndexScan>(&_opCtx, params, ws.get(), filterExpr.get()); auto statusWithPlanExecutor = PlanExecutor::make( &_opCtx, std::move(ws), std::move(ix), ctx.getCollection(), PlanExecutor::NO_YIELD); diff --git a/src/mongo/dbtests/query_stage_trial.cpp b/src/mongo/dbtests/query_stage_trial.cpp index aa5cdf6ff08..84b27d1ae8c 100644 --- a/src/mongo/dbtests/query_stage_trial.cpp +++ b/src/mongo/dbtests/query_stage_trial.cpp @@ -38,7 +38,6 @@ #include "mongo/db/operation_context.h" #include "mongo/db/query/plan_yield_policy.h" #include "mongo/db/service_context_d_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { diff --git a/src/mongo/dbtests/query_stage_update.cpp b/src/mongo/dbtests/query_stage_update.cpp index 715aa75d2ad..99829659d0c 100644 --- a/src/mongo/dbtests/query_stage_update.cpp +++ b/src/mongo/dbtests/query_stage_update.cpp @@ -33,6 +33,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/client.h" @@ -52,7 +54,6 @@ #include "mongo/db/service_context.h" #include "mongo/db/update/update_driver.h" #include "mongo/dbtests/dbtests.h" -#include "mongo/stdx/memory.h" #define ASSERT_DOES_NOT_THROW(EXPRESSION) \ try { \ @@ -67,7 +68,7 @@ namespace QueryStageUpdate { using std::unique_ptr; using std::vector; -using stdx::make_unique; +using std::make_unique; static const NamespaceString nss("unittests.QueryStageUpdate"); @@ -97,7 +98,7 @@ public: } unique_ptr<CanonicalQuery> canonicalize(const BSONObj& query) { - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(query); auto statusWithCQ = CanonicalQuery::canonicalize(&_opCtx, std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); diff --git a/src/mongo/dbtests/replica_set_tests.cpp b/src/mongo/dbtests/replica_set_tests.cpp index 34d8145606d..963a4180ca1 100644 --- a/src/mongo/dbtests/replica_set_tests.cpp +++ b/src/mongo/dbtests/replica_set_tests.cpp @@ -52,16 +52,16 @@ class ReplicaSetTest : public mongo::unittest::Test { protected: void setUp() { auto opCtx = makeOpCtx(); - _storageInterface = stdx::make_unique<repl::StorageInterfaceMock>(); + _storageInterface = std::make_unique<repl::StorageInterfaceMock>(); _dropPendingCollectionReaper = - stdx::make_unique<repl::DropPendingCollectionReaper>(_storageInterface.get()); + std::make_unique<repl::DropPendingCollectionReaper>(_storageInterface.get()); auto consistencyMarkers = - stdx::make_unique<repl::ReplicationConsistencyMarkersImpl>(_storageInterface.get()); - auto recovery = stdx::make_unique<repl::ReplicationRecoveryImpl>(_storageInterface.get(), - consistencyMarkers.get()); - _replicationProcess = stdx::make_unique<repl::ReplicationProcess>( + std::make_unique<repl::ReplicationConsistencyMarkersImpl>(_storageInterface.get()); + auto recovery = std::make_unique<repl::ReplicationRecoveryImpl>(_storageInterface.get(), + consistencyMarkers.get()); + _replicationProcess = std::make_unique<repl::ReplicationProcess>( _storageInterface.get(), std::move(consistencyMarkers), std::move(recovery)); - _replCoordExternalState = stdx::make_unique<repl::ReplicationCoordinatorExternalStateImpl>( + _replCoordExternalState = std::make_unique<repl::ReplicationCoordinatorExternalStateImpl>( opCtx->getServiceContext(), _dropPendingCollectionReaper.get(), _storageInterface.get(), diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp index 825d075b63f..d0a5f23e876 100644 --- a/src/mongo/dbtests/repltests.cpp +++ b/src/mongo/dbtests/repltests.cpp @@ -130,7 +130,7 @@ public: // to avoid the invariant in ReplClientInfo::setLastOp that the optime only goes forward. repl::ReplClientInfo::forClient(_opCtx.getClient()).clearLastOp_forTest(); - getGlobalServiceContext()->setOpObserver(stdx::make_unique<OpObserverShardingImpl>()); + getGlobalServiceContext()->setOpObserver(std::make_unique<OpObserverShardingImpl>()); setOplogCollectionName(getGlobalServiceContext()); createOplog(&_opCtx); diff --git a/src/mongo/dbtests/storage_timestamp_tests.cpp b/src/mongo/dbtests/storage_timestamp_tests.cpp index 6b1cfda9eb9..fa6345a0a7f 100644 --- a/src/mongo/dbtests/storage_timestamp_tests.cpp +++ b/src/mongo/dbtests/storage_timestamp_tests.cpp @@ -178,12 +178,12 @@ public: _opCtx->getServiceContext(), std::unique_ptr<repl::ReplicationCoordinator>(coordinatorMock)); repl::StorageInterface::set(_opCtx->getServiceContext(), - stdx::make_unique<repl::StorageInterfaceImpl>()); + std::make_unique<repl::StorageInterfaceImpl>()); auto replicationProcess = new repl::ReplicationProcess( repl::StorageInterface::get(_opCtx->getServiceContext()), - stdx::make_unique<repl::ReplicationConsistencyMarkersMock>(), - stdx::make_unique<repl::ReplicationRecoveryMock>()); + std::make_unique<repl::ReplicationConsistencyMarkersMock>(), + std::make_unique<repl::ReplicationRecoveryMock>()); repl::ReplicationProcess::set( cc().getServiceContext(), std::unique_ptr<repl::ReplicationProcess>(replicationProcess)); @@ -196,8 +196,8 @@ public: // to avoid the invariant in ReplClientInfo::setLastOp that the optime only goes forward. repl::ReplClientInfo::forClient(_opCtx->getClient()).clearLastOp_forTest(); - auto registry = stdx::make_unique<OpObserverRegistry>(); - registry->addObserver(stdx::make_unique<OpObserverShardingImpl>()); + auto registry = std::make_unique<OpObserverRegistry>(); + registry->addObserver(std::make_unique<OpObserverShardingImpl>()); _opCtx->getServiceContext()->setOpObserver(std::move(registry)); repl::setOplogCollectionName(getGlobalServiceContext()); @@ -1742,7 +1742,7 @@ public: auto storageInterface = repl::StorageInterface::get(_opCtx); repl::DropPendingCollectionReaper::set( _opCtx->getServiceContext(), - stdx::make_unique<repl::DropPendingCollectionReaper>(storageInterface)); + std::make_unique<repl::DropPendingCollectionReaper>(storageInterface)); auto kvStorageEngine = dynamic_cast<KVStorageEngine*>(_opCtx->getServiceContext()->getStorageEngine()); diff --git a/src/mongo/dbtests/validate_tests.cpp b/src/mongo/dbtests/validate_tests.cpp index 7737168b2bd..f56a280f5f5 100644 --- a/src/mongo/dbtests/validate_tests.cpp +++ b/src/mongo/dbtests/validate_tests.cpp @@ -86,7 +86,7 @@ protected: lockDb(MODE_IX); invariant(_opCtx.lockState()->isDbLockedForMode(_nss.db(), MODE_IX)); std::unique_ptr<Lock::CollectionLock> lock = - stdx::make_unique<Lock::CollectionLock>(&_opCtx, _nss, MODE_X); + std::make_unique<Lock::CollectionLock>(&_opCtx, _nss, MODE_X); invariant(_opCtx.lockState()->isCollectionLockedForMode(_nss, MODE_X)); Database* db = _autoDb.get()->getDb(); @@ -1214,7 +1214,7 @@ public: lockDb(MODE_IX); std::unique_ptr<Lock::CollectionLock> lock = - stdx::make_unique<Lock::CollectionLock>(&_opCtx, _nss, MODE_X); + std::make_unique<Lock::CollectionLock>(&_opCtx, _nss, MODE_X); Database* db = _autoDb.get()->getDb(); ASSERT_OK(db->getCollection(&_opCtx, _nss) @@ -1310,7 +1310,7 @@ public: lockDb(MODE_IX); std::unique_ptr<Lock::CollectionLock> lock = - stdx::make_unique<Lock::CollectionLock>(&_opCtx, _nss, MODE_X); + std::make_unique<Lock::CollectionLock>(&_opCtx, _nss, MODE_X); Database* db = _autoDb.get()->getDb(); ASSERT_OK(db->getCollection(&_opCtx, _nss) @@ -1394,7 +1394,7 @@ public: lockDb(MODE_IX); std::unique_ptr<Lock::CollectionLock> lock = - stdx::make_unique<Lock::CollectionLock>(&_opCtx, _nss, MODE_X); + std::make_unique<Lock::CollectionLock>(&_opCtx, _nss, MODE_X); Database* db = _autoDb.get()->getDb(); ASSERT_OK(db->getCollection(&_opCtx, _nss) |