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 | |
parent | c9548e729c8fecd9d7a9a5dd341da0433194ac73 (diff) | |
download | mongo-c36f9ecb91e49da7e637863889804fc4e6c6c05e.tar.gz |
SERVER-39339 Remove `stdx/memory.h`
613 files changed, 2548 insertions, 2519 deletions
diff --git a/src/mongo/base/secure_allocator.cpp b/src/mongo/base/secure_allocator.cpp index 67aae3fbb1b..676827d1182 100644 --- a/src/mongo/base/secure_allocator.cpp +++ b/src/mongo/base/secure_allocator.cpp @@ -44,7 +44,6 @@ #endif #include "mongo/base/init.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/unordered_map.h" #include "mongo/util/assert_util.h" diff --git a/src/mongo/client/async_client.cpp b/src/mongo/client/async_client.cpp index 7410b1a89d9..d867a629e17 100644 --- a/src/mongo/client/async_client.cpp +++ b/src/mongo/client/async_client.cpp @@ -33,6 +33,8 @@ #include "mongo/client/async_client.h" +#include <memory> + #include "mongo/bson/bsonobjbuilder.h" #include "mongo/client/authenticate.h" #include "mongo/config.h" @@ -45,7 +47,6 @@ #include "mongo/rpc/legacy_request_builder.h" #include "mongo/rpc/metadata/client_metadata.h" #include "mongo/rpc/reply_interface.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/net/socket_utils.h" #include "mongo/util/net/ssl_manager.h" diff --git a/src/mongo/client/connection_string_connect.cpp b/src/mongo/client/connection_string_connect.cpp index 888d702ab6e..76844368edc 100644 --- a/src/mongo/client/connection_string_connect.cpp +++ b/src/mongo/client/connection_string_connect.cpp @@ -38,7 +38,6 @@ #include "mongo/client/dbclient_rs.h" #include "mongo/client/mongo_uri.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" @@ -59,7 +58,7 @@ std::unique_ptr<DBClientBase> ConnectionString::connect(StringData applicationNa switch (_type) { case MASTER: { for (const auto& server : _servers) { - auto c = stdx::make_unique<DBClientConnection>(true, 0, newURI); + auto c = std::make_unique<DBClientConnection>(true, 0, newURI); c->setSoTimeout(socketTimeout); LOG(1) << "creating new connection to:" << server; @@ -73,7 +72,7 @@ std::unique_ptr<DBClientBase> ConnectionString::connect(StringData applicationNa } case SET: { - auto set = stdx::make_unique<DBClientReplicaSet>( + auto set = std::make_unique<DBClientReplicaSet>( _setName, _servers, applicationName, socketTimeout, std::move(newURI)); if (!set->connect()) { errmsg = "connect failed to replica set "; diff --git a/src/mongo/client/dbclient_connection.cpp b/src/mongo/client/dbclient_connection.cpp index c812cea4a11..a06f8d9227b 100644 --- a/src/mongo/client/dbclient_connection.cpp +++ b/src/mongo/client/dbclient_connection.cpp @@ -39,6 +39,7 @@ #include <algorithm> #include <functional> +#include <memory> #include <utility> #include "mongo/base/status.h" @@ -64,7 +65,6 @@ #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/rpc/metadata/client_metadata.h" #include "mongo/s/stale_exception.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/util/assert_util.h" #include "mongo/util/concurrency/mutex.h" diff --git a/src/mongo/client/dbclient_cursor.cpp b/src/mongo/client/dbclient_cursor.cpp index 737c9c67d77..3e049f786e5 100644 --- a/src/mongo/client/dbclient_cursor.cpp +++ b/src/mongo/client/dbclient_cursor.cpp @@ -37,6 +37,8 @@ #include "mongo/client/dbclient_cursor.h" +#include <memory> + #include "mongo/client/connpool.h" #include "mongo/db/client.h" #include "mongo/db/dbmessage.h" @@ -49,7 +51,6 @@ #include "mongo/rpc/metadata.h" #include "mongo/rpc/object_check.h" #include "mongo/s/stale_exception.h" -#include "mongo/stdx/memory.h" #include "mongo/util/bufreader.h" #include "mongo/util/debug_util.h" #include "mongo/util/destructor_guard.h" diff --git a/src/mongo/client/dbclient_rs.cpp b/src/mongo/client/dbclient_rs.cpp index d2c61154fc2..033f39b0bef 100644 --- a/src/mongo/client/dbclient_rs.cpp +++ b/src/mongo/client/dbclient_rs.cpp @@ -45,7 +45,6 @@ #include "mongo/db/auth/sasl_command_constants.h" #include "mongo/db/dbmessage.h" #include "mongo/db/jsobj.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" namespace mongo { @@ -117,7 +116,7 @@ std::unique_ptr<ReadPreferenceSetting> _extractReadPref(const BSONObj& query, in // The readPreference is embedded in the $queryOptions field. readPrefContainingObj = elem.Obj(); } - return stdx::make_unique<ReadPreferenceSetting>(uassertStatusOK( + return std::make_unique<ReadPreferenceSetting>(uassertStatusOK( ReadPreferenceSetting::fromContainingBSON(readPrefContainingObj, defaultReadPref))); } diff --git a/src/mongo/client/fetcher_test.cpp b/src/mongo/client/fetcher_test.cpp index 0f7768d458f..19713755b11 100644 --- a/src/mongo/client/fetcher_test.cpp +++ b/src/mongo/client/fetcher_test.cpp @@ -110,7 +110,7 @@ void FetcherTest::setUp() { executor::ThreadPoolExecutorTest::setUp(); clear(); callbackHook = Fetcher::CallbackFn(); - fetcher = stdx::make_unique<Fetcher>(&getExecutor(), source, "db", findCmdObj, makeCallback()); + fetcher = std::make_unique<Fetcher>(&getExecutor(), source, "db", findCmdObj, makeCallback()); launchExecutorThread(); } @@ -267,7 +267,7 @@ TEST_F(FetcherTest, RemoteCommandRequestShouldContainCommandParametersPassedToCo auto metadataObj = BSON("x" << 1); Milliseconds timeout(8000); - fetcher = stdx::make_unique<Fetcher>( + fetcher = std::make_unique<Fetcher>( &getExecutor(), source, "db", findCmdObj, doNothingCallback, metadataObj, timeout); ASSERT_EQUALS(source, fetcher->getSource()); @@ -1037,15 +1037,15 @@ TEST_F(FetcherTest, FetcherAppliesRetryPolicyToFirstCommandButNotToGetMoreReques executor::RemoteCommandRequest::kNoTimeout, {ErrorCodes::BadValue, ErrorCodes::InternalError}); - fetcher = stdx::make_unique<Fetcher>(&getExecutor(), - source, - "db", - findCmdObj, - makeCallback(), - rpc::makeEmptyMetadata(), - executor::RemoteCommandRequest::kNoTimeout, - executor::RemoteCommandRequest::kNoTimeout, - std::move(policy)); + fetcher = std::make_unique<Fetcher>(&getExecutor(), + source, + "db", + findCmdObj, + makeCallback(), + rpc::makeEmptyMetadata(), + executor::RemoteCommandRequest::kNoTimeout, + executor::RemoteCommandRequest::kNoTimeout, + std::move(policy)); callbackHook = appendGetMoreRequest; @@ -1094,7 +1094,7 @@ TEST_F(FetcherTest, FetcherResetsInternalFinishCallbackFunctionPointerAfterLastC auto sharedCallbackData = std::make_shared<SharedCallbackState>(); auto callbackInvoked = false; - fetcher = stdx::make_unique<Fetcher>( + fetcher = std::make_unique<Fetcher>( &getExecutor(), source, "db", diff --git a/src/mongo/client/remote_command_retry_scheduler.cpp b/src/mongo/client/remote_command_retry_scheduler.cpp index 01e2a43f6b0..347c6043a6a 100644 --- a/src/mongo/client/remote_command_retry_scheduler.cpp +++ b/src/mongo/client/remote_command_retry_scheduler.cpp @@ -32,10 +32,10 @@ #include "mongo/platform/basic.h" #include <algorithm> +#include <memory> #include <vector> #include "mongo/client/remote_command_retry_scheduler.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/destructor_guard.h" #include "mongo/util/log.h" @@ -127,7 +127,7 @@ RemoteCommandRetryScheduler::makeRetryPolicy( Milliseconds maxResponseElapsedTotal, const std::initializer_list<ErrorCodes::Error>& retryableErrors) { std::unique_ptr<RetryPolicy> policy = - stdx::make_unique<RetryPolicyImpl>(maxAttempts, maxResponseElapsedTotal, retryableErrors); + std::make_unique<RetryPolicyImpl>(maxAttempts, maxResponseElapsedTotal, retryableErrors); return policy; } diff --git a/src/mongo/client/remote_command_retry_scheduler_test.cpp b/src/mongo/client/remote_command_retry_scheduler_test.cpp index b8536d0fa48..6a543bc76f7 100644 --- a/src/mongo/client/remote_command_retry_scheduler_test.cpp +++ b/src/mongo/client/remote_command_retry_scheduler_test.cpp @@ -39,7 +39,6 @@ #include "mongo/executor/remote_command_response.h" #include "mongo/executor/task_executor.h" #include "mongo/executor/thread_pool_task_executor_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/task_executor_proxy.h" #include "mongo/unittest/unittest.h" #include "mongo/util/assert_util.h" @@ -498,7 +497,7 @@ public: TEST_F(RemoteCommandRetrySchedulerTest, SchedulerReturnsCallbackCanceledIfShutdownBeforeSendingRetryCommand) { CallbackResponseSaver callback; - auto policy = stdx::make_unique<ShutdownSchedulerRetryPolicy>(); + auto policy = std::make_unique<ShutdownSchedulerRetryPolicy>(); auto policyPtr = policy.get(); TaskExecutorWithFailureInScheduleRemoteCommand badExecutor(&getExecutor()); RemoteCommandRetryScheduler scheduler( diff --git a/src/mongo/client/remote_command_targeter_factory_impl.cpp b/src/mongo/client/remote_command_targeter_factory_impl.cpp index c77a0f9f919..a0a1df7b6a7 100644 --- a/src/mongo/client/remote_command_targeter_factory_impl.cpp +++ b/src/mongo/client/remote_command_targeter_factory_impl.cpp @@ -31,11 +31,12 @@ #include "mongo/client/remote_command_targeter_factory_impl.h" +#include <memory> + #include "mongo/base/status_with.h" #include "mongo/client/connection_string.h" #include "mongo/client/remote_command_targeter_rs.h" #include "mongo/client/remote_command_targeter_standalone.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" namespace mongo { @@ -50,10 +51,10 @@ std::unique_ptr<RemoteCommandTargeter> RemoteCommandTargeterFactoryImpl::create( case ConnectionString::MASTER: case ConnectionString::CUSTOM: invariant(connStr.getServers().size() == 1); - return stdx::make_unique<RemoteCommandTargeterStandalone>(connStr.getServers().front()); + return std::make_unique<RemoteCommandTargeterStandalone>(connStr.getServers().front()); case ConnectionString::SET: - return stdx::make_unique<RemoteCommandTargeterRS>(connStr.getSetName(), - connStr.getServers()); + return std::make_unique<RemoteCommandTargeterRS>(connStr.getSetName(), + connStr.getServers()); // These connections should never be seen case ConnectionString::INVALID: case ConnectionString::LOCAL: diff --git a/src/mongo/client/remote_command_targeter_factory_mock.cpp b/src/mongo/client/remote_command_targeter_factory_mock.cpp index 8c50ccd3dd8..41c2a6801b1 100644 --- a/src/mongo/client/remote_command_targeter_factory_mock.cpp +++ b/src/mongo/client/remote_command_targeter_factory_mock.cpp @@ -31,10 +31,11 @@ #include "mongo/client/remote_command_targeter_factory_mock.h" +#include <memory> + #include "mongo/base/status_with.h" #include "mongo/client/connection_string.h" #include "mongo/client/remote_command_targeter_mock.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" namespace mongo { @@ -85,10 +86,10 @@ std::unique_ptr<RemoteCommandTargeter> RemoteCommandTargeterFactoryMock::create( const ConnectionString& connStr) { auto it = _mockTargeters.find(connStr); if (it != _mockTargeters.end()) { - return stdx::make_unique<TargeterProxy>(it->second); + return std::make_unique<TargeterProxy>(it->second); } - return stdx::make_unique<RemoteCommandTargeterMock>(); + return std::make_unique<RemoteCommandTargeterMock>(); } void RemoteCommandTargeterFactoryMock::addTargeterToReturn( diff --git a/src/mongo/client/replica_set_monitor_manager.cpp b/src/mongo/client/replica_set_monitor_manager.cpp index dff3d8a16c4..2d28b77e8a0 100644 --- a/src/mongo/client/replica_set_monitor_manager.cpp +++ b/src/mongo/client/replica_set_monitor_manager.cpp @@ -33,6 +33,8 @@ #include "mongo/client/replica_set_monitor_manager.h" +#include <memory> + #include "mongo/bson/bsonobjbuilder.h" #include "mongo/client/connection_string.h" #include "mongo/client/mongo_uri.h" @@ -44,7 +46,6 @@ #include "mongo/executor/task_executor_pool.h" #include "mongo/executor/thread_pool_task_executor.h" #include "mongo/rpc/metadata/egress_metadata_hook_list.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/util/log.h" #include "mongo/util/map_util.h" @@ -79,7 +80,7 @@ shared_ptr<ReplicaSetMonitor> ReplicaSetMonitorManager::getMonitor(StringData se } void ReplicaSetMonitorManager::_setupTaskExecutorInLock(const std::string& name) { - auto hookList = stdx::make_unique<rpc::EgressMetadataHookList>(); + auto hookList = std::make_unique<rpc::EgressMetadataHookList>(); // do not restart taskExecutor if is in shutdown if (!_taskExecutor && !_isShutdown) { @@ -87,8 +88,8 @@ void ReplicaSetMonitorManager::_setupTaskExecutorInLock(const std::string& name) auto net = executor::makeNetworkInterface( "ReplicaSetMonitor-TaskExecutor", nullptr, std::move(hookList)); auto netPtr = net.get(); - _taskExecutor = stdx::make_unique<ThreadPoolTaskExecutor>( - stdx::make_unique<NetworkInterfaceThreadPool>(netPtr), std::move(net)); + _taskExecutor = std::make_unique<ThreadPoolTaskExecutor>( + std::make_unique<NetworkInterfaceThreadPool>(netPtr), std::move(net)); LOG(1) << "Starting up task executor for monitoring replica sets in response to request to " "monitor set: " << redact(name); diff --git a/src/mongo/client/replica_set_monitor_read_preference_test.cpp b/src/mongo/client/replica_set_monitor_read_preference_test.cpp index 3757c62dd61..3f738d6cd41 100644 --- a/src/mongo/client/replica_set_monitor_read_preference_test.cpp +++ b/src/mongo/client/replica_set_monitor_read_preference_test.cpp @@ -31,9 +31,10 @@ #include "mongo/client/replica_set_monitor_test_fixture.h" +#include <memory> + #include "mongo/client/mongo_uri.h" #include "mongo/client/read_preference.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace { diff --git a/src/mongo/crypto/sha_block_openssl.cpp b/src/mongo/crypto/sha_block_openssl.cpp index 9937afba477..c776985c3b7 100644 --- a/src/mongo/crypto/sha_block_openssl.cpp +++ b/src/mongo/crypto/sha_block_openssl.cpp @@ -29,12 +29,13 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/crypto/sha1_block.h" #include "mongo/crypto/sha256_block.h" #include "mongo/crypto/sha512_block.h" #include "mongo/config.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #ifndef MONGO_CONFIG_SSL diff --git a/src/mongo/db/auth/address_restriction.cpp b/src/mongo/db/auth/address_restriction.cpp index e5833b86de0..6a120f97d5f 100644 --- a/src/mongo/db/auth/address_restriction.cpp +++ b/src/mongo/db/auth/address_restriction.cpp @@ -29,10 +29,11 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/auth/address_restriction.h" #include "mongo/db/auth/address_restriction_gen.h" #include "mongo/db/server_options.h" -#include "mongo/stdx/memory.h" constexpr mongo::StringData mongo::address_restriction_detail::ClientSource::label; constexpr mongo::StringData mongo::address_restriction_detail::ClientSource::field; @@ -48,12 +49,12 @@ mongo::StatusWith<mongo::RestrictionSet<>> mongo::parseAddressRestrictionSet( const boost::optional<std::vector<StringData>>& client = ar.getClientSource(); if (client) { - vec.push_back(stdx::make_unique<ClientSourceRestriction>(client.get())); + vec.push_back(std::make_unique<ClientSourceRestriction>(client.get())); } const boost::optional<std::vector<StringData>>& server = ar.getServerAddress(); if (server) { - vec.push_back(stdx::make_unique<ServerAddressRestriction>(server.get())); + vec.push_back(std::make_unique<ServerAddressRestriction>(server.get())); } if (vec.empty()) { @@ -88,7 +89,7 @@ mongo::StatusWith<mongo::SharedRestrictionDocument> mongo::parseAuthenticationRe } doc.emplace_back( - stdx::make_unique<document_type::element_type>(std::move(restriction.getValue()))); + std::make_unique<document_type::element_type>(std::move(restriction.getValue()))); } return std::make_shared<document_type>(std::move(doc)); diff --git a/src/mongo/db/auth/auth_op_observer_test.cpp b/src/mongo/db/auth/auth_op_observer_test.cpp index 1168ae1836d..cbbff8dfe93 100644 --- a/src/mongo/db/auth/auth_op_observer_test.cpp +++ b/src/mongo/db/auth/auth_op_observer_test.cpp @@ -65,12 +65,12 @@ public: auto service = getServiceContext(); auto opCtx = cc().makeOperationContext(); - repl::StorageInterface::set(service, stdx::make_unique<repl::StorageInterfaceMock>()); + repl::StorageInterface::set(service, std::make_unique<repl::StorageInterfaceMock>()); // Set up ReplicationCoordinator and create oplog. repl::ReplicationCoordinator::set( service, - stdx::make_unique<repl::ReplicationCoordinatorMock>(service, createReplSettings())); + std::make_unique<repl::ReplicationCoordinatorMock>(service, createReplSettings())); repl::setOplogCollectionName(service); repl::createOplog(opCtx.get()); @@ -145,7 +145,7 @@ TEST_F(AuthOpObserverTest, MultipleAboutToDeleteAndOnDelete) { DEATH_TEST_F(AuthOpObserverTest, AboutToDeleteMustPreceedOnDelete, "invariant") { AuthOpObserver opObserver; auto opCtx = cc().makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerNoop>()); + opCtx->swapLockState(std::make_unique<LockerNoop>()); NamespaceString nss = {"test", "coll"}; opObserver.onDelete(opCtx.get(), nss, {}, {}, false, {}); } @@ -153,7 +153,7 @@ DEATH_TEST_F(AuthOpObserverTest, AboutToDeleteMustPreceedOnDelete, "invariant") DEATH_TEST_F(AuthOpObserverTest, EachOnDeleteRequiresAboutToDelete, "invariant") { AuthOpObserver opObserver; auto opCtx = cc().makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerNoop>()); + opCtx->swapLockState(std::make_unique<LockerNoop>()); NamespaceString nss = {"test", "coll"}; opObserver.aboutToDelete(opCtx.get(), nss, {}); opObserver.onDelete(opCtx.get(), nss, {}, {}, false, {}); diff --git a/src/mongo/db/auth/authorization_manager.cpp b/src/mongo/db/auth/authorization_manager.cpp index 0e4851d2b72..b40e48b4ece 100644 --- a/src/mongo/db/auth/authorization_manager.cpp +++ b/src/mongo/db/auth/authorization_manager.cpp @@ -57,7 +57,6 @@ #include "mongo/db/global_settings.h" #include "mongo/db/jsobj.h" #include "mongo/platform/compiler.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/unordered_map.h" #include "mongo/util/assert_util.h" diff --git a/src/mongo/db/auth/authorization_manager_impl.cpp b/src/mongo/db/auth/authorization_manager_impl.cpp index 3342212c020..07996cd2f82 100644 --- a/src/mongo/db/auth/authorization_manager_impl.cpp +++ b/src/mongo/db/auth/authorization_manager_impl.cpp @@ -62,7 +62,6 @@ #include "mongo/db/jsobj.h" #include "mongo/db/mongod_options.h" #include "mongo/platform/compiler.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/unordered_map.h" #include "mongo/util/assert_util.h" diff --git a/src/mongo/db/auth/authorization_manager_test.cpp b/src/mongo/db/auth/authorization_manager_test.cpp index f51437f697a..ab3a650d6dd 100644 --- a/src/mongo/db/auth/authorization_manager_test.cpp +++ b/src/mongo/db/auth/authorization_manager_test.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + /** * Unit tests of the AuthorizationManager type. */ @@ -51,7 +53,6 @@ #include "mongo/db/operation_context.h" #include "mongo/db/service_context_test_fixture.h" #include "mongo/db/storage/recovery_unit_noop.h" -#include "mongo/stdx/memory.h" #include "mongo/transport/session.h" #include "mongo/transport/transport_layer_mock.h" #include "mongo/unittest/unittest.h" @@ -270,10 +271,10 @@ class AuthorizationManagerWithExplicitUserPrivilegesTest : public ::mongo::unitt public: virtual void setUp() { auto localExternalState = - stdx::make_unique<AuthzManagerExternalStateMockWithExplicitUserPrivileges>(); + std::make_unique<AuthzManagerExternalStateMockWithExplicitUserPrivileges>(); externalState = localExternalState.get(); externalState->setAuthzVersion(AuthorizationManager::schemaVersion26Final); - authzManager = stdx::make_unique<AuthorizationManagerImpl>( + authzManager = std::make_unique<AuthorizationManagerImpl>( std::move(localExternalState), AuthorizationManagerImpl::InstallMockForTestingOrAuthImpl{}); externalState->setAuthorizationManager(authzManager.get()); diff --git a/src/mongo/db/auth/authorization_session_for_test.cpp b/src/mongo/db/auth/authorization_session_for_test.cpp index 7ad6378dea6..2bc20288c39 100644 --- a/src/mongo/db/auth/authorization_session_for_test.cpp +++ b/src/mongo/db/auth/authorization_session_for_test.cpp @@ -38,7 +38,6 @@ #include "mongo/db/auth/user.h" #include "mongo/db/auth/user_name.h" #include "mongo/db/auth/user_set.h" -#include "mongo/stdx/memory.h" namespace mongo { constexpr StringData AuthorizationSessionForTest::kTestDBName; diff --git a/src/mongo/db/auth/authorization_session_test.cpp b/src/mongo/db/auth/authorization_session_test.cpp index 184706257a1..09476aca817 100644 --- a/src/mongo/db/auth/authorization_session_test.cpp +++ b/src/mongo/db/auth/authorization_session_test.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + /** * Unit tests of the AuthorizationSession type. */ @@ -49,7 +51,6 @@ #include "mongo/db/namespace_string.h" #include "mongo/db/operation_context.h" #include "mongo/db/service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/transport/session.h" #include "mongo/transport/transport_layer_mock.h" #include "mongo/unittest/unittest.h" @@ -102,9 +103,9 @@ public: session = transportLayer.createSession(); client = serviceContext->makeClient("testClient", session); RestrictionEnvironment::set( - session, stdx::make_unique<RestrictionEnvironment>(SockAddr(), SockAddr())); + session, std::make_unique<RestrictionEnvironment>(SockAddr(), SockAddr())); _opCtx = client->makeOperationContext(); - auto localManagerState = stdx::make_unique<FailureCapableAuthzManagerExternalStateMock>(); + auto localManagerState = std::make_unique<FailureCapableAuthzManagerExternalStateMock>(); managerState = localManagerState.get(); managerState->setAuthzVersion(AuthorizationManager::schemaVersion26Final); auto uniqueAuthzManager = std::make_unique<AuthorizationManagerImpl>( @@ -583,16 +584,16 @@ TEST_F(AuthorizationSessionTest, AcquireUserObtainsAndValidatesAuthenticationRes auto assertWorks = [this](StringData clientSource, StringData serverAddress) { RestrictionEnvironment::set( session, - stdx::make_unique<RestrictionEnvironment>(SockAddr(clientSource, 5555, AF_UNSPEC), - SockAddr(serverAddress, 27017, AF_UNSPEC))); + std::make_unique<RestrictionEnvironment>(SockAddr(clientSource, 5555, AF_UNSPEC), + SockAddr(serverAddress, 27017, AF_UNSPEC))); ASSERT_OK(authzSession->addAndAuthorizeUser(_opCtx.get(), UserName("spencer", "test"))); }; auto assertFails = [this](StringData clientSource, StringData serverAddress) { RestrictionEnvironment::set( session, - stdx::make_unique<RestrictionEnvironment>(SockAddr(clientSource, 5555, AF_UNSPEC), - SockAddr(serverAddress, 27017, AF_UNSPEC))); + std::make_unique<RestrictionEnvironment>(SockAddr(clientSource, 5555, AF_UNSPEC), + SockAddr(serverAddress, 27017, AF_UNSPEC))); ASSERT_NOT_OK(authzSession->addAndAuthorizeUser(_opCtx.get(), UserName("spencer", "test"))); }; diff --git a/src/mongo/db/auth/authz_manager_external_state_d.cpp b/src/mongo/db/auth/authz_manager_external_state_d.cpp index 2257f144aed..adfbfb083ca 100644 --- a/src/mongo/db/auth/authz_manager_external_state_d.cpp +++ b/src/mongo/db/auth/authz_manager_external_state_d.cpp @@ -33,6 +33,8 @@ #include "mongo/db/auth/authz_manager_external_state_d.h" +#include <memory> + #include "mongo/base/status.h" #include "mongo/db/auth/authz_session_external_state_d.h" #include "mongo/db/auth/user_name.h" @@ -44,7 +46,6 @@ #include "mongo/db/operation_context.h" #include "mongo/db/service_context.h" #include "mongo/db/storage/storage_engine.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" #include "mongo/util/str.h" @@ -56,7 +57,7 @@ AuthzManagerExternalStateMongod::~AuthzManagerExternalStateMongod() = default; std::unique_ptr<AuthzSessionExternalState> AuthzManagerExternalStateMongod::makeAuthzSessionExternalState(AuthorizationManager* authzManager) { - return stdx::make_unique<AuthzSessionExternalStateMongod>(authzManager); + return std::make_unique<AuthzSessionExternalStateMongod>(authzManager); } Status AuthzManagerExternalStateMongod::query( OperationContext* opCtx, diff --git a/src/mongo/db/auth/authz_manager_external_state_mock.cpp b/src/mongo/db/auth/authz_manager_external_state_mock.cpp index e4951dc4c8c..42ad4dd5b53 100644 --- a/src/mongo/db/auth/authz_manager_external_state_mock.cpp +++ b/src/mongo/db/auth/authz_manager_external_state_mock.cpp @@ -31,6 +31,7 @@ #include "mongo/db/auth/authz_manager_external_state_mock.h" +#include <memory> #include <string> #include "mongo/base/status.h" @@ -44,7 +45,6 @@ #include "mongo/db/namespace_string.h" #include "mongo/db/operation_context_noop.h" #include "mongo/db/update/update_driver.h" -#include "mongo/stdx/memory.h" #include "mongo/util/map_util.h" #include "mongo/util/str.h" @@ -110,7 +110,7 @@ void AuthzManagerExternalStateMock::setAuthzVersion(int version) { std::unique_ptr<AuthzSessionExternalState> AuthzManagerExternalStateMock::makeAuthzSessionExternalState(AuthorizationManager* authzManager) { - return stdx::make_unique<AuthzSessionExternalStateMock>(authzManager); + return std::make_unique<AuthzSessionExternalStateMock>(authzManager); } Status AuthzManagerExternalStateMock::findOne(OperationContext* opCtx, diff --git a/src/mongo/db/auth/authz_manager_external_state_s.cpp b/src/mongo/db/auth/authz_manager_external_state_s.cpp index fdb23453592..98893954d4e 100644 --- a/src/mongo/db/auth/authz_manager_external_state_s.cpp +++ b/src/mongo/db/auth/authz_manager_external_state_s.cpp @@ -44,7 +44,6 @@ #include "mongo/db/operation_context.h" #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/s/grid.h" -#include "mongo/stdx/memory.h" #include "mongo/util/net/ssl_types.h" #include "mongo/util/str.h" @@ -94,7 +93,7 @@ Status AuthzManagerExternalStateMongos::initialize(OperationContext* opCtx) { std::unique_ptr<AuthzSessionExternalState> AuthzManagerExternalStateMongos::makeAuthzSessionExternalState(AuthorizationManager* authzManager) { - return stdx::make_unique<AuthzSessionExternalStateMongos>(authzManager); + return std::make_unique<AuthzSessionExternalStateMongos>(authzManager); } Status AuthzManagerExternalStateMongos::getStoredAuthorizationVersion(OperationContext* opCtx, diff --git a/src/mongo/db/auth/restriction_environment.h b/src/mongo/db/auth/restriction_environment.h index a84a402ed42..6b6b279fe1c 100644 --- a/src/mongo/db/auth/restriction_environment.h +++ b/src/mongo/db/auth/restriction_environment.h @@ -29,8 +29,9 @@ #pragma once +#include <memory> + #include "mongo/db/client.h" -#include "mongo/stdx/memory.h" #include "mongo/transport/session.h" #include "mongo/util/net/sockaddr.h" diff --git a/src/mongo/db/auth/restriction_set.h b/src/mongo/db/auth/restriction_set.h index d50e026b754..66f182ebbdc 100644 --- a/src/mongo/db/auth/restriction_set.h +++ b/src/mongo/db/auth/restriction_set.h @@ -33,7 +33,6 @@ #include <vector> #include "mongo/db/auth/restriction.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -122,7 +121,7 @@ public: } explicit RestrictionSetAll(const T& restriction) { - _restrictions.push_back(stdx::make_unique<T>(restriction)); + _restrictions.push_back(std::make_unique<T>(restriction)); } Status validate(const RestrictionEnvironment& environment) const final { diff --git a/src/mongo/db/auth/restriction_test.cpp b/src/mongo/db/auth/restriction_test.cpp index 71f26603e36..f48e379f638 100644 --- a/src/mongo/db/auth/restriction_test.cpp +++ b/src/mongo/db/auth/restriction_test.cpp @@ -49,7 +49,7 @@ TEST(RestrictionSetTest, EmptyRestrictionSetAllValidates) { TEST(RestrictionSetTest, RestrictionSetAllWithMetRestrictionValidates) { RestrictionEnvironment env{SockAddr(), SockAddr()}; std::vector<std::unique_ptr<UnnamedRestriction>> restrictions; - restrictions.push_back(stdx::make_unique<RestrictionMock>(true)); + restrictions.push_back(std::make_unique<RestrictionMock>(true)); RestrictionSetAll<UnnamedRestriction> set(std::move(restrictions)); ASSERT_OK(set.validate(env)); } @@ -57,8 +57,8 @@ TEST(RestrictionSetTest, RestrictionSetAllWithMetRestrictionValidates) { TEST(RestrictionSetTest, RestrictionSetAllWithMetRestrictionsValidates) { RestrictionEnvironment env{SockAddr(), SockAddr()}; std::vector<std::unique_ptr<UnnamedRestriction>> restrictions; - restrictions.push_back(stdx::make_unique<RestrictionMock>(true)); - restrictions.push_back(stdx::make_unique<RestrictionMock>(true)); + restrictions.push_back(std::make_unique<RestrictionMock>(true)); + restrictions.push_back(std::make_unique<RestrictionMock>(true)); RestrictionSetAll<UnnamedRestriction> set(std::move(restrictions)); ASSERT_OK(set.validate(env)); } @@ -66,7 +66,7 @@ TEST(RestrictionSetTest, RestrictionSetAllWithMetRestrictionsValidates) { TEST(RestrictionSetTest, RestrictionSetAllWithFailedRestrictionFails) { RestrictionEnvironment env{SockAddr(), SockAddr()}; std::vector<std::unique_ptr<UnnamedRestriction>> restrictions; - restrictions.push_back(stdx::make_unique<RestrictionMock>(false)); + restrictions.push_back(std::make_unique<RestrictionMock>(false)); RestrictionSetAll<UnnamedRestriction> set(std::move(restrictions)); ASSERT_NOT_OK(set.validate(env)); } @@ -74,8 +74,8 @@ TEST(RestrictionSetTest, RestrictionSetAllWithFailedRestrictionFails) { TEST(RestrictionSetTest, RestrictionSetAllWithMetAndUnmetRestrictionsFails) { RestrictionEnvironment env{SockAddr(), SockAddr()}; std::vector<std::unique_ptr<UnnamedRestriction>> restrictions; - restrictions.push_back(stdx::make_unique<RestrictionMock>(true)); - restrictions.push_back(stdx::make_unique<RestrictionMock>(false)); + restrictions.push_back(std::make_unique<RestrictionMock>(true)); + restrictions.push_back(std::make_unique<RestrictionMock>(false)); RestrictionSetAll<UnnamedRestriction> set(std::move(restrictions)); ASSERT_NOT_OK(set.validate(env)); } @@ -90,7 +90,7 @@ TEST(RestrictionSetTest, EmptyRestrictionSetAnyValidates) { TEST(RestrictionSetTest, RestrictionSetAnyWithMetRestrictionValidates) { RestrictionEnvironment env{SockAddr(), SockAddr()}; std::vector<std::unique_ptr<UnnamedRestriction>> restrictions; - restrictions.push_back(stdx::make_unique<RestrictionMock>(true)); + restrictions.push_back(std::make_unique<RestrictionMock>(true)); RestrictionSetAny<UnnamedRestriction> set(std::move(restrictions)); ASSERT_OK(set.validate(env)); } @@ -98,7 +98,7 @@ TEST(RestrictionSetTest, RestrictionSetAnyWithMetRestrictionValidates) { TEST(RestrictionSetTest, RestrictionSetAnyWithFailedRestrictionFails) { RestrictionEnvironment env{SockAddr(), SockAddr()}; std::vector<std::unique_ptr<UnnamedRestriction>> restrictions; - restrictions.push_back(stdx::make_unique<RestrictionMock>(false)); + restrictions.push_back(std::make_unique<RestrictionMock>(false)); RestrictionSetAny<UnnamedRestriction> set(std::move(restrictions)); ASSERT_NOT_OK(set.validate(env)); } @@ -106,8 +106,8 @@ TEST(RestrictionSetTest, RestrictionSetAnyWithFailedRestrictionFails) { TEST(RestrictionSetTest, RestrictionSetAnyWithMetAndUnmetRestrictionsValidates) { RestrictionEnvironment env{SockAddr(), SockAddr()}; std::vector<std::unique_ptr<UnnamedRestriction>> restrictions; - restrictions.push_back(stdx::make_unique<RestrictionMock>(true)); - restrictions.push_back(stdx::make_unique<RestrictionMock>(false)); + restrictions.push_back(std::make_unique<RestrictionMock>(true)); + restrictions.push_back(std::make_unique<RestrictionMock>(false)); RestrictionSetAny<UnnamedRestriction> set(std::move(restrictions)); ASSERT_OK(set.validate(env)); } @@ -138,9 +138,9 @@ TEST(RestrictionSetTest, SerializeRestrictionSetToBSON) { ASSERT_BSONOBJ_EQ(emptySet.toBSON(), BSONObj()); std::vector<std::unique_ptr<NamedRestriction>> restrictions; - restrictions.push_back(stdx::make_unique<NamedRestrictionMock>("a", true)); - restrictions.push_back(stdx::make_unique<NamedRestrictionMock>("b", false)); - restrictions.push_back(stdx::make_unique<NamedRestrictionMock>("c", true)); + restrictions.push_back(std::make_unique<NamedRestrictionMock>("a", true)); + restrictions.push_back(std::make_unique<NamedRestrictionMock>("b", false)); + restrictions.push_back(std::make_unique<NamedRestrictionMock>("c", true)); RestrictionSet<> mockSet(std::move(restrictions)); ASSERT_BSONOBJ_EQ(mockSet.toBSON(), BSON("a" << true << "b" << false << "c" << true)); } @@ -150,9 +150,9 @@ TEST(RestrictionSetTest, SerializeRestrictionSetAnyToBSON) { ASSERT_BSONOBJ_EQ(emptySet.toBSON(), BSONArray()); std::vector<std::unique_ptr<UnnamedRestriction>> restrictions; - restrictions.push_back(stdx::make_unique<RestrictionMock>(true)); - restrictions.push_back(stdx::make_unique<RestrictionMock>(false)); - restrictions.push_back(stdx::make_unique<RestrictionMock>(true)); + restrictions.push_back(std::make_unique<RestrictionMock>(true)); + restrictions.push_back(std::make_unique<RestrictionMock>(false)); + restrictions.push_back(std::make_unique<RestrictionMock>(true)); RestrictionSetAny<UnnamedRestriction> mockSet(std::move(restrictions)); ASSERT_BSONOBJ_EQ(mockSet.toBSON(), BSON_ARRAY(true << false << true)); @@ -163,9 +163,9 @@ TEST(RestrictionSetTest, SerializeRestrictionDocumentToBSON) { ASSERT_BSONOBJ_EQ(emptyDoc.toBSON(), BSONArray()); std::vector<std::unique_ptr<NamedRestriction>> restrictions; - restrictions.push_back(stdx::make_unique<NamedRestrictionMock>("truthy", true)); - restrictions.push_back(stdx::make_unique<NamedRestrictionMock>("falsey", false)); - auto mockSet = stdx::make_unique<RestrictionSet<>>(std::move(restrictions)); + restrictions.push_back(std::make_unique<NamedRestrictionMock>("truthy", true)); + restrictions.push_back(std::make_unique<NamedRestrictionMock>("falsey", false)); + auto mockSet = std::make_unique<RestrictionSet<>>(std::move(restrictions)); RestrictionDocument<> mockDoc(std::move(mockSet)); ASSERT_BSONOBJ_EQ(mockDoc.toBSON(), BSON_ARRAY(BSON("truthy" << true << "falsey" << false))); } @@ -175,10 +175,10 @@ TEST(RestrictionSetTest, SerializeRestrictionDocumentsToBSON) { ASSERT_BSONOBJ_EQ(emptyDoc.toBSON(), BSONArray()); std::vector<std::unique_ptr<NamedRestriction>> restrictions; - restrictions.push_back(stdx::make_unique<NamedRestrictionMock>("truthy", true)); - restrictions.push_back(stdx::make_unique<NamedRestrictionMock>("falsey", false)); - auto mockSet = stdx::make_unique<RestrictionSet<>>(std::move(restrictions)); - auto mockDoc = stdx::make_unique<RestrictionDocument<>>(std::move(mockSet)); + restrictions.push_back(std::make_unique<NamedRestrictionMock>("truthy", true)); + restrictions.push_back(std::make_unique<NamedRestrictionMock>("falsey", false)); + auto mockSet = std::make_unique<RestrictionSet<>>(std::move(restrictions)); + auto mockDoc = std::make_unique<RestrictionDocument<>>(std::move(mockSet)); RestrictionDocuments mockDocs(std::move(mockDoc)); ASSERT_BSONOBJ_EQ(mockDocs.toBSON(), BSON_ARRAY(BSON_ARRAY(BSON("truthy" << true << "falsey" << false)))); diff --git a/src/mongo/db/auth/sasl_scram_test.cpp b/src/mongo/db/auth/sasl_scram_test.cpp index 0a6ee532849..6bfd66667eb 100644 --- a/src/mongo/db/auth/sasl_scram_test.cpp +++ b/src/mongo/db/auth/sasl_scram_test.cpp @@ -31,6 +31,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/client/native_sasl_client_session.h" #include "mongo/client/scram_client_cache.h" #include "mongo/crypto/mechanism_scram.h" @@ -45,7 +47,6 @@ #include "mongo/db/auth/sasl_mechanism_registry.h" #include "mongo/db/auth/sasl_scram_server_conversation.h" #include "mongo/db/service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/base64.h" #include "mongo/util/log.h" diff --git a/src/mongo/db/catalog/capped_utils_test.cpp b/src/mongo/db/catalog/capped_utils_test.cpp index f474978550a..444a4c73fdc 100644 --- a/src/mongo/db/catalog/capped_utils_test.cpp +++ b/src/mongo/db/catalog/capped_utils_test.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/catalog/capped_utils.h" #include "mongo/db/catalog/collection_catalog_entry.h" #include "mongo/db/client.h" @@ -37,7 +39,6 @@ #include "mongo/db/repl/replication_coordinator_mock.h" #include "mongo/db/repl/storage_interface_impl.h" #include "mongo/db/service_context_d_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace { @@ -61,11 +62,11 @@ void CappedUtilsTest::setUp() { auto service = getServiceContext(); // Set up ReplicationCoordinator and ensure that we are primary. - auto replCoord = stdx::make_unique<repl::ReplicationCoordinatorMock>(service); + auto replCoord = std::make_unique<repl::ReplicationCoordinatorMock>(service); ASSERT_OK(replCoord->setFollowerMode(repl::MemberState::RS_PRIMARY)); repl::ReplicationCoordinator::set(service, std::move(replCoord)); - _storage = stdx::make_unique<repl::StorageInterfaceImpl>(); + _storage = std::make_unique<repl::StorageInterfaceImpl>(); } void CappedUtilsTest::tearDown() { diff --git a/src/mongo/db/catalog/catalog_test_fixture.cpp b/src/mongo/db/catalog/catalog_test_fixture.cpp index f90c7187580..5e56e7f8a83 100644 --- a/src/mongo/db/catalog/catalog_test_fixture.cpp +++ b/src/mongo/db/catalog/catalog_test_fixture.cpp @@ -46,11 +46,11 @@ void CatalogTestFixture::setUp() { auto service = getServiceContext(); // Set up ReplicationCoordinator and ensure that we are primary. - auto replCoord = stdx::make_unique<repl::ReplicationCoordinatorMock>(service); + auto replCoord = std::make_unique<repl::ReplicationCoordinatorMock>(service); ASSERT_OK(replCoord->setFollowerMode(repl::MemberState::RS_PRIMARY)); repl::ReplicationCoordinator::set(service, std::move(replCoord)); - _storage = stdx::make_unique<repl::StorageInterfaceImpl>(); + _storage = std::make_unique<repl::StorageInterfaceImpl>(); _opCtx = cc().makeOperationContext(); } diff --git a/src/mongo/db/catalog/collection_impl.cpp b/src/mongo/db/catalog/collection_impl.cpp index 6052174f5ff..4356a9f2dfc 100644 --- a/src/mongo/db/catalog/collection_impl.cpp +++ b/src/mongo/db/catalog/collection_impl.cpp @@ -206,7 +206,7 @@ CollectionImpl::CollectionImpl(OperationContext* opCtx, _indexCatalog( std::make_unique<IndexCatalogImpl>(this, getCatalogEntry()->getMaxAllowedIndexes())), _cappedNotifier(_recordStore && _recordStore->isCapped() - ? stdx::make_unique<CappedInsertNotifier>() + ? std::make_unique<CappedInsertNotifier>() : nullptr) { if (isCapped()) _recordStore->setCappedCallback(this); @@ -1229,7 +1229,7 @@ void _reportValidationResults(OperationContext* opCtx, std::unique_ptr<BSONObjBuilder> indexDetails; if (level == kValidateFull) { - indexDetails = stdx::make_unique<BSONObjBuilder>(); + indexDetails = std::make_unique<BSONObjBuilder>(); } // Report index validation results. diff --git a/src/mongo/db/catalog/collection_info_cache_impl.cpp b/src/mongo/db/catalog/collection_info_cache_impl.cpp index 36a5f8acf10..f08c5e3bbb1 100644 --- a/src/mongo/db/catalog/collection_info_cache_impl.cpp +++ b/src/mongo/db/catalog/collection_info_cache_impl.cpp @@ -33,6 +33,8 @@ #include "mongo/db/catalog/collection_info_cache_impl.h" +#include <memory> + #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/index_catalog.h" #include "mongo/db/concurrency/d_concurrency.h" @@ -45,7 +47,6 @@ #include "mongo/db/query/planner_ixselect.h" #include "mongo/db/service_context.h" #include "mongo/db/ttl_collection_cache.h" -#include "mongo/stdx/memory.h" #include "mongo/util/clock_source.h" #include "mongo/util/log.h" @@ -55,8 +56,8 @@ CollectionInfoCacheImpl::CollectionInfoCacheImpl(Collection* collection, const N : _collection(collection), _ns(ns), _keysComputed(false), - _planCache(stdx::make_unique<PlanCache>(ns.ns())), - _querySettings(stdx::make_unique<QuerySettings>()), + _planCache(std::make_unique<PlanCache>(ns.ns())), + _querySettings(std::make_unique<QuerySettings>()), _indexUsageTracker(getGlobalServiceContext()->getPreciseClockSource()) {} CollectionInfoCacheImpl::~CollectionInfoCacheImpl() { diff --git a/src/mongo/db/catalog/collection_test.cpp b/src/mongo/db/catalog/collection_test.cpp index 8ea1f492b7d..0265f2408fb 100644 --- a/src/mongo/db/catalog/collection_test.cpp +++ b/src/mongo/db/catalog/collection_test.cpp @@ -29,13 +29,14 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/bson/oid.h" #include "mongo/db/catalog/capped_utils.h" #include "mongo/db/catalog/catalog_test_fixture.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/db_raii.h" #include "mongo/db/repl/storage_interface_impl.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/unittest/unittest.h" diff --git a/src/mongo/db/catalog/create_collection_test.cpp b/src/mongo/db/catalog/create_collection_test.cpp index 591855f4479..cad2aa82562 100644 --- a/src/mongo/db/catalog/create_collection_test.cpp +++ b/src/mongo/db/catalog/create_collection_test.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/catalog/collection_catalog.h" #include "mongo/db/catalog/collection_catalog_entry.h" #include "mongo/db/catalog/create_collection.h" @@ -39,7 +41,6 @@ #include "mongo/db/repl/replication_coordinator_mock.h" #include "mongo/db/repl/storage_interface_impl.h" #include "mongo/db/service_context_d_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/uuid.h" @@ -64,11 +65,11 @@ void CreateCollectionTest::setUp() { auto service = getServiceContext(); // Set up ReplicationCoordinator and ensure that we are primary. - auto replCoord = stdx::make_unique<repl::ReplicationCoordinatorMock>(service); + auto replCoord = std::make_unique<repl::ReplicationCoordinatorMock>(service); ASSERT_OK(replCoord->setFollowerMode(repl::MemberState::RS_PRIMARY)); repl::ReplicationCoordinator::set(service, std::move(replCoord)); - _storage = stdx::make_unique<repl::StorageInterfaceImpl>(); + _storage = std::make_unique<repl::StorageInterfaceImpl>(); } void CreateCollectionTest::tearDown() { diff --git a/src/mongo/db/catalog/database_holder_impl.cpp b/src/mongo/db/catalog/database_holder_impl.cpp index cab4b7bb007..c09894a5698 100644 --- a/src/mongo/db/catalog/database_holder_impl.cpp +++ b/src/mongo/db/catalog/database_holder_impl.cpp @@ -142,7 +142,7 @@ Database* DatabaseHolderImpl::openDb(OperationContext* opCtx, StringData ns, boo *justCreated = true; } - auto newDb = stdx::make_unique<DatabaseImpl>(dbname, ++_epoch); + auto newDb = std::make_unique<DatabaseImpl>(dbname, ++_epoch); newDb->init(opCtx); // Finally replace our nullptr entry with the new Database pointer. diff --git a/src/mongo/db/catalog/database_impl.cpp b/src/mongo/db/catalog/database_impl.cpp index fc3f00c1511..8e7738e4e5f 100644 --- a/src/mongo/db/catalog/database_impl.cpp +++ b/src/mongo/db/catalog/database_impl.cpp @@ -74,7 +74,6 @@ #include "mongo/db/views/view_catalog.h" #include "mongo/platform/random.h" #include "mongo/s/cannot_implicitly_create_collection_info.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/log.h" diff --git a/src/mongo/db/catalog/database_test.cpp b/src/mongo/db/catalog/database_test.cpp index 4a9d08b678b..e1e6b8ecca1 100644 --- a/src/mongo/db/catalog/database_test.cpp +++ b/src/mongo/db/catalog/database_test.cpp @@ -30,6 +30,8 @@ #include "mongo/platform/basic.h" #include <boost/optional/optional_io.hpp> +#include <memory> + #include <pcrecpp.h> #include "mongo/bson/util/builder.h" @@ -55,7 +57,6 @@ #include "mongo/db/repl/storage_interface_mock.h" #include "mongo/db/s/op_observer_sharding_impl.h" #include "mongo/db/service_context_d_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/scopeguard.h" @@ -84,14 +85,14 @@ void DatabaseTest::setUp() { auto service = getServiceContext(); _opCtx = cc().makeOperationContext(); - repl::StorageInterface::set(service, stdx::make_unique<repl::StorageInterfaceMock>()); + repl::StorageInterface::set(service, std::make_unique<repl::StorageInterfaceMock>()); repl::DropPendingCollectionReaper::set( service, - stdx::make_unique<repl::DropPendingCollectionReaper>(repl::StorageInterface::get(service))); + std::make_unique<repl::DropPendingCollectionReaper>(repl::StorageInterface::get(service))); // Set up ReplicationCoordinator and create oplog. repl::ReplicationCoordinator::set(service, - stdx::make_unique<repl::ReplicationCoordinatorMock>(service)); + std::make_unique<repl::ReplicationCoordinatorMock>(service)); repl::setOplogCollectionName(service); repl::createOplog(_opCtx.get()); @@ -103,7 +104,7 @@ void DatabaseTest::setUp() { // repl::logOp(). repl::logOp() will also store the oplog entry's optime in ReplClientInfo. OpObserverRegistry* opObserverRegistry = dynamic_cast<OpObserverRegistry*>(service->getOpObserver()); - opObserverRegistry->addObserver(stdx::make_unique<OpObserverShardingImpl>()); + opObserverRegistry->addObserver(std::make_unique<OpObserverShardingImpl>()); _nss = NamespaceString("test.foo"); } diff --git a/src/mongo/db/catalog/drop_database_test.cpp b/src/mongo/db/catalog/drop_database_test.cpp index d7f13c67e90..4fe1d2bc098 100644 --- a/src/mongo/db/catalog/drop_database_test.cpp +++ b/src/mongo/db/catalog/drop_database_test.cpp @@ -29,6 +29,7 @@ #include "mongo/platform/basic.h" +#include <memory> #include <set> #include "mongo/db/catalog/create_collection.h" @@ -50,7 +51,6 @@ #include "mongo/db/repl/replication_coordinator_mock.h" #include "mongo/db/repl/storage_interface_mock.h" #include "mongo/db/service_context_d_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/assert_util.h" #include "mongo/util/str.h" @@ -138,13 +138,13 @@ void DropDatabaseTest::setUp() { auto service = getServiceContext(); _opCtx = cc().makeOperationContext(); - repl::StorageInterface::set(service, stdx::make_unique<repl::StorageInterfaceMock>()); + repl::StorageInterface::set(service, std::make_unique<repl::StorageInterfaceMock>()); repl::DropPendingCollectionReaper::set( service, - stdx::make_unique<repl::DropPendingCollectionReaper>(repl::StorageInterface::get(service))); + std::make_unique<repl::DropPendingCollectionReaper>(repl::StorageInterface::get(service))); // Set up ReplicationCoordinator and create oplog. - auto replCoord = stdx::make_unique<repl::ReplicationCoordinatorMock>(service); + auto replCoord = std::make_unique<repl::ReplicationCoordinatorMock>(service); _replCoord = replCoord.get(); repl::ReplicationCoordinator::set(service, std::move(replCoord)); repl::setOplogCollectionName(service); @@ -156,7 +156,7 @@ void DropDatabaseTest::setUp() { // Use OpObserverMock to track notifications for collection and database drops. OpObserverRegistry* opObserverRegistry = dynamic_cast<OpObserverRegistry*>(service->getOpObserver()); - auto mockObserver = stdx::make_unique<OpObserverMock>(); + auto mockObserver = std::make_unique<OpObserverMock>(); _opObserver = mockObserver.get(); opObserverRegistry->addObserver(std::move(mockObserver)); diff --git a/src/mongo/db/catalog/index_build_block.cpp b/src/mongo/db/catalog/index_build_block.cpp index df5e7c578a4..98ce154ca7e 100644 --- a/src/mongo/db/catalog/index_build_block.cpp +++ b/src/mongo/db/catalog/index_build_block.cpp @@ -64,7 +64,7 @@ Status IndexCatalogImpl::IndexBuildBlock::init(OperationContext* opCtx, Collecti // need this first for names, etc... BSONObj keyPattern = _spec.getObjectField("key"); - auto descriptor = stdx::make_unique<IndexDescriptor>( + auto descriptor = std::make_unique<IndexDescriptor>( collection, IndexNames::findPluginName(keyPattern), _spec); _indexName = descriptor->indexName(); @@ -92,7 +92,7 @@ Status IndexCatalogImpl::IndexBuildBlock::init(OperationContext* opCtx, Collecti opCtx, std::move(descriptor), initFromDisk, isReadyIndex); if (_method == IndexBuildMethod::kHybrid) { - _indexBuildInterceptor = stdx::make_unique<IndexBuildInterceptor>(opCtx, _entry); + _indexBuildInterceptor = std::make_unique<IndexBuildInterceptor>(opCtx, _entry); _entry->setIndexBuildInterceptor(_indexBuildInterceptor.get()); if (IndexBuildProtocol::kTwoPhase == protocol) { diff --git a/src/mongo/db/catalog/index_catalog_entry_impl.cpp b/src/mongo/db/catalog/index_catalog_entry_impl.cpp index d2ac8ef2cb7..7599297b5ca 100644 --- a/src/mongo/db/catalog/index_catalog_entry_impl.cpp +++ b/src/mongo/db/catalog/index_catalog_entry_impl.cpp @@ -34,6 +34,7 @@ #include "mongo/db/catalog/index_catalog_entry_impl.h" #include <algorithm> +#include <memory> #include "mongo/base/init.h" #include "mongo/db/catalog/collection_catalog_entry.h" @@ -49,7 +50,6 @@ #include "mongo/db/query/collation/collator_factory_interface.h" #include "mongo/db/service_context.h" #include "mongo/db/transaction_participant.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/scopeguard.h" diff --git a/src/mongo/db/catalog/index_catalog_impl.cpp b/src/mongo/db/catalog/index_catalog_impl.cpp index a634d4c8157..4a061221042 100644 --- a/src/mongo/db/catalog/index_catalog_impl.cpp +++ b/src/mongo/db/catalog/index_catalog_impl.cpp @@ -113,7 +113,7 @@ Status IndexCatalogImpl::init(OperationContext* opCtx) { BSONObj keyPattern = spec.getObjectField("key"); auto descriptor = - stdx::make_unique<IndexDescriptor>(_collection, _getAccessMethodName(keyPattern), spec); + std::make_unique<IndexDescriptor>(_collection, _getAccessMethodName(keyPattern), spec); const bool initFromDisk = true; const bool isReadyIndex = true; IndexCatalogEntry* entry = @@ -1232,7 +1232,7 @@ const IndexDescriptor* IndexCatalogImpl::refreshEntry(OperationContext* opCtx, // Re-register this index in the index catalog with the new spec. auto newDesc = - stdx::make_unique<IndexDescriptor>(_collection, _getAccessMethodName(keyPattern), spec); + std::make_unique<IndexDescriptor>(_collection, _getAccessMethodName(keyPattern), spec); const bool initFromDisk = false; const bool isReadyIndex = true; const IndexCatalogEntry* newEntry = diff --git a/src/mongo/db/catalog/private/record_store_validate_adaptor.cpp b/src/mongo/db/catalog/private/record_store_validate_adaptor.cpp index bb19f9fd11a..3d4f68eb66c 100644 --- a/src/mongo/db/catalog/private/record_store_validate_adaptor.cpp +++ b/src/mongo/db/catalog/private/record_store_validate_adaptor.cpp @@ -167,7 +167,7 @@ void RecordStoreValidateAdaptor::traverseIndex(const IndexAccessMethod* iam, // We want to use the latest version of KeyString here. std::unique_ptr<KeyString> indexKeyString = - stdx::make_unique<KeyString>(version, indexEntry->key, ord, indexEntry->loc); + std::make_unique<KeyString>(version, indexEntry->key, ord, indexEntry->loc); // Ensure that the index entries are in increasing or decreasing order. if (!isFirstEntry && *indexKeyString < *prevIndexKeyString) { if (results && results->valid) { diff --git a/src/mongo/db/catalog/rename_collection_test.cpp b/src/mongo/db/catalog/rename_collection_test.cpp index ddf02872942..cc90a4a83a2 100644 --- a/src/mongo/db/catalog/rename_collection_test.cpp +++ b/src/mongo/db/catalog/rename_collection_test.cpp @@ -29,6 +29,7 @@ #include "mongo/platform/basic.h" +#include <memory> #include <set> #include <string> #include <vector> @@ -56,7 +57,6 @@ #include "mongo/db/repl/replication_coordinator_mock.h" #include "mongo/db/repl/storage_interface_mock.h" #include "mongo/db/service_context_d_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" #include "mongo/util/assert_util.h" @@ -275,13 +275,13 @@ void RenameCollectionTest::setUp() { auto service = getServiceContext(); _opCtx = cc().makeOperationContext(); - repl::StorageInterface::set(service, stdx::make_unique<repl::StorageInterfaceMock>()); + repl::StorageInterface::set(service, std::make_unique<repl::StorageInterfaceMock>()); repl::DropPendingCollectionReaper::set( service, - stdx::make_unique<repl::DropPendingCollectionReaper>(repl::StorageInterface::get(service))); + std::make_unique<repl::DropPendingCollectionReaper>(repl::StorageInterface::get(service))); // Set up ReplicationCoordinator and create oplog. - auto replCoord = stdx::make_unique<repl::ReplicationCoordinatorMock>(service); + auto replCoord = std::make_unique<repl::ReplicationCoordinatorMock>(service); _replCoord = replCoord.get(); repl::ReplicationCoordinator::set(service, std::move(replCoord)); repl::setOplogCollectionName(service); @@ -291,8 +291,8 @@ void RenameCollectionTest::setUp() { ASSERT_OK(_replCoord->setFollowerMode(repl::MemberState::RS_PRIMARY)); // Use OpObserverMock to track notifications for collection and database drops. - auto opObserver = stdx::make_unique<OpObserverRegistry>(); - auto mockObserver = stdx::make_unique<OpObserverMock>(); + auto opObserver = std::make_unique<OpObserverRegistry>(); + auto mockObserver = std::make_unique<OpObserverMock>(); _opObserver = mockObserver.get(); opObserver->addObserver(std::move(mockObserver)); service->setOpObserver(std::move(opObserver)); diff --git a/src/mongo/db/catalog_raii_test.cpp b/src/mongo/db/catalog_raii_test.cpp index c027b58dd27..ac0e64f80ed 100644 --- a/src/mongo/db/catalog_raii_test.cpp +++ b/src/mongo/db/catalog_raii_test.cpp @@ -56,7 +56,7 @@ public: ClientAndCtx makeClientWithLocker(const std::string& clientName) { auto client = getServiceContext()->makeClient(clientName); auto opCtx = client->makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); return std::make_pair(std::move(client), std::move(opCtx)); } @@ -249,7 +249,7 @@ protected: void ReadSourceScopeTest::setUp() { _opCtx = getClient()->makeOperationContext(); - _opCtx->setRecoveryUnit(stdx::make_unique<RecoveryUnitMock>(), + _opCtx->setRecoveryUnit(std::make_unique<RecoveryUnitMock>(), WriteUnitOfWork::RecoveryUnitState::kNotInUnitOfWork); } diff --git a/src/mongo/db/commands.cpp b/src/mongo/db/commands.cpp index 8efc03ab32d..addedfdb387 100644 --- a/src/mongo/db/commands.cpp +++ b/src/mongo/db/commands.cpp @@ -654,7 +654,7 @@ void Command::snipForLogging(mutablebson::Document* cmdObj) const { std::unique_ptr<CommandInvocation> BasicCommand::parse(OperationContext* opCtx, const OpMsgRequest& request) { CommandHelpers::uassertNoDocumentSequences(getName(), request); - return stdx::make_unique<Invocation>(opCtx, request, this); + return std::make_unique<Invocation>(opCtx, request, this); } Command::Command(StringData name, StringData oldName) diff --git a/src/mongo/db/commands/authentication_commands.cpp b/src/mongo/db/commands/authentication_commands.cpp index 1808f7022ea..22b6a1326a4 100644 --- a/src/mongo/db/commands/authentication_commands.cpp +++ b/src/mongo/db/commands/authentication_commands.cpp @@ -33,6 +33,7 @@ #include "mongo/db/commands/authentication_commands.h" +#include <memory> #include <string> #include <vector> @@ -54,7 +55,6 @@ #include "mongo/platform/random.h" #include "mongo/rpc/metadata/client_metadata.h" #include "mongo/rpc/metadata/client_metadata_ismaster.h" -#include "mongo/stdx/memory.h" #include "mongo/transport/session.h" #include "mongo/util/concurrency/mutex.h" #include "mongo/util/log.h" diff --git a/src/mongo/db/commands/clone_collection.cpp b/src/mongo/db/commands/clone_collection.cpp index b0eeddefe5b..5fa66f56b23 100644 --- a/src/mongo/db/commands/clone_collection.cpp +++ b/src/mongo/db/commands/clone_collection.cpp @@ -155,7 +155,7 @@ public: << " query: " << redact(query) << " " << (copyIndexes ? "" : ", not copying indexes"); Cloner cloner; - auto myconn = stdx::make_unique<DBClientConnection>(); + auto myconn = std::make_unique<DBClientConnection>(); if (!myconn->connect(HostAndPort(fromhost), StringData(), errmsg)) return false; diff --git a/src/mongo/db/commands/dbcheck.cpp b/src/mongo/db/commands/dbcheck.cpp index 3a4cb290a8f..5f58079b200 100644 --- a/src/mongo/db/commands/dbcheck.cpp +++ b/src/mongo/db/commands/dbcheck.cpp @@ -118,7 +118,7 @@ std::unique_ptr<DbCheckRun> singleCollectionRun(OperationContext* opCtx, auto maxSize = invocation.getMaxSize(); auto maxRate = invocation.getMaxCountPerSecond(); auto info = DbCheckCollectionInfo{nss, start, end, maxCount, maxSize, maxRate}; - auto result = stdx::make_unique<DbCheckRun>(); + auto result = std::make_unique<DbCheckRun>(); result->push_back(info); return result; } @@ -132,7 +132,7 @@ std::unique_ptr<DbCheckRun> fullDatabaseRun(OperationContext* opCtx, // Read the list of collections in a database-level lock. AutoGetDb agd(opCtx, StringData(dbName), MODE_S); auto db = agd.getDb(); - auto result = stdx::make_unique<DbCheckRun>(); + auto result = std::make_unique<DbCheckRun>(); uassert(ErrorCodes::NamespaceNotFound, "Database " + dbName + " not found", agd.getDb()); diff --git a/src/mongo/db/commands/dbcommands_d.cpp b/src/mongo/db/commands/dbcommands_d.cpp index 5bede2d66f6..2681ed180b2 100644 --- a/src/mongo/db/commands/dbcommands_d.cpp +++ b/src/mongo/db/commands/dbcommands_d.cpp @@ -216,7 +216,7 @@ public: BSONObj sort = BSON("files_id" << 1 << "n" << 1); return writeConflictRetry(opCtx, "filemd5", dbname, [&] { - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(query); qr->setSort(sort); diff --git a/src/mongo/db/commands/distinct.cpp b/src/mongo/db/commands/distinct.cpp index 9372f78efd0..e31a0843f2c 100644 --- a/src/mongo/db/commands/distinct.cpp +++ b/src/mongo/db/commands/distinct.cpp @@ -31,6 +31,7 @@ #include "mongo/platform/basic.h" +#include <memory> #include <string> #include <vector> @@ -56,7 +57,6 @@ #include "mongo/db/s/collection_sharding_state.h" #include "mongo/db/transaction_participant.h" #include "mongo/db/views/resolved_view.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" namespace mongo { diff --git a/src/mongo/db/commands/explain_cmd.cpp b/src/mongo/db/commands/explain_cmd.cpp index 6a8c49f3e20..5f6f034f4d2 100644 --- a/src/mongo/db/commands/explain_cmd.cpp +++ b/src/mongo/db/commands/explain_cmd.cpp @@ -163,9 +163,9 @@ std::unique_ptr<CommandInvocation> CmdExplain::parse(OperationContext* opCtx, << explainedObj.firstElementFieldName(), explainedCommand); auto innerRequest = - stdx::make_unique<OpMsgRequest>(OpMsgRequest::fromDBAndBody(dbname, explainedObj)); + std::make_unique<OpMsgRequest>(OpMsgRequest::fromDBAndBody(dbname, explainedObj)); auto innerInvocation = explainedCommand->parse(opCtx, *innerRequest); - return stdx::make_unique<Invocation>( + return std::make_unique<Invocation>( this, request, std::move(verbosity), std::move(innerRequest), std::move(innerInvocation)); } diff --git a/src/mongo/db/commands/fsync.cpp b/src/mongo/db/commands/fsync.cpp index 37b0bae2cf8..7bb1aa48ae5 100644 --- a/src/mongo/db/commands/fsync.cpp +++ b/src/mongo/db/commands/fsync.cpp @@ -169,7 +169,7 @@ public: stdx::unique_lock<stdx::mutex> lk(lockStateMutex); threadStatus = Status::OK(); threadStarted = false; - _lockThread = stdx::make_unique<FSyncLockThread>(allowFsyncFailure); + _lockThread = std::make_unique<FSyncLockThread>(allowFsyncFailure); _lockThread->go(); while (!threadStarted && threadStatus.isOK()) { diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp index 60f3436deb6..3e0fadf592e 100644 --- a/src/mongo/db/commands/getmore_cmd.cpp +++ b/src/mongo/db/commands/getmore_cmd.cpp @@ -58,7 +58,6 @@ #include "mongo/db/stats/counters.h" #include "mongo/db/stats/top.h" #include "mongo/s/chunk_version.h" -#include "mongo/stdx/memory.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/log.h" #include "mongo/util/scopeguard.h" diff --git a/src/mongo/db/commands/index_filter_commands.cpp b/src/mongo/db/commands/index_filter_commands.cpp index f7be9462caa..6df4e890028 100644 --- a/src/mongo/db/commands/index_filter_commands.cpp +++ b/src/mongo/db/commands/index_filter_commands.cpp @@ -303,7 +303,7 @@ Status ClearFilters::clear(OperationContext* opCtx, AllowedIndexEntry entry = *i; // Create canonical query. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(entry.query); qr->setSort(entry.sort); qr->setProj(entry.projection); diff --git a/src/mongo/db/commands/index_filter_commands_test.cpp b/src/mongo/db/commands/index_filter_commands_test.cpp index 4a839f4b1ab..d5e50185954 100644 --- a/src/mongo/db/commands/index_filter_commands_test.cpp +++ b/src/mongo/db/commands/index_filter_commands_test.cpp @@ -33,13 +33,14 @@ #include "mongo/db/commands/index_filter_commands.h" +#include <memory> + #include "mongo/db/json.h" #include "mongo/db/operation_context_noop.h" #include "mongo/db/query/collation/collator_interface_mock.h" #include "mongo/db/query/plan_ranker.h" #include "mongo/db/query/query_solution.h" #include "mongo/db/query/query_test_service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" using namespace mongo; @@ -108,7 +109,7 @@ std::unique_ptr<PlanRankingDecision> createDecision(size_t numPlans) { unique_ptr<PlanRankingDecision> why(new PlanRankingDecision()); for (size_t i = 0; i < numPlans; ++i) { CommonStats common("COLLSCAN"); - auto stats = stdx::make_unique<PlanStageStats>(common, STAGE_COLLSCAN); + auto stats = std::make_unique<PlanStageStats>(common, STAGE_COLLSCAN); stats->specific.reset(new CollectionScanStats()); why->stats.push_back(std::move(stats)); why->scores.push_back(0U); @@ -127,7 +128,7 @@ void addQueryShapeToPlanCache(OperationContext* opCtx, const char* projectionStr, const char* collationStr) { // Create canonical query. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson(queryStr)); qr->setSort(fromjson(sortStr)); qr->setProj(fromjson(projectionStr)); @@ -158,7 +159,7 @@ bool planCacheContains(OperationContext* opCtx, const char* collationStr) { // Create canonical query. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson(queryStr)); qr->setSort(fromjson(sortStr)); qr->setProj(fromjson(projectionStr)); @@ -176,7 +177,7 @@ bool planCacheContains(OperationContext* opCtx, // Canonicalizing query shape in cache entry to get cache key. // Alternatively, we could add key to PlanCacheEntry but that would be used in one place // only. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(entry->query); qr->setSort(entry->sort); qr->setProj(entry->projection); diff --git a/src/mongo/db/commands/list_collections.cpp b/src/mongo/db/commands/list_collections.cpp index 9c5ddbaab52..5c116d3a500 100644 --- a/src/mongo/db/commands/list_collections.cpp +++ b/src/mongo/db/commands/list_collections.cpp @@ -29,6 +29,7 @@ #include "mongo/platform/basic.h" +#include <memory> #include <vector> #include "mongo/base/checked_cast.h" @@ -59,7 +60,6 @@ #include "mongo/db/storage/storage_engine.h" #include "mongo/db/storage/storage_options.h" #include "mongo/db/views/view_catalog.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -67,7 +67,6 @@ using std::string; using std::stringstream; using std::unique_ptr; using std::vector; -using stdx::make_unique; namespace { @@ -294,8 +293,8 @@ public: false, cursorNss); - auto ws = make_unique<WorkingSet>(); - auto root = make_unique<QueuedDataStage>(opCtx, ws.get()); + auto ws = std::make_unique<WorkingSet>(); + auto root = std::make_unique<QueuedDataStage>(opCtx, ws.get()); if (db) { if (auto collNames = _getExactNameMatches(matcher.get())) { diff --git a/src/mongo/db/commands/list_indexes.cpp b/src/mongo/db/commands/list_indexes.cpp index dac2a6197b6..bb0b394b273 100644 --- a/src/mongo/db/commands/list_indexes.cpp +++ b/src/mongo/db/commands/list_indexes.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/auth/authorization_session.h" #include "mongo/db/catalog/collection_catalog_entry.h" @@ -47,7 +49,6 @@ #include "mongo/db/query/find_common.h" #include "mongo/db/service_context.h" #include "mongo/db/storage/storage_engine.h" -#include "mongo/stdx/memory.h" #include "mongo/util/uuid.h" namespace mongo { @@ -56,7 +57,6 @@ using std::string; using std::stringstream; using std::unique_ptr; using std::vector; -using stdx::make_unique; namespace { @@ -168,8 +168,8 @@ public: cce->getAllIndexes(opCtx, &indexNames); }); - auto ws = make_unique<WorkingSet>(); - auto root = make_unique<QueuedDataStage>(opCtx, ws.get()); + auto ws = std::make_unique<WorkingSet>(); + auto root = std::make_unique<QueuedDataStage>(opCtx, ws.get()); for (size_t i = 0; i < indexNames.size(); i++) { auto indexSpec = writeConflictRetry(opCtx, "listIndexes", nss.ns(), [&] { diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp index fb811ddc370..f936129a526 100644 --- a/src/mongo/db/commands/mr.cpp +++ b/src/mongo/db/commands/mr.cpp @@ -1197,7 +1197,7 @@ void State::finalReduce(OperationContext* opCtx, CurOp* curOp) { const ExtensionsCallbackReal extensionsCallback(_opCtx, &_config.incLong); - auto qr = stdx::make_unique<QueryRequest>(_config.incLong); + auto qr = std::make_unique<QueryRequest>(_config.incLong); qr->setSort(sortKey); const boost::intrusive_ptr<ExpressionContext> expCtx; @@ -1518,7 +1518,7 @@ public: opCtx, config.nss)); } - auto qr = stdx::make_unique<QueryRequest>(config.nss); + auto qr = std::make_unique<QueryRequest>(config.nss); qr->setFilter(config.filter); qr->setSort(config.sort); qr->setCollation(config.collation); diff --git a/src/mongo/db/commands/mr_test.cpp b/src/mongo/db/commands/mr_test.cpp index 615cd5f3c9f..f2a580730fb 100644 --- a/src/mongo/db/commands/mr_test.cpp +++ b/src/mongo/db/commands/mr_test.cpp @@ -405,7 +405,7 @@ void MapReduceCommandTest::setUp() { repl::DropPendingCollectionReaper::set( service, - stdx::make_unique<repl::DropPendingCollectionReaper>(repl::StorageInterface::get(service))); + std::make_unique<repl::DropPendingCollectionReaper>(repl::StorageInterface::get(service))); // Set up an OpObserver to track the temporary collections mapReduce creates. auto opObserver = std::make_unique<MapReduceOpObserver>(); diff --git a/src/mongo/db/commands/plan_cache_commands.cpp b/src/mongo/db/commands/plan_cache_commands.cpp index 48655efde08..6a89ca96bdf 100644 --- a/src/mongo/db/commands/plan_cache_commands.cpp +++ b/src/mongo/db/commands/plan_cache_commands.cpp @@ -200,7 +200,7 @@ StatusWith<unique_ptr<CanonicalQuery>> PlanCacheCommand::canonicalize(OperationC // Create canonical query const NamespaceString nss(ns); - auto qr = stdx::make_unique<QueryRequest>(std::move(nss)); + auto qr = std::make_unique<QueryRequest>(std::move(nss)); qr->setFilter(queryObj); qr->setSort(sortObj); qr->setProj(projObj); diff --git a/src/mongo/db/commands/plan_cache_commands_test.cpp b/src/mongo/db/commands/plan_cache_commands_test.cpp index 08cd42ae9af..517e1defa15 100644 --- a/src/mongo/db/commands/plan_cache_commands_test.cpp +++ b/src/mongo/db/commands/plan_cache_commands_test.cpp @@ -34,13 +34,13 @@ #include "mongo/db/commands/plan_cache_commands.h" #include <algorithm> +#include <memory> #include "mongo/db/json.h" #include "mongo/db/operation_context_noop.h" #include "mongo/db/query/plan_ranker.h" #include "mongo/db/query/query_solution.h" #include "mongo/db/query/query_test_service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/str.h" @@ -117,7 +117,7 @@ std::unique_ptr<PlanRankingDecision> createDecision(size_t numPlans, size_t work unique_ptr<PlanRankingDecision> why(new PlanRankingDecision()); for (size_t i = 0; i < numPlans; ++i) { CommonStats common("COLLSCAN"); - auto stats = stdx::make_unique<PlanStageStats>(common, STAGE_COLLSCAN); + auto stats = std::make_unique<PlanStageStats>(common, STAGE_COLLSCAN); stats->specific.reset(new CollectionScanStats()); why->stats.push_back(std::move(stats)); why->stats[i]->common.works = works; @@ -138,7 +138,7 @@ TEST(PlanCacheCommandsTest, planCacheListQueryShapesOneKey) { auto opCtx = serviceContext.makeOperationContext(); // Create a canonical query - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson("{a: 1}")); qr->setSort(fromjson("{a: -1}")); qr->setProj(fromjson("{_id: 0}")); @@ -175,7 +175,7 @@ TEST(PlanCacheCommandsTest, planCacheClearAllShapes) { auto opCtx = serviceContext.makeOperationContext(); // Create a canonical query - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson("{a: 1}")); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx.get(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); @@ -312,11 +312,11 @@ TEST(PlanCacheCommandsTest, planCacheClearOneKey) { auto opCtx = serviceContext.makeOperationContext(); // Create 2 canonical queries. - auto qrA = stdx::make_unique<QueryRequest>(nss); + auto qrA = std::make_unique<QueryRequest>(nss); qrA->setFilter(fromjson("{a: 1}")); auto statusWithCQA = CanonicalQuery::canonicalize(opCtx.get(), std::move(qrA)); ASSERT_OK(statusWithCQA.getStatus()); - auto qrB = stdx::make_unique<QueryRequest>(nss); + auto qrB = std::make_unique<QueryRequest>(nss); qrB->setFilter(fromjson("{b: 1}")); unique_ptr<CanonicalQuery> cqA = std::move(statusWithCQA.getValue()); auto statusWithCQB = CanonicalQuery::canonicalize(opCtx.get(), std::move(qrB)); @@ -374,12 +374,12 @@ TEST(PlanCacheCommandsTest, planCacheClearOneKeyCollation) { auto opCtx = serviceContext.makeOperationContext(); // Create 2 canonical queries, one with collation. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson("{a: 'foo'}")); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx.get(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue()); - auto qrCollation = stdx::make_unique<QueryRequest>(nss); + auto qrCollation = std::make_unique<QueryRequest>(nss); qrCollation->setFilter(fromjson("{a: 'foo'}")); qrCollation->setCollation(fromjson("{locale: 'mock_reverse_string'}")); auto statusWithCQCollation = CanonicalQuery::canonicalize(opCtx.get(), std::move(qrCollation)); @@ -555,7 +555,7 @@ TEST(PlanCacheCommandsTest, planCacheListPlansOnlyOneSolutionTrue) { auto opCtx = serviceContext.makeOperationContext(); // Create a canonical query - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson("{a: 1}")); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx.get(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); @@ -588,7 +588,7 @@ TEST(PlanCacheCommandsTest, planCacheListPlansOnlyOneSolutionFalse) { auto opCtx = serviceContext.makeOperationContext(); // Create a canonical query - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson("{a: 1}")); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx.get(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); @@ -624,12 +624,12 @@ TEST(PlanCacheCommandsTest, planCacheListPlansCollation) { auto opCtx = serviceContext.makeOperationContext(); // Create 2 canonical queries, one with collation. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson("{a: 'foo'}")); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx.get(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue()); - auto qrCollation = stdx::make_unique<QueryRequest>(nss); + auto qrCollation = std::make_unique<QueryRequest>(nss); qrCollation->setFilter(fromjson("{a: 'foo'}")); qrCollation->setCollation(fromjson("{locale: 'mock_reverse_string'}")); auto statusWithCQCollation = CanonicalQuery::canonicalize(opCtx.get(), std::move(qrCollation)); @@ -684,7 +684,7 @@ TEST(PlanCacheCommandsTest, planCacheListPlansTimeOfCreationIsCorrect) { auto opCtx = serviceContext.makeOperationContext(); // Create a canonical query. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson("{a: 1}")); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx.get(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); diff --git a/src/mongo/db/commands/run_aggregate.cpp b/src/mongo/db/commands/run_aggregate.cpp index 8c1be73e152..b866688ce21 100644 --- a/src/mongo/db/commands/run_aggregate.cpp +++ b/src/mongo/db/commands/run_aggregate.cpp @@ -34,6 +34,7 @@ #include "mongo/db/commands/run_aggregate.h" #include <boost/optional.hpp> +#include <memory> #include <vector> #include "mongo/db/auth/authorization_session.h" @@ -71,7 +72,6 @@ #include "mongo/db/transaction_participant.h" #include "mongo/db/views/view.h" #include "mongo/db/views/view_catalog.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/scopeguard.h" #include "mongo/util/string_map.h" @@ -84,7 +84,6 @@ using std::shared_ptr; using std::string; using std::stringstream; using std::unique_ptr; -using stdx::make_unique; namespace { /** @@ -475,10 +474,10 @@ std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> createOuterPipelineProxyExe std::unique_ptr<Pipeline, PipelineDeleter> pipeline, bool hasChangeStream) { // Transfer ownership of the Pipeline to the PipelineProxyStage. - auto ws = make_unique<WorkingSet>(); + auto ws = std::make_unique<WorkingSet>(); auto proxy = hasChangeStream - ? make_unique<ChangeStreamProxyStage>(opCtx, std::move(pipeline), ws.get()) - : make_unique<PipelineProxyStage>(opCtx, std::move(pipeline), ws.get()); + ? std::make_unique<ChangeStreamProxyStage>(opCtx, std::move(pipeline), ws.get()) + : std::make_unique<PipelineProxyStage>(opCtx, std::move(pipeline), ws.get()); // This PlanExecutor will simply forward requests to the Pipeline, so does not need // to yield or to be registered with any collection's CursorManager to receive diff --git a/src/mongo/db/commands/write_commands/write_commands.cpp b/src/mongo/db/commands/write_commands/write_commands.cpp index c2892e08fd9..156263192df 100644 --- a/src/mongo/db/commands/write_commands/write_commands.cpp +++ b/src/mongo/db/commands/write_commands/write_commands.cpp @@ -312,7 +312,7 @@ private: std::unique_ptr<CommandInvocation> parse(OperationContext*, const OpMsgRequest& request) override { - return stdx::make_unique<Invocation>(this, request); + return std::make_unique<Invocation>(this, request); } void snipForLogging(mutablebson::Document* cmdObj) const final { @@ -393,7 +393,7 @@ private: }; std::unique_ptr<CommandInvocation> parse(OperationContext*, const OpMsgRequest& request) { - return stdx::make_unique<Invocation>(this, request); + return std::make_unique<Invocation>(this, request); } void snipForLogging(mutablebson::Document* cmdObj) const final { @@ -468,7 +468,7 @@ private: std::unique_ptr<CommandInvocation> parse(OperationContext*, const OpMsgRequest& request) override { - return stdx::make_unique<Invocation>(this, request); + return std::make_unique<Invocation>(this, request); } void snipForLogging(mutablebson::Document* cmdObj) const final { diff --git a/src/mongo/db/commands/write_commands/write_commands_common.cpp b/src/mongo/db/commands/write_commands/write_commands_common.cpp index e599cd47a2f..9e449e19b79 100644 --- a/src/mongo/db/commands/write_commands/write_commands_common.cpp +++ b/src/mongo/db/commands/write_commands/write_commands_common.cpp @@ -32,6 +32,7 @@ #include "mongo/db/commands/write_commands/write_commands_common.h" #include <algorithm> +#include <memory> #include <string> #include <vector> @@ -40,7 +41,6 @@ #include "mongo/db/auth/privilege.h" #include "mongo/db/catalog/document_validation.h" #include "mongo/db/ops/write_ops.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" namespace mongo { diff --git a/src/mongo/db/concurrency/d_concurrency.cpp b/src/mongo/db/concurrency/d_concurrency.cpp index 37c841594b0..4022d1f24ad 100644 --- a/src/mongo/db/concurrency/d_concurrency.cpp +++ b/src/mongo/db/concurrency/d_concurrency.cpp @@ -33,13 +33,13 @@ #include "mongo/db/concurrency/d_concurrency.h" +#include <memory> #include <string> #include <vector> #include "mongo/db/concurrency/flow_control_ticketholder.h" #include "mongo/db/namespace_string.h" #include "mongo/db/service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" diff --git a/src/mongo/db/concurrency/d_concurrency_test.cpp b/src/mongo/db/concurrency/d_concurrency_test.cpp index 6172b1302ca..cb310b55eb9 100644 --- a/src/mongo/db/concurrency/d_concurrency_test.cpp +++ b/src/mongo/db/concurrency/d_concurrency_test.cpp @@ -33,6 +33,7 @@ #include <boost/optional/optional_io.hpp> #include <functional> +#include <memory> #include <string> #include <vector> @@ -43,7 +44,6 @@ #include "mongo/db/service_context_d_test_fixture.h" #include "mongo/db/storage/recovery_unit_noop.h" #include "mongo/stdx/future.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/unittest/unittest.h" #include "mongo/util/concurrency/ticketholder.h" @@ -95,7 +95,7 @@ public: auto client = getServiceContext()->makeClient(str::stream() << "test client for thread " << i); auto opCtx = client->makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); clients.emplace_back(std::move(client), std::move(opCtx)); } return clients; @@ -125,13 +125,13 @@ public: TEST_F(DConcurrencyTestFixture, WriteConflictRetryInstantiatesOK) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); writeConflictRetry(opCtx.get(), "", "", [] {}); } TEST_F(DConcurrencyTestFixture, WriteConflictRetryRetriesFunctionOnWriteConflictException) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); auto&& opDebug = CurOp::get(opCtx.get())->debug(); ASSERT_EQUALS(0, opDebug.additiveMetrics.writeConflicts.load()); ASSERT_EQUALS(100, writeConflictRetry(opCtx.get(), "", "", [&opDebug] { @@ -145,7 +145,7 @@ TEST_F(DConcurrencyTestFixture, WriteConflictRetryRetriesFunctionOnWriteConflict TEST_F(DConcurrencyTestFixture, WriteConflictRetryPropagatesNonWriteConflictException) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); ASSERT_THROWS_CODE(writeConflictRetry(opCtx.get(), "", "", @@ -160,7 +160,7 @@ TEST_F(DConcurrencyTestFixture, WriteConflictRetryPropagatesNonWriteConflictExce TEST_F(DConcurrencyTestFixture, WriteConflictRetryPropagatesWriteConflictExceptionIfAlreadyInAWriteUnitOfWork) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); Lock::GlobalWrite globalWrite(opCtx.get()); WriteUnitOfWork wuow(opCtx.get()); ASSERT_THROWS(writeConflictRetry(opCtx.get(), "", "", [] { throw WriteConflictException(); }), @@ -251,7 +251,7 @@ TEST_F(DConcurrencyTestFixture, ResourceMutex) { TEST_F(DConcurrencyTestFixture, GlobalRead) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); Lock::GlobalRead globalRead(opCtx.get()); ASSERT(opCtx->lockState()->isR()); ASSERT_EQ(opCtx->lockState()->getLockMode(resourceIdReplicationStateTransitionLock), MODE_IX); @@ -259,7 +259,7 @@ TEST_F(DConcurrencyTestFixture, GlobalRead) { TEST_F(DConcurrencyTestFixture, GlobalWrite) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); Lock::GlobalWrite globalWrite(opCtx.get()); ASSERT(opCtx->lockState()->isW()); ASSERT_EQ(opCtx->lockState()->getLockMode(resourceIdReplicationStateTransitionLock), MODE_IX); @@ -267,7 +267,7 @@ TEST_F(DConcurrencyTestFixture, GlobalWrite) { TEST_F(DConcurrencyTestFixture, GlobalWriteAndGlobalRead) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); auto lockState = opCtx->lockState(); Lock::GlobalWrite globalWrite(opCtx.get()); @@ -285,10 +285,10 @@ TEST_F(DConcurrencyTestFixture, GlobalWriteAndGlobalRead) { TEST_F(DConcurrencyTestFixture, GlobalWriteRequiresExplicitDowngradeToIntentWriteModeIfDestroyedWhileHoldingDatabaseLock) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); auto lockState = opCtx->lockState(); - auto globalWrite = stdx::make_unique<Lock::GlobalWrite>(opCtx.get()); + auto globalWrite = std::make_unique<Lock::GlobalWrite>(opCtx.get()); ASSERT(lockState->isW()); ASSERT(MODE_X == lockState->getLockMode(resourceIdGlobal)) << "unexpected global lock mode " << modeName(lockState->getLockMode(resourceIdGlobal)); @@ -327,10 +327,10 @@ TEST_F(DConcurrencyTestFixture, TEST_F(DConcurrencyTestFixture, GlobalWriteRequiresSupportsDowngradeToIntentWriteModeWhileHoldingDatabaseLock) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); auto lockState = opCtx->lockState(); - auto globalWrite = stdx::make_unique<Lock::GlobalWrite>(opCtx.get()); + auto globalWrite = std::make_unique<Lock::GlobalWrite>(opCtx.get()); ASSERT(lockState->isW()); ASSERT(MODE_X == lockState->getLockMode(resourceIdGlobal)) << "unexpected global lock mode " << modeName(lockState->getLockMode(resourceIdGlobal)); @@ -368,11 +368,11 @@ TEST_F(DConcurrencyTestFixture, TEST_F(DConcurrencyTestFixture, NestedGlobalWriteSupportsDowngradeToIntentWriteModeWhileHoldingDatabaseLock) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); auto lockState = opCtx->lockState(); - auto outerGlobalWrite = stdx::make_unique<Lock::GlobalWrite>(opCtx.get()); - auto innerGlobalWrite = stdx::make_unique<Lock::GlobalWrite>(opCtx.get()); + auto outerGlobalWrite = std::make_unique<Lock::GlobalWrite>(opCtx.get()); + auto innerGlobalWrite = std::make_unique<Lock::GlobalWrite>(opCtx.get()); ASSERT_EQ(lockState->getLockMode(resourceIdReplicationStateTransitionLock), MODE_IX); { @@ -698,7 +698,7 @@ TEST_F(DConcurrencyTestFixture, GlobalLockX_TimeoutDueToGlobalLockX) { TEST_F(DConcurrencyTestFixture, TempReleaseGlobalWrite) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); auto lockState = opCtx->lockState(); Lock::GlobalWrite globalWrite(opCtx.get()); ASSERT_EQ(lockState->getLockMode(resourceIdReplicationStateTransitionLock), MODE_IX); @@ -715,7 +715,7 @@ TEST_F(DConcurrencyTestFixture, TempReleaseGlobalWrite) { TEST_F(DConcurrencyTestFixture, TempReleaseRecursive) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); auto lockState = opCtx->lockState(); Lock::GlobalWrite globalWrite(opCtx.get()); Lock::DBLock lk(opCtx.get(), "SomeDBName", MODE_X); @@ -1094,7 +1094,7 @@ TEST_F(DConcurrencyTestFixture, LockCompleteInterruptedWhenUncontested) { TEST_F(DConcurrencyTestFixture, DBLockTakesS) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); Lock::DBLock dbRead(opCtx.get(), "db", MODE_S); const ResourceId resIdDb(RESOURCE_DATABASE, std::string("db")); @@ -1103,7 +1103,7 @@ TEST_F(DConcurrencyTestFixture, DBLockTakesS) { TEST_F(DConcurrencyTestFixture, DBLockTakesX) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); Lock::DBLock dbWrite(opCtx.get(), "db", MODE_X); const ResourceId resIdDb(RESOURCE_DATABASE, std::string("db")); @@ -1112,7 +1112,7 @@ TEST_F(DConcurrencyTestFixture, DBLockTakesX) { TEST_F(DConcurrencyTestFixture, DBLockTakesISForAdminIS) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); Lock::DBLock dbRead(opCtx.get(), "admin", MODE_IS); ASSERT(opCtx->lockState()->getLockMode(resourceIdAdminDB) == MODE_IS); @@ -1120,7 +1120,7 @@ TEST_F(DConcurrencyTestFixture, DBLockTakesISForAdminIS) { TEST_F(DConcurrencyTestFixture, DBLockTakesSForAdminS) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); Lock::DBLock dbRead(opCtx.get(), "admin", MODE_S); ASSERT(opCtx->lockState()->getLockMode(resourceIdAdminDB) == MODE_S); @@ -1128,7 +1128,7 @@ TEST_F(DConcurrencyTestFixture, DBLockTakesSForAdminS) { TEST_F(DConcurrencyTestFixture, DBLockTakesXForAdminIX) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); Lock::DBLock dbWrite(opCtx.get(), "admin", MODE_IX); ASSERT(opCtx->lockState()->getLockMode(resourceIdAdminDB) == MODE_X); @@ -1136,7 +1136,7 @@ TEST_F(DConcurrencyTestFixture, DBLockTakesXForAdminIX) { TEST_F(DConcurrencyTestFixture, DBLockTakesXForAdminX) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); Lock::DBLock dbWrite(opCtx.get(), "admin", MODE_X); ASSERT(opCtx->lockState()->getLockMode(resourceIdAdminDB) == MODE_X); @@ -1144,7 +1144,7 @@ TEST_F(DConcurrencyTestFixture, DBLockTakesXForAdminX) { TEST_F(DConcurrencyTestFixture, MultipleWriteDBLocksOnSameThread) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); Lock::DBLock r1(opCtx.get(), "db1", MODE_X); Lock::DBLock r2(opCtx.get(), "db1", MODE_X); @@ -1153,7 +1153,7 @@ TEST_F(DConcurrencyTestFixture, MultipleWriteDBLocksOnSameThread) { TEST_F(DConcurrencyTestFixture, MultipleConflictingDBLocksOnSameThread) { auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); auto lockState = opCtx->lockState(); Lock::DBLock r1(opCtx.get(), "db1", MODE_X); Lock::DBLock r2(opCtx.get(), "db1", MODE_S); @@ -1166,7 +1166,7 @@ TEST_F(DConcurrencyTestFixture, IsDbLockedForSMode) { const std::string dbName("db"); auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); auto lockState = opCtx->lockState(); Lock::DBLock dbLock(opCtx.get(), dbName, MODE_S); @@ -1180,7 +1180,7 @@ TEST_F(DConcurrencyTestFixture, IsDbLockedForXMode) { const std::string dbName("db"); auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); auto lockState = opCtx->lockState(); Lock::DBLock dbLock(opCtx.get(), dbName, MODE_X); @@ -1194,7 +1194,7 @@ TEST_F(DConcurrencyTestFixture, IsCollectionLocked_DB_Locked_IS) { const NamespaceString ns("db1.coll"); auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); auto lockState = opCtx->lockState(); Lock::DBLock dbLock(opCtx.get(), "db1", MODE_IS); @@ -1225,7 +1225,7 @@ TEST_F(DConcurrencyTestFixture, IsCollectionLocked_DB_Locked_IX) { const NamespaceString ns("db1.coll"); auto opCtx = makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + opCtx->swapLockState(std::make_unique<LockerImpl>()); auto lockState = opCtx->lockState(); Lock::DBLock dbLock(opCtx.get(), "db1", MODE_IX); @@ -2099,7 +2099,7 @@ public: TEST_F(DConcurrencyTestFixture, TestGlobalLockAbandonsSnapshotWhenNotInWriteUnitOfWork) { auto clients = makeKClientsWithLockers(1); auto opCtx = clients[0].second.get(); - auto recovUnitOwned = stdx::make_unique<RecoveryUnitMock>(); + auto recovUnitOwned = std::make_unique<RecoveryUnitMock>(); auto recovUnitBorrowed = recovUnitOwned.get(); opCtx->setRecoveryUnit(std::unique_ptr<RecoveryUnit>(recovUnitOwned.release()), WriteUnitOfWork::RecoveryUnitState::kNotInUnitOfWork); @@ -2124,7 +2124,7 @@ TEST_F(DConcurrencyTestFixture, TestGlobalLockAbandonsSnapshotWhenNotInWriteUnit TEST_F(DConcurrencyTestFixture, TestGlobalLockDoesNotAbandonSnapshotWhenInWriteUnitOfWork) { auto clients = makeKClientsWithLockers(1); auto opCtx = clients[0].second.get(); - auto recovUnitOwned = stdx::make_unique<RecoveryUnitMock>(); + auto recovUnitOwned = std::make_unique<RecoveryUnitMock>(); auto recovUnitBorrowed = recovUnitOwned.get(); opCtx->setRecoveryUnit(std::unique_ptr<RecoveryUnit>(recovUnitOwned.release()), WriteUnitOfWork::RecoveryUnitState::kActiveUnitOfWork); @@ -2184,7 +2184,7 @@ TEST_F(DConcurrencyTestFixture, RSTLLockGuardEnqueueAndWait) { // The first opCtx holds the RSTL. auto firstRSTL = - stdx::make_unique<repl::ReplicationStateTransitionLockGuard>(firstOpCtx, MODE_X); + std::make_unique<repl::ReplicationStateTransitionLockGuard>(firstOpCtx, MODE_X); ASSERT_TRUE(firstRSTL->isLocked()); ASSERT_EQ(firstOpCtx->lockState()->getLockMode(resourceIdReplicationStateTransitionLock), MODE_X); diff --git a/src/mongo/db/concurrency/deferred_writer.cpp b/src/mongo/db/concurrency/deferred_writer.cpp index 2dbda1013c4..6f7c7df6ea5 100644 --- a/src/mongo/db/concurrency/deferred_writer.cpp +++ b/src/mongo/db/concurrency/deferred_writer.cpp @@ -76,7 +76,7 @@ Status DeferredWriter::_makeCollection(OperationContext* opCtx) { StatusWith<std::unique_ptr<AutoGetCollection>> DeferredWriter::_getCollection( OperationContext* opCtx) { std::unique_ptr<AutoGetCollection> agc; - agc = stdx::make_unique<AutoGetCollection>(opCtx, _nss, MODE_IX); + agc = std::make_unique<AutoGetCollection>(opCtx, _nss, MODE_IX); while (!agc->getCollection()) { // Release the previous AGC's lock before trying to rebuild the collection. @@ -87,7 +87,7 @@ StatusWith<std::unique_ptr<AutoGetCollection>> DeferredWriter::_getCollection( return status; } - agc = stdx::make_unique<AutoGetCollection>(opCtx, _nss, MODE_IX); + agc = std::make_unique<AutoGetCollection>(opCtx, _nss, MODE_IX); } return std::move(agc); @@ -147,7 +147,7 @@ void DeferredWriter::startup(std::string workerName) { options.minThreads = 0; options.maxThreads = 1; options.onCreateThread = [](const std::string& name) { Client::initThread(name); }; - _pool = stdx::make_unique<ThreadPool>(options); + _pool = std::make_unique<ThreadPool>(options); _pool->startup(); } diff --git a/src/mongo/db/cursor_manager.cpp b/src/mongo/db/cursor_manager.cpp index 978245df357..d2daf732184 100644 --- a/src/mongo/db/cursor_manager.cpp +++ b/src/mongo/db/cursor_manager.cpp @@ -33,6 +33,8 @@ #include "mongo/db/cursor_manager.h" +#include <memory> + #include "mongo/base/data_cursor.h" #include "mongo/base/init.h" #include "mongo/db/audit.h" @@ -51,7 +53,6 @@ #include "mongo/db/query/plan_executor.h" #include "mongo/db/service_context.h" #include "mongo/platform/random.h" -#include "mongo/stdx/memory.h" #include "mongo/util/exit.h" #include "mongo/util/log.h" @@ -66,7 +67,7 @@ const auto serviceCursorManager = ServiceContext::ConstructorActionRegisterer cursorManagerRegisterer{ "CursorManagerRegisterer", [](ServiceContext* svcCtx) { - auto cursorManager = stdx::make_unique<CursorManager>(); + auto cursorManager = std::make_unique<CursorManager>(); CursorManager::set(svcCtx, std::move(cursorManager)); }}; } // namespace @@ -99,8 +100,8 @@ std::pair<Status, int> CursorManager::killCursorsWithMatchingSessions( } CursorManager::CursorManager() - : _random(stdx::make_unique<PseudoRandom>(SecureRandom::create()->nextInt64())), - _cursorMap(stdx::make_unique<Partitioned<stdx::unordered_map<CursorId, ClientCursor*>>>()) {} + : _random(std::make_unique<PseudoRandom>(SecureRandom::create()->nextInt64())), + _cursorMap(std::make_unique<Partitioned<stdx::unordered_map<CursorId, ClientCursor*>>>()) {} CursorManager::~CursorManager() { auto allPartitions = _cursorMap->lockAllPartitions(); diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp index 235a6e78546..df1f2908406 100644 --- a/src/mongo/db/db.cpp +++ b/src/mongo/db/db.cpp @@ -36,6 +36,7 @@ #include <fstream> #include <iostream> #include <limits> +#include <memory> #include <signal.h> #include <string> @@ -153,7 +154,6 @@ #include "mongo/scripting/dbdirectclient_factory.h" #include "mongo/scripting/engine.h" #include "mongo/stdx/future.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/transport/transport_layer_manager.h" #include "mongo/util/assert_util.h" @@ -271,14 +271,14 @@ ExitCode _initAndListen(int listenPort) { auto serviceContext = getGlobalServiceContext(); serviceContext->setFastClockSource(FastClockSourceFactory::create(Milliseconds(10))); - auto opObserverRegistry = stdx::make_unique<OpObserverRegistry>(); - opObserverRegistry->addObserver(stdx::make_unique<OpObserverShardingImpl>()); - opObserverRegistry->addObserver(stdx::make_unique<AuthOpObserver>()); + auto opObserverRegistry = std::make_unique<OpObserverRegistry>(); + opObserverRegistry->addObserver(std::make_unique<OpObserverShardingImpl>()); + opObserverRegistry->addObserver(std::make_unique<AuthOpObserver>()); if (serverGlobalParams.clusterRole == ClusterRole::ShardServer) { - opObserverRegistry->addObserver(stdx::make_unique<ShardServerOpObserver>()); + opObserverRegistry->addObserver(std::make_unique<ShardServerOpObserver>()); } else if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer) { - opObserverRegistry->addObserver(stdx::make_unique<ConfigServerOpObserver>()); + opObserverRegistry->addObserver(std::make_unique<ConfigServerOpObserver>()); } setupFreeMonitoringOpObserver(opObserverRegistry.get()); @@ -310,8 +310,7 @@ ExitCode _initAndListen(int listenPort) { logProcessDetails(); - serviceContext->setServiceEntryPoint( - stdx::make_unique<ServiceEntryPointMongod>(serviceContext)); + serviceContext->setServiceEntryPoint(std::make_unique<ServiceEntryPointMongod>(serviceContext)); if (!storageGlobalParams.repair) { auto tl = @@ -330,7 +329,7 @@ ExitCode _initAndListen(int listenPort) { runner->startup(); serviceContext->setPeriodicRunner(std::move(runner)); FlowControl::set(serviceContext, - stdx::make_unique<FlowControl>( + std::make_unique<FlowControl>( serviceContext, repl::ReplicationCoordinator::get(serviceContext))); initializeStorageEngine(serviceContext, StorageEngineInitFlags::kNone); @@ -551,7 +550,7 @@ ExitCode _initAndListen(int listenPort) { Grid::get(startupOpCtx.get())->setShardingInitialized(); } else if (replSettings.usingReplSets()) { // standalone replica set - auto keysCollectionClient = stdx::make_unique<KeysCollectionClientDirect>(); + auto keysCollectionClient = std::make_unique<KeysCollectionClientDirect>(); auto keyManager = std::make_shared<KeysCollectionManager>( KeysCollectionManager::kKeyManagerPurposeString, std::move(keysCollectionClient), @@ -559,7 +558,7 @@ ExitCode _initAndListen(int listenPort) { keyManager->startMonitoring(startupOpCtx->getServiceContext()); LogicalTimeValidator::set(startupOpCtx->getServiceContext(), - stdx::make_unique<LogicalTimeValidator>(keyManager)); + std::make_unique<LogicalTimeValidator>(keyManager)); } replCoord->startup(startupOpCtx.get()); @@ -795,45 +794,45 @@ auto makeReplicationExecutor(ServiceContext* serviceContext) { tpOptions.onCreateThread = [](const std::string& threadName) { Client::initThread(threadName.c_str()); }; - auto hookList = stdx::make_unique<rpc::EgressMetadataHookList>(); - hookList->addHook(stdx::make_unique<rpc::LogicalTimeMetadataHook>(serviceContext)); - return stdx::make_unique<executor::ThreadPoolTaskExecutor>( - stdx::make_unique<ThreadPool>(tpOptions), + auto hookList = std::make_unique<rpc::EgressMetadataHookList>(); + hookList->addHook(std::make_unique<rpc::LogicalTimeMetadataHook>(serviceContext)); + return std::make_unique<executor::ThreadPoolTaskExecutor>( + std::make_unique<ThreadPool>(tpOptions), executor::makeNetworkInterface("Replication", nullptr, std::move(hookList))); } void setUpReplication(ServiceContext* serviceContext) { - repl::StorageInterface::set(serviceContext, stdx::make_unique<repl::StorageInterfaceImpl>()); + repl::StorageInterface::set(serviceContext, std::make_unique<repl::StorageInterfaceImpl>()); auto storageInterface = repl::StorageInterface::get(serviceContext); auto consistencyMarkers = - stdx::make_unique<repl::ReplicationConsistencyMarkersImpl>(storageInterface); - auto recovery = stdx::make_unique<repl::ReplicationRecoveryImpl>(storageInterface, - consistencyMarkers.get()); + std::make_unique<repl::ReplicationConsistencyMarkersImpl>(storageInterface); + auto recovery = + std::make_unique<repl::ReplicationRecoveryImpl>(storageInterface, consistencyMarkers.get()); repl::ReplicationProcess::set( serviceContext, - stdx::make_unique<repl::ReplicationProcess>( + std::make_unique<repl::ReplicationProcess>( storageInterface, std::move(consistencyMarkers), std::move(recovery))); auto replicationProcess = repl::ReplicationProcess::get(serviceContext); repl::DropPendingCollectionReaper::set( - serviceContext, stdx::make_unique<repl::DropPendingCollectionReaper>(storageInterface)); + serviceContext, std::make_unique<repl::DropPendingCollectionReaper>(storageInterface)); auto dropPendingCollectionReaper = repl::DropPendingCollectionReaper::get(serviceContext); repl::TopologyCoordinator::Options topoCoordOptions; topoCoordOptions.maxSyncSourceLagSecs = Seconds(repl::maxSyncSourceLagSecs); topoCoordOptions.clusterRole = serverGlobalParams.clusterRole; - auto logicalClock = stdx::make_unique<LogicalClock>(serviceContext); + auto logicalClock = std::make_unique<LogicalClock>(serviceContext); LogicalClock::set(serviceContext, std::move(logicalClock)); - auto replCoord = stdx::make_unique<repl::ReplicationCoordinatorImpl>( + auto replCoord = std::make_unique<repl::ReplicationCoordinatorImpl>( serviceContext, getGlobalReplSettings(), - stdx::make_unique<repl::ReplicationCoordinatorExternalStateImpl>( + std::make_unique<repl::ReplicationCoordinatorExternalStateImpl>( serviceContext, dropPendingCollectionReaper, storageInterface, replicationProcess), makeReplicationExecutor(serviceContext), - stdx::make_unique<repl::TopologyCoordinator>(topoCoordOptions), + std::make_unique<repl::TopologyCoordinator>(topoCoordOptions), replicationProcess, storageInterface, SecureRandom::create()->nextInt64()); diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp index 5a4abebd032..1447ad18389 100644 --- a/src/mongo/db/dbhelpers.cpp +++ b/src/mongo/db/dbhelpers.cpp @@ -88,7 +88,7 @@ RecordId Helpers::findOne(OperationContext* opCtx, if (!collection) return RecordId(); - auto qr = stdx::make_unique<QueryRequest>(collection->ns()); + auto qr = std::make_unique<QueryRequest>(collection->ns()); qr->setFilter(query); return findOne(opCtx, collection, std::move(qr), requireIndex); } diff --git a/src/mongo/db/exec/and_hash.cpp b/src/mongo/db/exec/and_hash.cpp index dc8197afc8e..1b2e9983286 100644 --- a/src/mongo/db/exec/and_hash.cpp +++ b/src/mongo/db/exec/and_hash.cpp @@ -29,11 +29,12 @@ #include "mongo/db/exec/and_hash.h" +#include <memory> + #include "mongo/db/exec/and_common.h" #include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set.h" #include "mongo/db/exec/working_set_common.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace { @@ -48,7 +49,6 @@ namespace mongo { using std::unique_ptr; using std::vector; -using stdx::make_unique; const size_t AndHashStage::kLookAheadWorks = 10; @@ -385,8 +385,8 @@ unique_ptr<PlanStageStats> AndHashStage::getStats() { _specificStats.memLimit = _maxMemUsage; _specificStats.memUsage = _memUsage; - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_AND_HASH); - ret->specific = make_unique<AndHashStats>(_specificStats); + unique_ptr<PlanStageStats> ret = std::make_unique<PlanStageStats>(_commonStats, STAGE_AND_HASH); + ret->specific = std::make_unique<AndHashStats>(_specificStats); for (size_t i = 0; i < _children.size(); ++i) { ret->children.emplace_back(_children[i]->getStats()); } diff --git a/src/mongo/db/exec/and_sorted.cpp b/src/mongo/db/exec/and_sorted.cpp index cdb095ba08d..f7fcdc170e2 100644 --- a/src/mongo/db/exec/and_sorted.cpp +++ b/src/mongo/db/exec/and_sorted.cpp @@ -29,10 +29,11 @@ #include "mongo/db/exec/and_sorted.h" +#include <memory> + #include "mongo/db/exec/and_common.h" #include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { @@ -40,7 +41,6 @@ namespace mongo { using std::unique_ptr; using std::numeric_limits; using std::vector; -using stdx::make_unique; // static const char* AndSortedStage::kStageType = "AND_SORTED"; @@ -228,8 +228,9 @@ PlanStage::StageState AndSortedStage::moveTowardTargetRecordId(WorkingSetID* out unique_ptr<PlanStageStats> AndSortedStage::getStats() { _commonStats.isEOF = isEOF(); - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_AND_SORTED); - ret->specific = make_unique<AndSortedStats>(_specificStats); + unique_ptr<PlanStageStats> ret = + std::make_unique<PlanStageStats>(_commonStats, STAGE_AND_SORTED); + ret->specific = std::make_unique<AndSortedStats>(_specificStats); for (size_t i = 0; i < _children.size(); ++i) { ret->children.emplace_back(_children[i]->getStats()); } diff --git a/src/mongo/db/exec/cached_plan.cpp b/src/mongo/db/exec/cached_plan.cpp index e426a0ad340..07df67a7c77 100644 --- a/src/mongo/db/exec/cached_plan.cpp +++ b/src/mongo/db/exec/cached_plan.cpp @@ -33,6 +33,8 @@ #include "mongo/db/exec/cached_plan.h" +#include <memory> + #include "mongo/db/catalog/collection.h" #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/exec/multi_plan.h" @@ -45,7 +47,6 @@ #include "mongo/db/query/query_knobs_gen.h" #include "mongo/db/query/query_planner.h" #include "mongo/db/query/stage_builder.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/str.h" #include "mongo/util/transitional_tools_do_not_use/vector_spooling.h" @@ -287,8 +288,8 @@ std::unique_ptr<PlanStageStats> CachedPlanStage::getStats() { _commonStats.isEOF = isEOF(); std::unique_ptr<PlanStageStats> ret = - stdx::make_unique<PlanStageStats>(_commonStats, STAGE_CACHED_PLAN); - ret->specific = stdx::make_unique<CachedPlanStats>(_specificStats); + std::make_unique<PlanStageStats>(_commonStats, STAGE_CACHED_PLAN); + ret->specific = std::make_unique<CachedPlanStats>(_specificStats); ret->children.emplace_back(child()->getStats()); return ret; diff --git a/src/mongo/db/exec/collection_scan.cpp b/src/mongo/db/exec/collection_scan.cpp index fb77bc01965..f416f8f3f9d 100644 --- a/src/mongo/db/exec/collection_scan.cpp +++ b/src/mongo/db/exec/collection_scan.cpp @@ -31,6 +31,8 @@ #include "mongo/db/exec/collection_scan.h" +#include <memory> + #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/concurrency/write_conflict_exception.h" @@ -40,7 +42,6 @@ #include "mongo/db/exec/working_set.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/db/repl/optime.h" -#include "mongo/stdx/memory.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/log.h" @@ -50,7 +51,6 @@ namespace mongo { using std::unique_ptr; using std::vector; -using stdx::make_unique; // static const char* CollectionScan::kStageType = "COLLSCAN"; @@ -71,8 +71,8 @@ CollectionScan::CollectionScan(OperationContext* opCtx, if (params.maxTs) { _endConditionBSON = BSON("$gte" << *(params.maxTs)); - _endCondition = stdx::make_unique<GTEMatchExpression>(repl::OpTime::kTimestampFieldName, - _endConditionBSON.firstElement()); + _endCondition = std::make_unique<GTEMatchExpression>(repl::OpTime::kTimestampFieldName, + _endConditionBSON.firstElement()); } } @@ -246,8 +246,8 @@ unique_ptr<PlanStageStats> CollectionScan::getStats() { _commonStats.filter = bob.obj(); } - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_COLLSCAN); - ret->specific = make_unique<CollectionScanStats>(_specificStats); + unique_ptr<PlanStageStats> ret = std::make_unique<PlanStageStats>(_commonStats, STAGE_COLLSCAN); + ret->specific = std::make_unique<CollectionScanStats>(_specificStats); return ret; } diff --git a/src/mongo/db/exec/count.cpp b/src/mongo/db/exec/count.cpp index 0d6fcdb6e51..73620f851df 100644 --- a/src/mongo/db/exec/count.cpp +++ b/src/mongo/db/exec/count.cpp @@ -31,16 +31,16 @@ #include "mongo/db/exec/count.h" +#include <memory> + #include "mongo/db/catalog/collection.h" #include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" -#include "mongo/stdx/memory.h" namespace mongo { using std::unique_ptr; using std::vector; -using stdx::make_unique; // static const char* CountStage::kStageType = "COUNT"; @@ -115,8 +115,8 @@ PlanStage::StageState CountStage::doWork(WorkingSetID* out) { unique_ptr<PlanStageStats> CountStage::getStats() { _commonStats.isEOF = isEOF(); - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_COUNT); - ret->specific = make_unique<CountStats>(_specificStats); + unique_ptr<PlanStageStats> ret = std::make_unique<PlanStageStats>(_commonStats, STAGE_COUNT); + ret->specific = std::make_unique<CountStats>(_specificStats); if (!_children.empty()) { ret->children.emplace_back(child()->getStats()); } diff --git a/src/mongo/db/exec/count_scan.cpp b/src/mongo/db/exec/count_scan.cpp index ce19790ef19..998235ca270 100644 --- a/src/mongo/db/exec/count_scan.cpp +++ b/src/mongo/db/exec/count_scan.cpp @@ -29,11 +29,12 @@ #include "mongo/db/exec/count_scan.h" +#include <memory> + #include "mongo/db/catalog/index_catalog.h" #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/exec/scoped_timer.h" #include "mongo/db/index/index_access_method.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -65,7 +66,6 @@ BSONObj replaceBSONFieldNames(const BSONObj& replace, const BSONObj& fieldNames) using std::unique_ptr; using std::vector; -using stdx::make_unique; // static const char* CountScan::kStageType = "COUNT_SCAN"; @@ -172,9 +172,10 @@ void CountScan::doReattachToOperationContext() { } unique_ptr<PlanStageStats> CountScan::getStats() { - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_COUNT_SCAN); + unique_ptr<PlanStageStats> ret = + std::make_unique<PlanStageStats>(_commonStats, STAGE_COUNT_SCAN); - unique_ptr<CountScanStats> countStats = make_unique<CountScanStats>(_specificStats); + unique_ptr<CountScanStats> countStats = std::make_unique<CountScanStats>(_specificStats); countStats->keyPattern = _specificStats.keyPattern.getOwned(); countStats->startKey = replaceBSONFieldNames(_startKey, countStats->keyPattern); diff --git a/src/mongo/db/exec/delete.cpp b/src/mongo/db/exec/delete.cpp index 5d6d32a1b8f..5bfc34510d7 100644 --- a/src/mongo/db/exec/delete.cpp +++ b/src/mongo/db/exec/delete.cpp @@ -33,6 +33,8 @@ #include "mongo/db/exec/delete.h" +#include <memory> + #include "mongo/db/catalog/collection.h" #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/curop.h" @@ -43,7 +45,6 @@ #include "mongo/db/query/canonical_query.h" #include "mongo/db/repl/replication_coordinator.h" #include "mongo/db/service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/scopeguard.h" @@ -51,7 +52,6 @@ namespace mongo { using std::unique_ptr; using std::vector; -using stdx::make_unique; namespace { @@ -270,8 +270,8 @@ void DeleteStage::doRestoreStateRequiresCollection() { unique_ptr<PlanStageStats> DeleteStage::getStats() { _commonStats.isEOF = isEOF(); - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_DELETE); - ret->specific = make_unique<DeleteStats>(_specificStats); + unique_ptr<PlanStageStats> ret = std::make_unique<PlanStageStats>(_commonStats, STAGE_DELETE); + ret->specific = std::make_unique<DeleteStats>(_specificStats); ret->children.emplace_back(child()->getStats()); return ret; } diff --git a/src/mongo/db/exec/distinct_scan.cpp b/src/mongo/db/exec/distinct_scan.cpp index 972419c810f..af7d3c49cfa 100644 --- a/src/mongo/db/exec/distinct_scan.cpp +++ b/src/mongo/db/exec/distinct_scan.cpp @@ -29,6 +29,8 @@ #include "mongo/db/exec/distinct_scan.h" +#include <memory> + #include "mongo/db/catalog/index_catalog.h" #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/exec/filter.h" @@ -36,13 +38,11 @@ #include "mongo/db/exec/working_set_computed_data.h" #include "mongo/db/index/index_access_method.h" #include "mongo/db/index/index_descriptor.h" -#include "mongo/stdx/memory.h" namespace mongo { using std::unique_ptr; using std::vector; -using stdx::make_unique; // static const char* DistinctScan::kStageType = "DISTINCT_SCAN"; @@ -160,8 +160,9 @@ unique_ptr<PlanStageStats> DistinctScan::getStats() { _specificStats.indexBounds = _bounds.toBSON(); } - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_DISTINCT_SCAN); - ret->specific = make_unique<DistinctScanStats>(_specificStats); + unique_ptr<PlanStageStats> ret = + std::make_unique<PlanStageStats>(_commonStats, STAGE_DISTINCT_SCAN); + ret->specific = std::make_unique<DistinctScanStats>(_specificStats); return ret; } diff --git a/src/mongo/db/exec/ensure_sorted.cpp b/src/mongo/db/exec/ensure_sorted.cpp index dcfbf096dfe..d10e7e95308 100644 --- a/src/mongo/db/exec/ensure_sorted.cpp +++ b/src/mongo/db/exec/ensure_sorted.cpp @@ -31,15 +31,15 @@ #include "mongo/db/exec/ensure_sorted.h" +#include <memory> + #include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_computed_data.h" #include "mongo/db/query/find_common.h" -#include "mongo/stdx/memory.h" namespace mongo { using std::unique_ptr; -using stdx::make_unique; const char* EnsureSortedStage::kStageType = "ENSURE_SORTED"; @@ -85,8 +85,9 @@ PlanStage::StageState EnsureSortedStage::doWork(WorkingSetID* out) { unique_ptr<PlanStageStats> EnsureSortedStage::getStats() { _commonStats.isEOF = isEOF(); - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_ENSURE_SORTED); - ret->specific = make_unique<EnsureSortedStats>(_specificStats); + unique_ptr<PlanStageStats> ret = + std::make_unique<PlanStageStats>(_commonStats, STAGE_ENSURE_SORTED); + ret->specific = std::make_unique<EnsureSortedStats>(_specificStats); ret->children.emplace_back(child()->getStats()); return ret; } diff --git a/src/mongo/db/exec/eof.cpp b/src/mongo/db/exec/eof.cpp index 96148017d32..acd290f0f1a 100644 --- a/src/mongo/db/exec/eof.cpp +++ b/src/mongo/db/exec/eof.cpp @@ -31,14 +31,14 @@ #include "mongo/db/exec/eof.h" +#include <memory> + #include "mongo/db/exec/scoped_timer.h" -#include "mongo/stdx/memory.h" namespace mongo { using std::unique_ptr; using std::vector; -using stdx::make_unique; // static const char* EOFStage::kStageType = "EOF"; @@ -57,7 +57,7 @@ PlanStage::StageState EOFStage::doWork(WorkingSetID* out) { unique_ptr<PlanStageStats> EOFStage::getStats() { _commonStats.isEOF = isEOF(); - return make_unique<PlanStageStats>(_commonStats, STAGE_EOF); + return std::make_unique<PlanStageStats>(_commonStats, STAGE_EOF); } const SpecificStats* EOFStage::getSpecificStats() const { diff --git a/src/mongo/db/exec/fetch.cpp b/src/mongo/db/exec/fetch.cpp index e54415830c2..c8abe5fa26b 100644 --- a/src/mongo/db/exec/fetch.cpp +++ b/src/mongo/db/exec/fetch.cpp @@ -31,12 +31,13 @@ #include "mongo/db/exec/fetch.h" +#include <memory> + #include "mongo/db/catalog/collection.h" #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/exec/filter.h" #include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" -#include "mongo/stdx/memory.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/str.h" @@ -44,7 +45,6 @@ namespace mongo { using std::unique_ptr; using std::vector; -using stdx::make_unique; // static const char* FetchStage::kStageType = "FETCH"; @@ -192,8 +192,8 @@ unique_ptr<PlanStageStats> FetchStage::getStats() { _commonStats.filter = bob.obj(); } - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_FETCH); - ret->specific = make_unique<FetchStats>(_specificStats); + unique_ptr<PlanStageStats> ret = std::make_unique<PlanStageStats>(_commonStats, STAGE_FETCH); + ret->specific = std::make_unique<FetchStats>(_specificStats); ret->children.emplace_back(child()->getStats()); return ret; } diff --git a/src/mongo/db/exec/geo_near.cpp b/src/mongo/db/exec/geo_near.cpp index 72ffe359813..27b04a5be73 100644 --- a/src/mongo/db/exec/geo_near.cpp +++ b/src/mongo/db/exec/geo_near.cpp @@ -49,7 +49,6 @@ #include "mongo/db/matcher/expression.h" #include "mongo/db/query/expression_index.h" #include "mongo/db/query/expression_index_knobs_gen.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include <algorithm> diff --git a/src/mongo/db/exec/idhack.cpp b/src/mongo/db/exec/idhack.cpp index 652906bfc5d..b54a9d06a52 100644 --- a/src/mongo/db/exec/idhack.cpp +++ b/src/mongo/db/exec/idhack.cpp @@ -31,6 +31,8 @@ #include "mongo/db/exec/idhack.h" +#include <memory> + #include "mongo/db/catalog/index_catalog.h" #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/exec/index_scan.h" @@ -39,13 +41,11 @@ #include "mongo/db/exec/working_set_common.h" #include "mongo/db/exec/working_set_computed_data.h" #include "mongo/db/index/btree_access_method.h" -#include "mongo/stdx/memory.h" namespace mongo { using std::unique_ptr; using std::vector; -using stdx::make_unique; // static const char* IDHackStage::kStageType = "IDHACK"; @@ -173,8 +173,8 @@ bool IDHackStage::supportsQuery(Collection* collection, const CanonicalQuery& qu unique_ptr<PlanStageStats> IDHackStage::getStats() { _commonStats.isEOF = isEOF(); - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_IDHACK); - ret->specific = make_unique<IDHackStats>(_specificStats); + unique_ptr<PlanStageStats> ret = std::make_unique<PlanStageStats>(_commonStats, STAGE_IDHACK); + ret->specific = std::make_unique<IDHackStats>(_specificStats); return ret; } diff --git a/src/mongo/db/exec/index_scan.cpp b/src/mongo/db/exec/index_scan.cpp index 54b85275b4a..22c0cfe5898 100644 --- a/src/mongo/db/exec/index_scan.cpp +++ b/src/mongo/db/exec/index_scan.cpp @@ -33,6 +33,8 @@ #include "mongo/db/exec/index_scan.h" +#include <memory> + #include "mongo/db/catalog/index_catalog.h" #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/exec/filter.h" @@ -41,7 +43,6 @@ #include "mongo/db/index/index_access_method.h" #include "mongo/db/index_names.h" #include "mongo/db/query/index_bounds_builder.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" namespace { @@ -276,8 +277,8 @@ std::unique_ptr<PlanStageStats> IndexScan::getStats() { } std::unique_ptr<PlanStageStats> ret = - stdx::make_unique<PlanStageStats>(_commonStats, STAGE_IXSCAN); - ret->specific = stdx::make_unique<IndexScanStats>(_specificStats); + std::make_unique<PlanStageStats>(_commonStats, STAGE_IXSCAN); + ret->specific = std::make_unique<IndexScanStats>(_specificStats); return ret; } diff --git a/src/mongo/db/exec/limit.cpp b/src/mongo/db/exec/limit.cpp index 8f1eef9e303..605babeeb31 100644 --- a/src/mongo/db/exec/limit.cpp +++ b/src/mongo/db/exec/limit.cpp @@ -29,16 +29,16 @@ #include "mongo/db/exec/limit.h" +#include <memory> + #include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { using std::unique_ptr; using std::vector; -using stdx::make_unique; // static const char* LimitStage::kStageType = "LIMIT"; @@ -81,8 +81,8 @@ PlanStage::StageState LimitStage::doWork(WorkingSetID* out) { unique_ptr<PlanStageStats> LimitStage::getStats() { _commonStats.isEOF = isEOF(); - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_LIMIT); - ret->specific = make_unique<LimitStats>(_specificStats); + unique_ptr<PlanStageStats> ret = std::make_unique<PlanStageStats>(_commonStats, STAGE_LIMIT); + ret->specific = std::make_unique<LimitStats>(_specificStats); ret->children.emplace_back(child()->getStats()); return ret; } diff --git a/src/mongo/db/exec/merge_sort.cpp b/src/mongo/db/exec/merge_sort.cpp index ba01adee76f..8ab56f2b7ad 100644 --- a/src/mongo/db/exec/merge_sort.cpp +++ b/src/mongo/db/exec/merge_sort.cpp @@ -29,11 +29,12 @@ #include "mongo/db/exec/merge_sort.h" +#include <memory> + #include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/db/query/collation/collator_interface.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { @@ -42,7 +43,6 @@ using std::list; using std::string; using std::unique_ptr; using std::vector; -using stdx::make_unique; // static const char* MergeSortStage::kStageType = "SORT_MERGE"; @@ -204,8 +204,9 @@ unique_ptr<PlanStageStats> MergeSortStage::getStats() { _specificStats.sortPattern = _pattern; - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_SORT_MERGE); - ret->specific = make_unique<MergeSortStats>(_specificStats); + unique_ptr<PlanStageStats> ret = + std::make_unique<PlanStageStats>(_commonStats, STAGE_SORT_MERGE); + ret->specific = std::make_unique<MergeSortStats>(_specificStats); for (size_t i = 0; i < _children.size(); ++i) { ret->children.emplace_back(_children[i]->getStats()); } diff --git a/src/mongo/db/exec/multi_iterator.cpp b/src/mongo/db/exec/multi_iterator.cpp index d4154e2ff8e..dba74089ddc 100644 --- a/src/mongo/db/exec/multi_iterator.cpp +++ b/src/mongo/db/exec/multi_iterator.cpp @@ -31,15 +31,15 @@ #include "mongo/db/exec/multi_iterator.h" +#include <memory> + #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/exec/working_set_common.h" -#include "mongo/stdx/memory.h" namespace mongo { using std::unique_ptr; using std::vector; -using stdx::make_unique; const char* MultiIteratorStage::kStageType = "MULTI_ITERATOR"; @@ -110,8 +110,8 @@ void MultiIteratorStage::doReattachToOperationContext() { unique_ptr<PlanStageStats> MultiIteratorStage::getStats() { unique_ptr<PlanStageStats> ret = - make_unique<PlanStageStats>(_commonStats, STAGE_MULTI_ITERATOR); - ret->specific = make_unique<CollectionScanStats>(); + std::make_unique<PlanStageStats>(_commonStats, STAGE_MULTI_ITERATOR); + ret->specific = std::make_unique<CollectionScanStats>(); return ret; } diff --git a/src/mongo/db/exec/multi_plan.cpp b/src/mongo/db/exec/multi_plan.cpp index 425a37087ff..af79d91af30 100644 --- a/src/mongo/db/exec/multi_plan.cpp +++ b/src/mongo/db/exec/multi_plan.cpp @@ -35,6 +35,7 @@ #include <algorithm> #include <math.h> +#include <memory> #include "mongo/base/owned_pointer_vector.h" #include "mongo/db/catalog/collection.h" @@ -46,7 +47,6 @@ #include "mongo/db/query/explain.h" #include "mongo/db/query/plan_cache.h" #include "mongo/db/query/plan_ranker.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/str.h" @@ -56,7 +56,6 @@ using std::endl; using std::list; using std::unique_ptr; using std::vector; -using stdx::make_unique; // static const char* MultiPlanStage::kStageType = "MULTI_PLAN"; @@ -421,8 +420,9 @@ QuerySolution* MultiPlanStage::bestSolution() { unique_ptr<PlanStageStats> MultiPlanStage::getStats() { _commonStats.isEOF = isEOF(); - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_MULTI_PLAN); - ret->specific = make_unique<MultiPlanStats>(_specificStats); + unique_ptr<PlanStageStats> ret = + std::make_unique<PlanStageStats>(_commonStats, STAGE_MULTI_PLAN); + ret->specific = std::make_unique<MultiPlanStats>(_specificStats); for (auto&& child : _children) { ret->children.emplace_back(child->getStats()); } diff --git a/src/mongo/db/exec/near.cpp b/src/mongo/db/exec/near.cpp index e0fbef5a923..1b56d9838e0 100644 --- a/src/mongo/db/exec/near.cpp +++ b/src/mongo/db/exec/near.cpp @@ -31,16 +31,16 @@ #include "mongo/db/exec/near.h" +#include <memory> + #include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" namespace mongo { using std::unique_ptr; using std::vector; -using stdx::make_unique; NearStage::NearStage(OperationContext* opCtx, const char* typeName, @@ -284,7 +284,7 @@ bool NearStage::isEOF() { } unique_ptr<PlanStageStats> NearStage::getStats() { - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, _stageType); + unique_ptr<PlanStageStats> ret = std::make_unique<PlanStageStats>(_commonStats, _stageType); ret->specific.reset(_specificStats.clone()); for (size_t i = 0; i < _childrenIntervals.size(); ++i) { ret->children.emplace_back(_childrenIntervals[i]->covering->getStats()); diff --git a/src/mongo/db/exec/or.cpp b/src/mongo/db/exec/or.cpp index b7ca736215e..965c972669d 100644 --- a/src/mongo/db/exec/or.cpp +++ b/src/mongo/db/exec/or.cpp @@ -29,17 +29,17 @@ #include "mongo/db/exec/or.h" +#include <memory> + #include "mongo/db/exec/filter.h" #include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { using std::unique_ptr; using std::vector; -using stdx::make_unique; // static const char* OrStage::kStageType = "OR"; @@ -131,8 +131,8 @@ unique_ptr<PlanStageStats> OrStage::getStats() { _commonStats.filter = bob.obj(); } - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_OR); - ret->specific = make_unique<OrStats>(_specificStats); + unique_ptr<PlanStageStats> ret = std::make_unique<PlanStageStats>(_commonStats, STAGE_OR); + ret->specific = std::make_unique<OrStats>(_specificStats); for (size_t i = 0; i < _children.size(); ++i) { ret->children.emplace_back(_children[i]->getStats()); } diff --git a/src/mongo/db/exec/pipeline_proxy.cpp b/src/mongo/db/exec/pipeline_proxy.cpp index 8639307271d..cf144ec98e6 100644 --- a/src/mongo/db/exec/pipeline_proxy.cpp +++ b/src/mongo/db/exec/pipeline_proxy.cpp @@ -31,11 +31,11 @@ #include "mongo/db/exec/pipeline_proxy.h" +#include <memory> #include "mongo/db/pipeline/document_source.h" #include "mongo/db/pipeline/expression_context.h" #include "mongo/db/pipeline/pipeline_d.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -43,7 +43,6 @@ using boost::intrusive_ptr; using std::shared_ptr; using std::unique_ptr; using std::vector; -using stdx::make_unique; const char* PipelineProxyStage::kStageType = "PIPELINE_PROXY"; @@ -116,8 +115,8 @@ void PipelineProxyStage::doDispose() { unique_ptr<PlanStageStats> PipelineProxyStage::getStats() { unique_ptr<PlanStageStats> ret = - make_unique<PlanStageStats>(CommonStats(kStageType), STAGE_PIPELINE_PROXY); - ret->specific = make_unique<CollectionScanStats>(); + std::make_unique<PlanStageStats>(CommonStats(kStageType), STAGE_PIPELINE_PROXY); + ret->specific = std::make_unique<CollectionScanStats>(); return ret; } diff --git a/src/mongo/db/exec/projection.cpp b/src/mongo/db/exec/projection.cpp index 1501c5aca95..eb2933ffa63 100644 --- a/src/mongo/db/exec/projection.cpp +++ b/src/mongo/db/exec/projection.cpp @@ -31,7 +31,8 @@ #include "mongo/db/exec/projection.h" -#include "boost/optional.hpp" +#include <boost/optional.hpp> +#include <memory> #include "mongo/db/exec/plan_stage.h" #include "mongo/db/exec/scoped_timer.h" @@ -40,7 +41,6 @@ #include "mongo/db/jsobj.h" #include "mongo/db/matcher/expression.h" #include "mongo/db/record_id.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/str.h" diff --git a/src/mongo/db/exec/queued_data_stage.cpp b/src/mongo/db/exec/queued_data_stage.cpp index 86abf8c62d0..2eee4232245 100644 --- a/src/mongo/db/exec/queued_data_stage.cpp +++ b/src/mongo/db/exec/queued_data_stage.cpp @@ -29,15 +29,15 @@ #include "mongo/db/exec/queued_data_stage.h" +#include <memory> + #include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" -#include "mongo/stdx/memory.h" namespace mongo { using std::unique_ptr; using std::vector; -using stdx::make_unique; const char* QueuedDataStage::kStageType = "QUEUED_DATA"; @@ -76,8 +76,9 @@ bool QueuedDataStage::isEOF() { unique_ptr<PlanStageStats> QueuedDataStage::getStats() { _commonStats.isEOF = isEOF(); - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_QUEUED_DATA); - ret->specific = make_unique<MockStats>(_specificStats); + unique_ptr<PlanStageStats> ret = + std::make_unique<PlanStageStats>(_commonStats, STAGE_QUEUED_DATA); + ret->specific = std::make_unique<MockStats>(_specificStats); return ret; } diff --git a/src/mongo/db/exec/queued_data_stage_test.cpp b/src/mongo/db/exec/queued_data_stage_test.cpp index 257423679a7..bd1e0637e7d 100644 --- a/src/mongo/db/exec/queued_data_stage_test.cpp +++ b/src/mongo/db/exec/queued_data_stage_test.cpp @@ -34,11 +34,11 @@ #include "mongo/db/exec/queued_data_stage.h" #include <boost/optional.hpp> +#include <memory> #include "mongo/db/exec/working_set.h" #include "mongo/db/operation_context.h" #include "mongo/db/service_context_d_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/clock_source_mock.h" @@ -47,12 +47,11 @@ using namespace mongo; namespace { using std::unique_ptr; -using stdx::make_unique; class QueuedDataStageTest : public ServiceContextMongoDTest { public: QueuedDataStageTest() { - getServiceContext()->setFastClockSource(stdx::make_unique<ClockSourceMock>()); + getServiceContext()->setFastClockSource(std::make_unique<ClockSourceMock>()); _opCtx = makeOperationContext(); } @@ -70,7 +69,7 @@ private: // TEST_F(QueuedDataStageTest, getValidStats) { WorkingSet ws; - auto mock = make_unique<QueuedDataStage>(getOpCtx(), &ws); + auto mock = std::make_unique<QueuedDataStage>(getOpCtx(), &ws); const CommonStats* commonStats = mock->getCommonStats(); ASSERT_EQUALS(commonStats->works, static_cast<size_t>(0)); const SpecificStats* specificStats = mock->getSpecificStats(); @@ -85,7 +84,7 @@ TEST_F(QueuedDataStageTest, getValidStats) { TEST_F(QueuedDataStageTest, validateStats) { WorkingSet ws; WorkingSetID wsID; - auto mock = make_unique<QueuedDataStage>(getOpCtx(), &ws); + auto mock = std::make_unique<QueuedDataStage>(getOpCtx(), &ws); // make sure that we're at all zero const CommonStats* stats = mock->getCommonStats(); diff --git a/src/mongo/db/exec/shard_filter.cpp b/src/mongo/db/exec/shard_filter.cpp index 179b4a745f6..879e4eef27d 100644 --- a/src/mongo/db/exec/shard_filter.cpp +++ b/src/mongo/db/exec/shard_filter.cpp @@ -33,11 +33,12 @@ #include "mongo/db/exec/shard_filter.h" +#include <memory> + #include "mongo/db/exec/filter.h" #include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/s/shard_key_pattern.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" namespace mongo { @@ -45,7 +46,6 @@ namespace mongo { using std::shared_ptr; using std::unique_ptr; using std::vector; -using stdx::make_unique; // static const char* ShardFilterStage::kStageType = "SHARDING_FILTER"; @@ -116,9 +116,9 @@ PlanStage::StageState ShardFilterStage::doWork(WorkingSetID* out) { unique_ptr<PlanStageStats> ShardFilterStage::getStats() { _commonStats.isEOF = isEOF(); unique_ptr<PlanStageStats> ret = - make_unique<PlanStageStats>(_commonStats, STAGE_SHARDING_FILTER); + std::make_unique<PlanStageStats>(_commonStats, STAGE_SHARDING_FILTER); ret->children.emplace_back(child()->getStats()); - ret->specific = make_unique<ShardingFilterStats>(_specificStats); + ret->specific = std::make_unique<ShardingFilterStats>(_specificStats); return ret; } diff --git a/src/mongo/db/exec/skip.cpp b/src/mongo/db/exec/skip.cpp index 9675c1425c7..a87a9dd745b 100644 --- a/src/mongo/db/exec/skip.cpp +++ b/src/mongo/db/exec/skip.cpp @@ -28,16 +28,17 @@ */ #include "mongo/db/exec/skip.h" + +#include <memory> + #include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set_common.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { using std::unique_ptr; using std::vector; -using stdx::make_unique; // static const char* SkipStage::kStageType = "SKIP"; @@ -85,8 +86,8 @@ PlanStage::StageState SkipStage::doWork(WorkingSetID* out) { unique_ptr<PlanStageStats> SkipStage::getStats() { _commonStats.isEOF = isEOF(); _specificStats.skip = _toSkip; - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_SKIP); - ret->specific = make_unique<SkipStats>(_specificStats); + unique_ptr<PlanStageStats> ret = std::make_unique<PlanStageStats>(_commonStats, STAGE_SKIP); + ret->specific = std::make_unique<SkipStats>(_specificStats); ret->children.emplace_back(child()->getStats()); return ret; } diff --git a/src/mongo/db/exec/sort.cpp b/src/mongo/db/exec/sort.cpp index 9ddb29723b3..89de29e69f9 100644 --- a/src/mongo/db/exec/sort.cpp +++ b/src/mongo/db/exec/sort.cpp @@ -32,6 +32,7 @@ #include "mongo/db/exec/sort.h" #include <algorithm> +#include <memory> #include "mongo/db/catalog/collection.h" #include "mongo/db/exec/scoped_timer.h" @@ -42,7 +43,6 @@ #include "mongo/db/query/find_common.h" #include "mongo/db/query/query_knobs_gen.h" #include "mongo/db/query/query_planner.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" namespace mongo { @@ -50,7 +50,6 @@ namespace mongo { using std::endl; using std::unique_ptr; using std::vector; -using stdx::make_unique; // static const char* SortStage::kStageType = "SORT"; @@ -82,7 +81,7 @@ SortStage::SortStage(OperationContext* opCtx, _children.emplace_back(child); BSONObj sortComparator = FindCommon::transformSortSpec(_pattern); - _sortKeyComparator = stdx::make_unique<WorkingSetComparator>(sortComparator); + _sortKeyComparator = std::make_unique<WorkingSetComparator>(sortComparator); // If limit > 1, we need to initialize _dataSet here to maintain ordered set of data items while // fetching from the child stage. @@ -177,8 +176,8 @@ unique_ptr<PlanStageStats> SortStage::getStats() { _specificStats.limit = _limit; _specificStats.sortPattern = _pattern.getOwned(); - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_SORT); - ret->specific = make_unique<SortStats>(_specificStats); + unique_ptr<PlanStageStats> ret = std::make_unique<PlanStageStats>(_commonStats, STAGE_SORT); + ret->specific = std::make_unique<SortStats>(_specificStats); ret->children.emplace_back(child()->getStats()); return ret; } diff --git a/src/mongo/db/exec/sort_key_generator.cpp b/src/mongo/db/exec/sort_key_generator.cpp index abce9f27c60..5fb3fd905ee 100644 --- a/src/mongo/db/exec/sort_key_generator.cpp +++ b/src/mongo/db/exec/sort_key_generator.cpp @@ -33,6 +33,7 @@ #include "mongo/db/exec/sort_key_generator.h" +#include <memory> #include <vector> #include "mongo/bson/bsonobj_comparator.h" @@ -44,7 +45,6 @@ #include "mongo/db/matcher/extensions_callback_noop.h" #include "mongo/db/query/collation/collation_index_key.h" #include "mongo/db/query/collation/collator_interface.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" namespace mongo { @@ -66,7 +66,7 @@ bool SortKeyGeneratorStage::isEOF() { PlanStage::StageState SortKeyGeneratorStage::doWork(WorkingSetID* out) { if (!_sortKeyGen) { - _sortKeyGen = stdx::make_unique<SortKeyGenerator>(_sortSpec, _collator); + _sortKeyGen = std::make_unique<SortKeyGenerator>(_sortSpec, _collator); return PlanStage::NEED_TIME; } @@ -106,7 +106,7 @@ PlanStage::StageState SortKeyGeneratorStage::doWork(WorkingSetID* out) { } std::unique_ptr<PlanStageStats> SortKeyGeneratorStage::getStats() { - auto ret = stdx::make_unique<PlanStageStats>(_commonStats, STAGE_SORT_KEY_GENERATOR); + auto ret = std::make_unique<PlanStageStats>(_commonStats, STAGE_SORT_KEY_GENERATOR); ret->children.emplace_back(child()->getStats()); return ret; } diff --git a/src/mongo/db/exec/sort_test.cpp b/src/mongo/db/exec/sort_test.cpp index e3a2ad503dc..e693bf6b412 100644 --- a/src/mongo/db/exec/sort_test.cpp +++ b/src/mongo/db/exec/sort_test.cpp @@ -34,6 +34,7 @@ #include "mongo/db/exec/sort.h" #include <boost/optional.hpp> +#include <memory> #include "mongo/db/exec/queued_data_stage.h" #include "mongo/db/json.h" @@ -41,7 +42,6 @@ #include "mongo/db/query/collation/collator_factory_mock.h" #include "mongo/db/query/collation/collator_interface_mock.h" #include "mongo/db/service_context_d_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/clock_source_mock.h" @@ -52,10 +52,9 @@ namespace { class SortStageTest : public ServiceContextMongoDTest { public: SortStageTest() { - getServiceContext()->setFastClockSource(stdx::make_unique<ClockSourceMock>()); + getServiceContext()->setFastClockSource(std::make_unique<ClockSourceMock>()); _opCtx = makeOperationContext(); - CollatorFactoryInterface::set(getServiceContext(), - stdx::make_unique<CollatorFactoryMock>()); + CollatorFactoryInterface::set(getServiceContext(), std::make_unique<CollatorFactoryMock>()); } OperationContext* getOpCtx() { @@ -80,7 +79,7 @@ public: WorkingSet ws; // QueuedDataStage will be owned by SortStage. - auto queuedDataStage = stdx::make_unique<QueuedDataStage>(getOpCtx(), &ws); + auto queuedDataStage = std::make_unique<QueuedDataStage>(getOpCtx(), &ws); BSONObj inputObj = fromjson(inputStr); BSONElement inputElt = inputObj.getField("input"); ASSERT(inputElt.isABSONObj()); @@ -104,7 +103,7 @@ public: params.pattern = fromjson(patternStr); params.limit = limit; - auto sortKeyGen = stdx::make_unique<SortKeyGeneratorStage>( + auto sortKeyGen = std::make_unique<SortKeyGeneratorStage>( getOpCtx(), queuedDataStage.release(), &ws, params.pattern, collator); SortStage sort(getOpCtx(), params, &ws, sortKeyGen.release()); @@ -160,8 +159,8 @@ TEST_F(SortStageTest, SortEmptyWorkingSet) { WorkingSet ws; // QueuedDataStage will be owned by SortStage. - auto queuedDataStage = stdx::make_unique<QueuedDataStage>(getOpCtx(), &ws); - auto sortKeyGen = stdx::make_unique<SortKeyGeneratorStage>( + auto queuedDataStage = std::make_unique<QueuedDataStage>(getOpCtx(), &ws); + auto sortKeyGen = std::make_unique<SortKeyGeneratorStage>( getOpCtx(), queuedDataStage.release(), &ws, BSONObj(), nullptr); SortStageParams params; SortStage sort(getOpCtx(), params, &ws, sortKeyGen.release()); diff --git a/src/mongo/db/exec/stagedebug_cmd.cpp b/src/mongo/db/exec/stagedebug_cmd.cpp index c313f3b592d..a01bc911754 100644 --- a/src/mongo/db/exec/stagedebug_cmd.cpp +++ b/src/mongo/db/exec/stagedebug_cmd.cpp @@ -31,6 +31,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/base/init.h" #include "mongo/db/auth/action_set.h" #include "mongo/db/auth/action_type.h" @@ -60,7 +62,6 @@ #include "mongo/db/matcher/expression_text_base.h" #include "mongo/db/matcher/extensions_callback_real.h" #include "mongo/db/query/plan_executor.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" namespace mongo { @@ -68,7 +69,6 @@ namespace mongo { using std::unique_ptr; using std::string; using std::vector; -using stdx::make_unique; namespace { @@ -189,7 +189,7 @@ public: // Add a fetch at the top for the user so we can get obj back for sure. // TODO: Do we want to do this for the user? I think so. unique_ptr<PlanStage> rootFetch = - make_unique<FetchStage>(opCtx, ws.get(), userRoot, nullptr, collection); + std::make_unique<FetchStage>(opCtx, ws.get(), userRoot, nullptr, collection); auto statusWithPlanExecutor = PlanExecutor::make( opCtx, std::move(ws), std::move(rootFetch), collection, PlanExecutor::YIELD_AUTO); @@ -314,7 +314,7 @@ public: uassert( 16921, "Nodes argument must be provided to AND", nodeArgs["nodes"].isABSONObj()); - auto andStage = make_unique<AndHashStage>(opCtx, workingSet); + auto andStage = std::make_unique<AndHashStage>(opCtx, workingSet); int nodesAdded = 0; BSONObjIterator it(nodeArgs["nodes"].Obj()); @@ -337,7 +337,7 @@ public: uassert( 16924, "Nodes argument must be provided to AND", nodeArgs["nodes"].isABSONObj()); - auto andStage = make_unique<AndSortedStage>(opCtx, workingSet); + auto andStage = std::make_unique<AndSortedStage>(opCtx, workingSet); int nodesAdded = 0; BSONObjIterator it(nodeArgs["nodes"].Obj()); @@ -362,7 +362,7 @@ public: uassert(16935, "Dedup argument must be provided to OR", !nodeArgs["dedup"].eoo()); BSONObjIterator it(nodeArgs["nodes"].Obj()); auto orStage = - make_unique<OrStage>(opCtx, workingSet, nodeArgs["dedup"].Bool(), matcher); + std::make_unique<OrStage>(opCtx, workingSet, nodeArgs["dedup"].Bool(), matcher); while (it.more()) { BSONElement e = it.next(); if (!e.isABSONObj()) { @@ -433,7 +433,7 @@ public: params.pattern = nodeArgs["pattern"].Obj(); // Dedup is true by default. - auto mergeStage = make_unique<MergeSortStage>(opCtx, params, workingSet); + auto mergeStage = std::make_unique<MergeSortStage>(opCtx, params, workingSet); 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 168fc342d3d..2506db606b1 100644 --- a/src/mongo/db/exec/subplan.cpp +++ b/src/mongo/db/exec/subplan.cpp @@ -46,7 +46,6 @@ #include "mongo/db/query/query_planner.h" #include "mongo/db/query/query_planner_common.h" #include "mongo/db/query/stage_builder.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/scopeguard.h" #include "mongo/util/transitional_tools_do_not_use/vector_spooling.h" @@ -56,7 +55,6 @@ namespace mongo { using std::endl; using std::unique_ptr; using std::vector; -using stdx::make_unique; const char* SubplanStage::kStageType = "SUBPLAN"; @@ -117,7 +115,7 @@ Status SubplanStage::planSubqueries() { for (size_t i = 0; i < _orExpression->numChildren(); ++i) { // We need a place to shove the results from planning this branch. - _branchResults.push_back(stdx::make_unique<BranchPlanningResult>()); + _branchResults.push_back(std::make_unique<BranchPlanningResult>()); BranchPlanningResult* branchResult = _branchResults.back().get(); MatchExpression* orChild = _orExpression->getChild(i); @@ -260,10 +258,10 @@ Status SubplanStage::choosePlanForSubqueries(PlanYieldPolicy* yieldPolicy) { // messages that can be generated if pickBestPlan yields. invariant(_children.empty()); _children.emplace_back( - stdx::make_unique<MultiPlanStage>(getOpCtx(), - collection(), - branchResult->canonicalQuery.get(), - MultiPlanStage::CachingMode::SometimesCache)); + std::make_unique<MultiPlanStage>(getOpCtx(), + collection(), + branchResult->canonicalQuery.get(), + MultiPlanStage::CachingMode::SometimesCache)); ON_BLOCK_EXIT([&] { invariant(_children.size() == 1); // Make sure nothing else was added to _children. _children.pop_back(); @@ -483,7 +481,7 @@ PlanStage::StageState SubplanStage::doWork(WorkingSetID* out) { unique_ptr<PlanStageStats> SubplanStage::getStats() { _commonStats.isEOF = isEOF(); - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_SUBPLAN); + unique_ptr<PlanStageStats> ret = std::make_unique<PlanStageStats>(_commonStats, STAGE_SUBPLAN); ret->children.emplace_back(child()->getStats()); return ret; } diff --git a/src/mongo/db/exec/subplan.h b/src/mongo/db/exec/subplan.h index f07d8f5815c..f027d0412d3 100644 --- a/src/mongo/db/exec/subplan.h +++ b/src/mongo/db/exec/subplan.h @@ -43,7 +43,6 @@ #include "mongo/db/query/query_planner_params.h" #include "mongo/db/query/query_solution.h" #include "mongo/db/record_id.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/db/exec/text.cpp b/src/mongo/db/exec/text.cpp index eba576e074e..571433c149c 100644 --- a/src/mongo/db/exec/text.cpp +++ b/src/mongo/db/exec/text.cpp @@ -29,6 +29,7 @@ #include "mongo/db/exec/text.h" +#include <memory> #include <vector> #include "mongo/db/exec/fetch.h" @@ -42,16 +43,13 @@ #include "mongo/db/fts/fts_index_format.h" #include "mongo/db/jsobj.h" #include "mongo/db/query/internal_plans.h" -#include "mongo/stdx/memory.h" namespace mongo { using std::string; using std::unique_ptr; using std::vector; -using stdx::make_unique; -using stdx::make_unique; using fts::FTSIndexFormat; using fts::MAX_WEIGHT; @@ -85,8 +83,8 @@ PlanStage::StageState TextStage::doWork(WorkingSetID* out) { unique_ptr<PlanStageStats> TextStage::getStats() { _commonStats.isEOF = isEOF(); - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_TEXT); - ret->specific = make_unique<TextStats>(_specificStats); + unique_ptr<PlanStageStats> ret = std::make_unique<PlanStageStats>(_commonStats, STAGE_TEXT); + ret->specific = std::make_unique<TextStats>(_specificStats); ret->children.emplace_back(child()->getStats()); return ret; } @@ -114,7 +112,7 @@ unique_ptr<PlanStage> TextStage::buildTextTree(OperationContext* opCtx, ixparams.direction = -1; ixparams.shouldDedup = _params.index->isMultikey(opCtx); - indexScanList.push_back(stdx::make_unique<IndexScan>(opCtx, ixparams, ws, nullptr)); + indexScanList.push_back(std::make_unique<IndexScan>(opCtx, ixparams, ws, nullptr)); } // Build the union of the index scans as a TEXT_OR or an OR stage, depending on whether the @@ -123,16 +121,17 @@ unique_ptr<PlanStage> TextStage::buildTextTree(OperationContext* opCtx, if (wantTextScore) { // We use a TEXT_OR stage to get the union of the results from the index scans and then // compute their text scores. This is a blocking operation. - auto textScorer = make_unique<TextOrStage>(opCtx, _params.spec, ws, filter, collection); + auto textScorer = + std::make_unique<TextOrStage>(opCtx, _params.spec, ws, filter, collection); textScorer->addChildren(std::move(indexScanList)); - textMatchStage = make_unique<TextMatchStage>( + textMatchStage = std::make_unique<TextMatchStage>( opCtx, std::move(textScorer), _params.query, _params.spec, ws); } else { // Because we don't need the text score, we can use a non-blocking OR stage to get the union // of the index scans. - auto textSearcher = make_unique<OrStage>(opCtx, ws, true, filter); + auto textSearcher = std::make_unique<OrStage>(opCtx, ws, true, filter); textSearcher->addChildren(std::move(indexScanList)); @@ -140,10 +139,10 @@ unique_ptr<PlanStage> TextStage::buildTextTree(OperationContext* opCtx, // add our own FETCH stage to satisfy the requirement of the TEXT_MATCH stage that its // WorkingSetMember inputs have fetched data. const MatchExpression* emptyFilter = nullptr; - auto fetchStage = - make_unique<FetchStage>(opCtx, ws, textSearcher.release(), emptyFilter, collection); + auto fetchStage = std::make_unique<FetchStage>( + opCtx, ws, textSearcher.release(), emptyFilter, collection); - textMatchStage = make_unique<TextMatchStage>( + textMatchStage = std::make_unique<TextMatchStage>( opCtx, std::move(fetchStage), _params.query, _params.spec, ws); } diff --git a/src/mongo/db/exec/text_match.cpp b/src/mongo/db/exec/text_match.cpp index 301700389e4..a74a7149506 100644 --- a/src/mongo/db/exec/text_match.cpp +++ b/src/mongo/db/exec/text_match.cpp @@ -29,20 +29,19 @@ #include "mongo/db/exec/text_match.h" +#include <memory> #include <vector> #include "mongo/db/exec/scoped_timer.h" #include "mongo/db/exec/working_set.h" #include "mongo/db/exec/working_set_common.h" #include "mongo/db/jsobj.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { using std::unique_ptr; using std::vector; -using stdx::make_unique; const char* TextMatchStage::kStageType = "TEXT_MATCH"; @@ -64,8 +63,9 @@ bool TextMatchStage::isEOF() { std::unique_ptr<PlanStageStats> TextMatchStage::getStats() { _commonStats.isEOF = isEOF(); - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_TEXT_MATCH); - ret->specific = make_unique<TextMatchStats>(_specificStats); + unique_ptr<PlanStageStats> ret = + std::make_unique<PlanStageStats>(_commonStats, STAGE_TEXT_MATCH); + ret->specific = std::make_unique<TextMatchStats>(_specificStats); ret->children.emplace_back(child()->getStats()); return ret; diff --git a/src/mongo/db/exec/text_or.cpp b/src/mongo/db/exec/text_or.cpp index 52fc60a53a1..2e3eb79d5a0 100644 --- a/src/mongo/db/exec/text_or.cpp +++ b/src/mongo/db/exec/text_or.cpp @@ -30,6 +30,7 @@ #include "mongo/db/exec/text_or.h" #include <map> +#include <memory> #include <vector> #include "mongo/db/concurrency/write_conflict_exception.h" @@ -41,14 +42,12 @@ #include "mongo/db/exec/working_set_computed_data.h" #include "mongo/db/jsobj.h" #include "mongo/db/record_id.h" -#include "mongo/stdx/memory.h" namespace mongo { using std::unique_ptr; using std::vector; using std::string; -using stdx::make_unique; using fts::FTSSpec; @@ -111,8 +110,8 @@ std::unique_ptr<PlanStageStats> TextOrStage::getStats() { _commonStats.filter = bob.obj(); } - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_TEXT_OR); - ret->specific = make_unique<TextOrStats>(_specificStats); + unique_ptr<PlanStageStats> ret = std::make_unique<PlanStageStats>(_commonStats, STAGE_TEXT_OR); + ret->specific = std::make_unique<TextOrStats>(_specificStats); for (auto&& child : _children) { ret->children.emplace_back(child->getStats()); diff --git a/src/mongo/db/exec/update_stage.cpp b/src/mongo/db/exec/update_stage.cpp index d77676122a8..34953bb62ff 100644 --- a/src/mongo/db/exec/update_stage.cpp +++ b/src/mongo/db/exec/update_stage.cpp @@ -34,6 +34,7 @@ #include "mongo/db/exec/update_stage.h" #include <algorithm> +#include <memory> #include "mongo/base/status_with.h" #include "mongo/bson/bson_comparator_interface_base.h" @@ -53,7 +54,6 @@ #include "mongo/db/update/storage_validation.h" #include "mongo/s/shard_key_pattern.h" #include "mongo/s/would_change_owning_shard_exception.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" #include "mongo/util/scopeguard.h" @@ -67,7 +67,6 @@ MONGO_FAIL_POINT_DEFINE(hangBeforeThrowWouldChangeOwningShard); using std::string; using std::unique_ptr; using std::vector; -using stdx::make_unique; namespace mb = mutablebson; @@ -878,8 +877,8 @@ void UpdateStage::doRestoreStateRequiresCollection() { unique_ptr<PlanStageStats> UpdateStage::getStats() { _commonStats.isEOF = isEOF(); - unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_UPDATE); - ret->specific = make_unique<UpdateStats>(_specificStats); + unique_ptr<PlanStageStats> ret = std::make_unique<PlanStageStats>(_commonStats, STAGE_UPDATE); + ret->specific = std::make_unique<UpdateStats>(_specificStats); ret->children.emplace_back(child()->getStats()); return ret; } diff --git a/src/mongo/db/free_mon/free_mon_controller_test.cpp b/src/mongo/db/free_mon/free_mon_controller_test.cpp index 6892cd034b4..0ad7a139dc6 100644 --- a/src/mongo/db/free_mon/free_mon_controller_test.cpp +++ b/src/mongo/db/free_mon/free_mon_controller_test.cpp @@ -34,6 +34,7 @@ #include <boost/filesystem.hpp> #include <future> #include <iostream> +#include <memory> #include <snappy.h> #include "mongo/db/free_mon/free_mon_controller.h" @@ -63,7 +64,6 @@ #include "mongo/executor/network_interface_mock.h" #include "mongo/executor/thread_pool_task_executor_test_fixture.h" #include "mongo/rpc/object_check.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/barrier.h" #include "mongo/unittest/temp_dir.h" #include "mongo/unittest/unittest.h" @@ -420,7 +420,7 @@ void FreeMonControllerTest::setUp() { _opCtx = cc().makeOperationContext(); - //_storage = stdx::make_unique<repl::StorageInterfaceImpl>(); + //_storage = std::make_unique<repl::StorageInterfaceImpl>(); repl::StorageInterface::set(service, std::make_unique<repl::StorageInterfaceImpl>()); // Transition to PRIMARY so that the server can accept writes. @@ -889,8 +889,8 @@ struct ControllerHolder { ControllerHolder(executor::ThreadPoolTaskExecutor* pool, FreeMonNetworkInterfaceMock::Options opts, bool useCrankForTest = true) { - auto registerCollectorUnique = stdx::make_unique<FreeMonMetricsCollectorMock>(); - auto metricsCollectorUnique = stdx::make_unique<FreeMonMetricsCollectorMock>(); + auto registerCollectorUnique = std::make_unique<FreeMonMetricsCollectorMock>(); + auto metricsCollectorUnique = std::make_unique<FreeMonMetricsCollectorMock>(); // If we want to manually turn the crank the queue, we must process the messages // synchronously diff --git a/src/mongo/db/free_mon/free_mon_mongod.cpp b/src/mongo/db/free_mon/free_mon_mongod.cpp index b6c150f5e64..03417b71425 100644 --- a/src/mongo/db/free_mon/free_mon_mongod.cpp +++ b/src/mongo/db/free_mon/free_mon_mongod.cpp @@ -81,7 +81,7 @@ auto makeTaskExecutor(ServiceContext* /*serviceContext*/) { tpOptions.onCreateThread = [](const std::string& threadName) { Client::initThread(threadName.c_str()); }; - return stdx::make_unique<executor::ThreadPoolTaskExecutor>( + return std::make_unique<executor::ThreadPoolTaskExecutor>( std::make_unique<ThreadPool>(tpOptions), executor::makeNetworkInterface("FreeMonNet")); } @@ -285,23 +285,23 @@ void registerCollectors(FreeMonController* controller) { // These are collected only at registration // // CmdBuildInfo - controller->addRegistrationCollector(stdx::make_unique<FTDCSimpleInternalCommandCollector>( + controller->addRegistrationCollector(std::make_unique<FTDCSimpleInternalCommandCollector>( "buildInfo", "buildInfo", "", BSON("buildInfo" << 1))); // HostInfoCmd - controller->addRegistrationCollector(stdx::make_unique<FTDCSimpleInternalCommandCollector>( + controller->addRegistrationCollector(std::make_unique<FTDCSimpleInternalCommandCollector>( "hostInfo", "hostInfo", "", BSON("hostInfo" << 1))); // Add storageEngine section from serverStatus controller->addRegistrationCollector( - stdx::make_unique<FreeMonLocalStorageEngineStatusCollector>()); + std::make_unique<FreeMonLocalStorageEngineStatusCollector>()); // Gather one document from local.clustermanager - controller->addRegistrationCollector(stdx::make_unique<FreeMonLocalClusterManagerCollector>()); + controller->addRegistrationCollector(std::make_unique<FreeMonLocalClusterManagerCollector>()); // These are periodically for metrics upload // - controller->addMetricsCollector(stdx::make_unique<FTDCSimpleInternalCommandCollector>( + controller->addMetricsCollector(std::make_unique<FTDCSimpleInternalCommandCollector>( "getDiagnosticData", "diagnosticData", "", BSON("getDiagnosticData" << 1))); // These are collected at registration and as metrics periodically @@ -309,10 +309,10 @@ void registerCollectors(FreeMonController* controller) { if (repl::ReplicationCoordinator::get(getGlobalServiceContext())->getReplicationMode() != repl::ReplicationCoordinator::modeNone) { // CmdReplSetGetConfig - controller->addRegistrationCollector(stdx::make_unique<FTDCSimpleInternalCommandCollector>( + controller->addRegistrationCollector(std::make_unique<FTDCSimpleInternalCommandCollector>( "replSetGetConfig", "replSetGetConfig", "", BSON("replSetGetConfig" << 1))); - controller->addMetricsCollector(stdx::make_unique<FTDCSimpleInternalCommandCollector>( + controller->addMetricsCollector(std::make_unique<FTDCSimpleInternalCommandCollector>( "replSetGetConfig", "replSetGetConfig", "", BSON("replSetGetConfig" << 1))); // Collect UUID for certain collections. @@ -323,10 +323,10 @@ void registerCollectors(FreeMonController* controller) { std::make_unique<FreeMonNamespaceUUIDCollector>(namespaces)); } - controller->addRegistrationCollector(stdx::make_unique<FTDCSimpleInternalCommandCollector>( + controller->addRegistrationCollector(std::make_unique<FTDCSimpleInternalCommandCollector>( "isMaster", "isMaster", "", BSON("isMaster" << 1))); - controller->addMetricsCollector(stdx::make_unique<FTDCSimpleInternalCommandCollector>( + controller->addMetricsCollector(std::make_unique<FTDCSimpleInternalCommandCollector>( "isMaster", "isMaster", "", BSON("isMaster" << 1))); } @@ -344,7 +344,7 @@ void startFreeMonitoring(ServiceContext* serviceContext) { auto network = std::unique_ptr<FreeMonNetworkInterface>(new FreeMonNetworkHttp(serviceContext)); - auto controller = stdx::make_unique<FreeMonController>(std::move(network)); + auto controller = std::make_unique<FreeMonController>(std::move(network)); auto controllerPtr = controller.get(); @@ -392,7 +392,7 @@ void notifyFreeMonitoringOnTransitionToPrimary() { } void setupFreeMonitoringOpObserver(OpObserverRegistry* registry) { - registry->addObserver(stdx::make_unique<FreeMonOpObserver>()); + registry->addObserver(std::make_unique<FreeMonOpObserver>()); } } // namespace mongo diff --git a/src/mongo/db/ftdc/controller.cpp b/src/mongo/db/ftdc/controller.cpp index 0bb2e44fa21..db944bae91d 100644 --- a/src/mongo/db/ftdc/controller.cpp +++ b/src/mongo/db/ftdc/controller.cpp @@ -33,12 +33,13 @@ #include "mongo/db/ftdc/controller.h" +#include <memory> + #include "mongo/db/client.h" #include "mongo/db/ftdc/collector.h" #include "mongo/db/ftdc/util.h" #include "mongo/db/jsobj.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/util/concurrency/idle_thread_block.h" diff --git a/src/mongo/db/ftdc/controller_test.cpp b/src/mongo/db/ftdc/controller_test.cpp index 8afc65b96a3..d4f87f38c79 100644 --- a/src/mongo/db/ftdc/controller_test.cpp +++ b/src/mongo/db/ftdc/controller_test.cpp @@ -31,6 +31,7 @@ #include <boost/filesystem.hpp> #include <iostream> +#include <memory> #include "mongo/base/data_type_validated.h" #include "mongo/base/init.h" @@ -45,7 +46,6 @@ #include "mongo/db/ftdc/ftdc_test.h" #include "mongo/db/jsobj.h" #include "mongo/db/service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/temp_dir.h" #include "mongo/unittest/unittest.h" @@ -171,8 +171,8 @@ TEST_F(FTDCControllerTest, TestFull) { FTDCController c(dir, config); - auto c1 = stdx::make_unique<FTDCMetricsCollectorMock2>(); - auto c2 = stdx::make_unique<FTDCMetricsCollectorMockRotate>(); + auto c1 = std::make_unique<FTDCMetricsCollectorMock2>(); + auto c2 = std::make_unique<FTDCMetricsCollectorMockRotate>(); auto c1Ptr = c1.get(); auto c2Ptr = c2.get(); @@ -243,7 +243,7 @@ TEST_F(FTDCControllerTest, TestStartAsDisabled) { config.maxFileSizeBytes = FTDCConfig::kMaxFileSizeBytesDefault; config.maxDirectorySizeBytes = FTDCConfig::kMaxDirectorySizeBytesDefault; - auto c1 = stdx::make_unique<FTDCMetricsCollectorMock2>(); + auto c1 = std::make_unique<FTDCMetricsCollectorMock2>(); auto c1Ptr = c1.get(); diff --git a/src/mongo/db/ftdc/file_manager.cpp b/src/mongo/db/ftdc/file_manager.cpp index e79d4c9febc..cdc7dcdb125 100644 --- a/src/mongo/db/ftdc/file_manager.cpp +++ b/src/mongo/db/ftdc/file_manager.cpp @@ -34,6 +34,7 @@ #include "mongo/db/ftdc/file_manager.h" #include <boost/filesystem.hpp> +#include <memory> #include <string> #include "mongo/base/string_data.h" @@ -42,7 +43,6 @@ #include "mongo/db/ftdc/constants.h" #include "mongo/db/ftdc/file_reader.h" #include "mongo/db/jsobj.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" #include "mongo/util/str.h" diff --git a/src/mongo/db/ftdc/file_manager_test.cpp b/src/mongo/db/ftdc/file_manager_test.cpp index 1bb8ea78702..13493e984b7 100644 --- a/src/mongo/db/ftdc/file_manager_test.cpp +++ b/src/mongo/db/ftdc/file_manager_test.cpp @@ -32,6 +32,7 @@ #include <algorithm> #include <boost/filesystem.hpp> #include <iostream> +#include <memory> #include <string> #include "mongo/base/init.h" @@ -45,7 +46,6 @@ #include "mongo/db/ftdc/file_writer.h" #include "mongo/db/ftdc/ftdc_test.h" #include "mongo/db/jsobj.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/temp_dir.h" #include "mongo/unittest/unittest.h" diff --git a/src/mongo/db/ftdc/file_writer_test.cpp b/src/mongo/db/ftdc/file_writer_test.cpp index 5da93d7026d..b8f6dbd9f70 100644 --- a/src/mongo/db/ftdc/file_writer_test.cpp +++ b/src/mongo/db/ftdc/file_writer_test.cpp @@ -30,6 +30,7 @@ #include "mongo/platform/basic.h" #include <boost/filesystem.hpp> +#include <memory> #include "mongo/base/init.h" #include "mongo/bson/bsonmisc.h" @@ -39,7 +40,6 @@ #include "mongo/db/ftdc/file_writer.h" #include "mongo/db/ftdc/ftdc_test.h" #include "mongo/db/jsobj.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/temp_dir.h" #include "mongo/unittest/unittest.h" diff --git a/src/mongo/db/ftdc/ftdc_mongod.cpp b/src/mongo/db/ftdc/ftdc_mongod.cpp index 6f7a9dd4a9d..73e598ec410 100644 --- a/src/mongo/db/ftdc/ftdc_mongod.cpp +++ b/src/mongo/db/ftdc/ftdc_mongod.cpp @@ -47,16 +47,16 @@ void registerMongoDCollectors(FTDCController* controller) { if (repl::ReplicationCoordinator::get(getGlobalServiceContext())->getReplicationMode() != repl::ReplicationCoordinator::modeNone) { // CmdReplSetGetStatus - controller->addPeriodicCollector(stdx::make_unique<FTDCSimpleInternalCommandCollector>( + controller->addPeriodicCollector(std::make_unique<FTDCSimpleInternalCommandCollector>( "replSetGetStatus", "replSetGetStatus", "", BSON("replSetGetStatus" << 1))); // CollectionStats controller->addPeriodicCollector( - stdx::make_unique<FTDCSimpleInternalCommandCollector>("collStats", - "local.oplog.rs.stats", - "local", - BSON("collStats" - << "oplog.rs"))); + std::make_unique<FTDCSimpleInternalCommandCollector>("collStats", + "local.oplog.rs.stats", + "local", + BSON("collStats" + << "oplog.rs"))); } } diff --git a/src/mongo/db/ftdc/ftdc_mongos.cpp b/src/mongo/db/ftdc/ftdc_mongos.cpp index 1a76c79bcf2..ef1cc40924a 100644 --- a/src/mongo/db/ftdc/ftdc_mongos.cpp +++ b/src/mongo/db/ftdc/ftdc_mongos.cpp @@ -86,7 +86,7 @@ public: void registerMongoSCollectors(FTDCController* controller) { // PoolStats - controller->addPeriodicCollector(stdx::make_unique<ConnPoolStatsCollector>()); + controller->addPeriodicCollector(std::make_unique<ConnPoolStatsCollector>()); } void startMongoSFTDC() { diff --git a/src/mongo/db/ftdc/ftdc_server.cpp b/src/mongo/db/ftdc/ftdc_server.cpp index 142ef262751..92c2ca4fe2a 100644 --- a/src/mongo/db/ftdc/ftdc_server.cpp +++ b/src/mongo/db/ftdc/ftdc_server.cpp @@ -34,6 +34,7 @@ #include <boost/filesystem.hpp> #include <fstream> #include <memory> +#include <memory> #include "mongo/base/status.h" #include "mongo/bson/bsonobjbuilder.h" @@ -45,7 +46,6 @@ #include "mongo/db/ftdc/ftdc_system_stats.h" #include "mongo/db/jsobj.h" #include "mongo/db/service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/util/synchronized_value.h" namespace mongo { @@ -211,7 +211,7 @@ void startFTDC(boost::filesystem::path& path, ftdcDirectoryPathParameter = path; - auto controller = stdx::make_unique<FTDCController>(path, config); + auto controller = std::make_unique<FTDCController>(path, config); // Install periodic collectors // These are collected on the period interval in FTDCConfig. @@ -225,7 +225,7 @@ void startFTDC(boost::filesystem::path& path, // migrations. // "timing" is filtered out because it triggers frequent schema changes. // TODO: do we need to enable "sharding" on MongoS? - controller->addPeriodicCollector(stdx::make_unique<FTDCSimpleInternalCommandCollector>( + controller->addPeriodicCollector(std::make_unique<FTDCSimpleInternalCommandCollector>( "serverStatus", "serverStatus", "", @@ -241,15 +241,15 @@ void startFTDC(boost::filesystem::path& path, // These are collected on each file rotation. // CmdBuildInfo - controller->addOnRotateCollector(stdx::make_unique<FTDCSimpleInternalCommandCollector>( + controller->addOnRotateCollector(std::make_unique<FTDCSimpleInternalCommandCollector>( "buildInfo", "buildInfo", "", BSON("buildInfo" << 1))); // CmdGetCmdLineOpts - controller->addOnRotateCollector(stdx::make_unique<FTDCSimpleInternalCommandCollector>( + controller->addOnRotateCollector(std::make_unique<FTDCSimpleInternalCommandCollector>( "getCmdLineOpts", "getCmdLineOpts", "", BSON("getCmdLineOpts" << 1))); // HostInfoCmd - controller->addOnRotateCollector(stdx::make_unique<FTDCSimpleInternalCommandCollector>( + controller->addOnRotateCollector(std::make_unique<FTDCSimpleInternalCommandCollector>( "hostInfo", "hostInfo", "", BSON("hostInfo" << 1))); // Install the new controller diff --git a/src/mongo/db/ftdc/ftdc_system_stats_android.cpp b/src/mongo/db/ftdc/ftdc_system_stats_android.cpp index 2abdda27e8c..10f3468c918 100644 --- a/src/mongo/db/ftdc/ftdc_system_stats_android.cpp +++ b/src/mongo/db/ftdc/ftdc_system_stats_android.cpp @@ -31,6 +31,7 @@ #include "mongo/db/ftdc/ftdc_system_stats.h" +#include <memory> #include <string> #include <vector> @@ -39,7 +40,6 @@ #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/ftdc/collector.h" #include "mongo/db/ftdc/controller.h" -#include "mongo/stdx/memory.h" #include "mongo/util/processinfo.h" #include "mongo/util/procparser.h" @@ -122,7 +122,7 @@ private: } // namespace void installSystemMetricsCollector(FTDCController* controller) { - controller->addPeriodicCollector(stdx::make_unique<LinuxSystemMetricsCollector>()); + controller->addPeriodicCollector(std::make_unique<LinuxSystemMetricsCollector>()); } } // namespace mongo diff --git a/src/mongo/db/ftdc/ftdc_system_stats_linux.cpp b/src/mongo/db/ftdc/ftdc_system_stats_linux.cpp index e68dcff300c..e9334987795 100644 --- a/src/mongo/db/ftdc/ftdc_system_stats_linux.cpp +++ b/src/mongo/db/ftdc/ftdc_system_stats_linux.cpp @@ -31,6 +31,7 @@ #include "mongo/db/ftdc/ftdc_system_stats.h" +#include <memory> #include <string> #include <vector> @@ -39,7 +40,6 @@ #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/ftdc/collector.h" #include "mongo/db/ftdc/controller.h" -#include "mongo/stdx/memory.h" #include "mongo/util/processinfo.h" #include "mongo/util/procparser.h" @@ -137,7 +137,7 @@ private: } // namespace void installSystemMetricsCollector(FTDCController* controller) { - controller->addPeriodicCollector(stdx::make_unique<LinuxSystemMetricsCollector>()); + controller->addPeriodicCollector(std::make_unique<LinuxSystemMetricsCollector>()); } } // namespace mongo diff --git a/src/mongo/db/ftdc/ftdc_system_stats_windows.cpp b/src/mongo/db/ftdc/ftdc_system_stats_windows.cpp index 3f1276afc5d..92045f16e4d 100644 --- a/src/mongo/db/ftdc/ftdc_system_stats_windows.cpp +++ b/src/mongo/db/ftdc/ftdc_system_stats_windows.cpp @@ -33,6 +33,7 @@ #include "mongo/db/ftdc/ftdc_system_stats.h" +#include <memory> #include <string> #include <vector> @@ -41,7 +42,6 @@ #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/ftdc/collector.h" #include "mongo/db/ftdc/controller.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/perfctr_collect.h" @@ -150,7 +150,7 @@ void installSystemMetricsCollector(FTDCController* controller) { } controller->addPeriodicCollector( - stdx::make_unique<WindowsSystemMetricsCollector>(std::move(swCollector.getValue()))); + std::make_unique<WindowsSystemMetricsCollector>(std::move(swCollector.getValue()))); } } // namespace mongo diff --git a/src/mongo/db/ftdc/ftdc_test.cpp b/src/mongo/db/ftdc/ftdc_test.cpp index 5e50471d20f..43ce53e9c67 100644 --- a/src/mongo/db/ftdc/ftdc_test.cpp +++ b/src/mongo/db/ftdc/ftdc_test.cpp @@ -32,6 +32,7 @@ #include "mongo/db/ftdc/ftdc_test.h" #include <boost/filesystem.hpp> +#include <memory> #include "mongo/base/data_type_validated.h" #include "mongo/base/init.h" @@ -40,7 +41,6 @@ #include "mongo/db/ftdc/file_reader.h" #include "mongo/db/jsobj.h" #include "mongo/db/service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/clock_source.h" #include "mongo/util/clock_source_mock.h" @@ -141,9 +141,9 @@ void createDirectoryClean(const boost::filesystem::path& dir) { FTDCTest::FTDCTest() { auto service = getServiceContext(); - service->setFastClockSource(stdx::make_unique<ClockSourceMock>()); - service->setPreciseClockSource(stdx::make_unique<ClockSourceMock>()); - service->setTickSource(stdx::make_unique<TickSourceMock<>>()); + service->setFastClockSource(std::make_unique<ClockSourceMock>()); + service->setPreciseClockSource(std::make_unique<ClockSourceMock>()); + service->setTickSource(std::make_unique<TickSourceMock<>>()); } } // namespace mongo diff --git a/src/mongo/db/fts/fts_basic_tokenizer.cpp b/src/mongo/db/fts/fts_basic_tokenizer.cpp index a7dab749790..25b8c0afad1 100644 --- a/src/mongo/db/fts/fts_basic_tokenizer.cpp +++ b/src/mongo/db/fts/fts_basic_tokenizer.cpp @@ -31,12 +31,13 @@ #include "mongo/db/fts/fts_basic_tokenizer.h" +#include <memory> + #include "mongo/db/fts/fts_query_impl.h" #include "mongo/db/fts/fts_spec.h" #include "mongo/db/fts/stemmer.h" #include "mongo/db/fts/stop_words.h" #include "mongo/db/fts/tokenizer.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { @@ -50,7 +51,7 @@ BasicFTSTokenizer::BasicFTSTokenizer(const FTSLanguage* language) void BasicFTSTokenizer::reset(StringData document, Options options) { _options = options; _document = document.toString(); - _tokenizer = stdx::make_unique<Tokenizer>(_language, _document); + _tokenizer = std::make_unique<Tokenizer>(_language, _document); } bool BasicFTSTokenizer::moveNext() { diff --git a/src/mongo/db/fts/fts_language.cpp b/src/mongo/db/fts/fts_language.cpp index faa54e79333..7d1fdd160de 100644 --- a/src/mongo/db/fts/fts_language.cpp +++ b/src/mongo/db/fts/fts_language.cpp @@ -29,6 +29,7 @@ #include "mongo/db/fts/fts_language.h" +#include <memory> #include <string> #include "mongo/base/init.h" @@ -36,7 +37,6 @@ #include "mongo/db/fts/fts_basic_tokenizer.h" #include "mongo/db/fts/fts_unicode_phrase_matcher.h" #include "mongo/db/fts/fts_unicode_tokenizer.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/str.h" #include "mongo/util/string_map.h" @@ -298,7 +298,7 @@ StatusWithFTSLanguage FTSLanguage::make(StringData langName, TextIndexVersion te } std::unique_ptr<FTSTokenizer> BasicFTSLanguage::createTokenizer() const { - return stdx::make_unique<BasicFTSTokenizer>(this); + return std::make_unique<BasicFTSTokenizer>(this); } const FTSPhraseMatcher& BasicFTSLanguage::getPhraseMatcher() const { @@ -306,7 +306,7 @@ const FTSPhraseMatcher& BasicFTSLanguage::getPhraseMatcher() const { } std::unique_ptr<FTSTokenizer> UnicodeFTSLanguage::createTokenizer() const { - return stdx::make_unique<UnicodeFTSTokenizer>(this); + return std::make_unique<UnicodeFTSTokenizer>(this); } const FTSPhraseMatcher& UnicodeFTSLanguage::getPhraseMatcher() const { diff --git a/src/mongo/db/fts/fts_query_impl.cpp b/src/mongo/db/fts/fts_query_impl.cpp index fffc4362fbb..c9f7e151b9d 100644 --- a/src/mongo/db/fts/fts_query_impl.cpp +++ b/src/mongo/db/fts/fts_query_impl.cpp @@ -31,10 +31,11 @@ #include "mongo/db/fts/fts_query_impl.h" +#include <memory> + #include "mongo/db/fts/fts_query_parser.h" #include "mongo/db/fts/fts_spec.h" #include "mongo/db/fts/fts_tokenizer.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { @@ -136,7 +137,7 @@ Status FTSQueryImpl::parse(TextIndexVersion textIndexVersion) { } std::unique_ptr<FTSQuery> FTSQueryImpl::clone() const { - auto clonedQuery = stdx::make_unique<FTSQueryImpl>(); + auto clonedQuery = std::make_unique<FTSQueryImpl>(); clonedQuery->setQuery(getQuery()); clonedQuery->setLanguage(getLanguage()); clonedQuery->setCaseSensitive(getCaseSensitive()); diff --git a/src/mongo/db/fts/fts_query_noop.cpp b/src/mongo/db/fts/fts_query_noop.cpp index aa32a10d011..c11fdecdab0 100644 --- a/src/mongo/db/fts/fts_query_noop.cpp +++ b/src/mongo/db/fts/fts_query_noop.cpp @@ -31,13 +31,14 @@ #include "mongo/db/fts/fts_query_noop.h" -#include "mongo/stdx/memory.h" +#include <memory> + namespace mongo { namespace fts { std::unique_ptr<FTSQuery> FTSQueryNoop::clone() const { - auto clonedQuery = stdx::make_unique<FTSQueryNoop>(); + auto clonedQuery = std::make_unique<FTSQueryNoop>(); clonedQuery->setQuery(getQuery()); clonedQuery->setLanguage(getLanguage()); clonedQuery->setCaseSensitive(getCaseSensitive()); diff --git a/src/mongo/db/fts/fts_unicode_tokenizer.cpp b/src/mongo/db/fts/fts_unicode_tokenizer.cpp index ab27d3a5c6a..5254e063c83 100644 --- a/src/mongo/db/fts/fts_unicode_tokenizer.cpp +++ b/src/mongo/db/fts/fts_unicode_tokenizer.cpp @@ -31,12 +31,13 @@ #include "mongo/db/fts/fts_unicode_tokenizer.h" +#include <memory> + #include "mongo/db/fts/fts_query_impl.h" #include "mongo/db/fts/fts_spec.h" #include "mongo/db/fts/stemmer.h" #include "mongo/db/fts/stop_words.h" #include "mongo/db/fts/tokenizer.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { diff --git a/src/mongo/db/geo/big_polygon.cpp b/src/mongo/db/geo/big_polygon.cpp index f0f77ab51ed..4f76faac823 100644 --- a/src/mongo/db/geo/big_polygon.cpp +++ b/src/mongo/db/geo/big_polygon.cpp @@ -30,9 +30,9 @@ #include "mongo/db/geo/big_polygon.h" #include <map> +#include <memory> #include "mongo/base/owned_pointer_vector.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/transitional_tools_do_not_use/vector_spooling.h" @@ -172,7 +172,7 @@ const S2Polygon& BigSimplePolygon::GetPolygonBorder() const { std::vector<S2Loop*> loops; loops.push_back(cloned.release()); - _borderPoly = stdx::make_unique<S2Polygon>(&loops); + _borderPoly = std::make_unique<S2Polygon>(&loops); return *_borderPoly; } diff --git a/src/mongo/db/geo/geoparser.cpp b/src/mongo/db/geo/geoparser.cpp index db9e68a0c25..3db8485eb6e 100644 --- a/src/mongo/db/geo/geoparser.cpp +++ b/src/mongo/db/geo/geoparser.cpp @@ -39,7 +39,6 @@ #include "mongo/db/bson/dotted_path_support.h" #include "mongo/db/geo/shapes.h" #include "mongo/db/jsobj.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/str.h" #include "mongo/util/transitional_tools_do_not_use/vector_spooling.h" @@ -210,7 +209,7 @@ static Status parseGeoJSONPolygonCoordinates(const BSONElement& elem, "Loop must have at least 3 different vertices: " << coordinateElt.toString(false)); } - loops.push_back(stdx::make_unique<S2Loop>(points)); + loops.push_back(std::make_unique<S2Loop>(points)); S2Loop* loop = loops.back().get(); // Check whether this loop is valid. diff --git a/src/mongo/db/index/btree_key_generator.cpp b/src/mongo/db/index/btree_key_generator.cpp index a86843f80c6..f1c860f4cfc 100644 --- a/src/mongo/db/index/btree_key_generator.cpp +++ b/src/mongo/db/index/btree_key_generator.cpp @@ -30,13 +30,13 @@ #include "mongo/db/index/btree_key_generator.h" #include <boost/optional.hpp> +#include <memory> #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/bson/dotted_path_support.h" #include "mongo/db/field_ref.h" #include "mongo/db/query/collation/collation_index_key.h" #include "mongo/db/query/collation/collator_interface.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/str.h" diff --git a/src/mongo/db/index/sort_key_generator.cpp b/src/mongo/db/index/sort_key_generator.cpp index 7f9bd3dd018..768e2258e2e 100644 --- a/src/mongo/db/index/sort_key_generator.cpp +++ b/src/mongo/db/index/sort_key_generator.cpp @@ -79,7 +79,7 @@ SortKeyGenerator::SortKeyGenerator(const BSONObj& sortSpec, const CollatorInterf } constexpr bool isSparse = false; - _indexKeyGen = stdx::make_unique<BtreeKeyGenerator>(fieldNames, fixed, isSparse, _collator); + _indexKeyGen = std::make_unique<BtreeKeyGenerator>(fieldNames, fixed, isSparse, _collator); } StatusWith<BSONObj> SortKeyGenerator::getSortKey(const BSONObj& obj, diff --git a/src/mongo/db/index/sort_key_generator_test.cpp b/src/mongo/db/index/sort_key_generator_test.cpp index 1ec25d713a8..b129d99ad64 100644 --- a/src/mongo/db/index/sort_key_generator_test.cpp +++ b/src/mongo/db/index/sort_key_generator_test.cpp @@ -29,10 +29,11 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/bson/json.h" #include "mongo/db/index/sort_key_generator.h" #include "mongo/db/query/collation/collator_interface_mock.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" @@ -40,21 +41,21 @@ namespace mongo { namespace { TEST(SortKeyGeneratorTest, ExtractNumberKeyForNonCompoundSortNonNested) { - auto sortKeyGen = stdx::make_unique<SortKeyGenerator>(BSON("a" << 1), nullptr); + auto sortKeyGen = std::make_unique<SortKeyGenerator>(BSON("a" << 1), nullptr); auto sortKey = sortKeyGen->getSortKey(fromjson("{_id: 0, a: 5}"), nullptr); ASSERT_OK(sortKey.getStatus()); ASSERT_BSONOBJ_EQ(sortKey.getValue(), BSON("" << 5)); } TEST(SortKeyGeneratorTest, ExtractNumberKeyFromDocWithSeveralFields) { - auto sortKeyGen = stdx::make_unique<SortKeyGenerator>(BSON("a" << 1), nullptr); + auto sortKeyGen = std::make_unique<SortKeyGenerator>(BSON("a" << 1), nullptr); auto sortKey = sortKeyGen->getSortKey(fromjson("{_id: 0, z: 10, a: 6, b: 16}"), nullptr); ASSERT_OK(sortKey.getStatus()); ASSERT_BSONOBJ_EQ(sortKey.getValue(), BSON("" << 6)); } TEST(SortKeyGeneratorTest, ExtractStringKeyNonCompoundNonNested) { - auto sortKeyGen = stdx::make_unique<SortKeyGenerator>(BSON("a" << 1), nullptr); + auto sortKeyGen = std::make_unique<SortKeyGenerator>(BSON("a" << 1), nullptr); auto sortKey = sortKeyGen->getSortKey(fromjson("{_id: 0, z: 'thing1', a: 'thing2', b: 16}"), nullptr); ASSERT_OK(sortKey.getStatus()); @@ -64,7 +65,7 @@ TEST(SortKeyGeneratorTest, ExtractStringKeyNonCompoundNonNested) { } TEST(SortKeyGeneratorTest, CompoundSortPattern) { - auto sortKeyGen = stdx::make_unique<SortKeyGenerator>(BSON("a" << 1 << "b" << 1), nullptr); + auto sortKeyGen = std::make_unique<SortKeyGenerator>(BSON("a" << 1 << "b" << 1), nullptr); auto sortKey = sortKeyGen->getSortKey(fromjson("{_id: 0, z: 'thing1', a: 99, c: {a: 4}, b: 16}"), nullptr); ASSERT_OK(sortKey.getStatus()); @@ -72,7 +73,7 @@ TEST(SortKeyGeneratorTest, CompoundSortPattern) { } TEST(SortKeyGeneratorTest, CompoundSortPatternWithDottedPath) { - auto sortKeyGen = stdx::make_unique<SortKeyGenerator>(BSON("c.a" << 1 << "b" << 1), nullptr); + auto sortKeyGen = std::make_unique<SortKeyGenerator>(BSON("c.a" << 1 << "b" << 1), nullptr); auto sortKey = sortKeyGen->getSortKey(fromjson("{_id: 0, z: 'thing1', a: 99, c: {a: 4}, b: 16}"), nullptr); ASSERT_OK(sortKey.getStatus()); @@ -80,7 +81,7 @@ TEST(SortKeyGeneratorTest, CompoundSortPatternWithDottedPath) { } TEST(SortKeyGeneratorTest, CompoundPatternLeadingFieldIsArray) { - auto sortKeyGen = stdx::make_unique<SortKeyGenerator>(BSON("c" << 1 << "b" << 1), nullptr); + auto sortKeyGen = std::make_unique<SortKeyGenerator>(BSON("c" << 1 << "b" << 1), nullptr); auto sortKey = sortKeyGen->getSortKey( fromjson("{_id: 0, z: 'thing1', a: 99, c: [2, 4, 1], b: 16}"), nullptr); ASSERT_OK(sortKey.getStatus()); @@ -89,7 +90,7 @@ TEST(SortKeyGeneratorTest, CompoundPatternLeadingFieldIsArray) { TEST(SortKeyGeneratorTest, ExtractStringSortKeyWithCollatorUsesComparisonKey) { CollatorInterfaceMock collator(CollatorInterfaceMock::MockType::kReverseString); - auto sortKeyGen = stdx::make_unique<SortKeyGenerator>(BSON("a" << 1), &collator); + auto sortKeyGen = std::make_unique<SortKeyGenerator>(BSON("a" << 1), &collator); auto sortKey = sortKeyGen->getSortKey(fromjson("{_id: 0, z: 'thing1', a: 'thing2', b: 16}"), nullptr); ASSERT_OK(sortKey.getStatus()); @@ -100,14 +101,14 @@ TEST(SortKeyGeneratorTest, ExtractStringSortKeyWithCollatorUsesComparisonKey) { TEST(SortKeyGeneratorTest, CollatorHasNoEffectWhenExtractingNonStringSortKey) { CollatorInterfaceMock collator(CollatorInterfaceMock::MockType::kReverseString); - auto sortKeyGen = stdx::make_unique<SortKeyGenerator>(BSON("a" << 1), &collator); + auto sortKeyGen = std::make_unique<SortKeyGenerator>(BSON("a" << 1), &collator); auto sortKey = sortKeyGen->getSortKey(fromjson("{_id: 0, z: 10, a: 6, b: 16}"), nullptr); ASSERT_OK(sortKey.getStatus()); ASSERT_BSONOBJ_EQ(sortKey.getValue(), BSON("" << 6)); } TEST(SortKeyGeneratorTest, SortKeyGenerationForArraysChoosesCorrectKey) { - auto sortKeyGen = stdx::make_unique<SortKeyGenerator>(BSON("a" << -1), nullptr); + auto sortKeyGen = std::make_unique<SortKeyGenerator>(BSON("a" << -1), nullptr); auto sortKey = sortKeyGen->getSortKey(fromjson("{_id: 0, a: [1, 2, 3, 4]}"), nullptr); ASSERT_OK(sortKey.getStatus()); ASSERT_BSONOBJ_EQ(sortKey.getValue(), BSON("" << 4)); @@ -115,7 +116,7 @@ TEST(SortKeyGeneratorTest, SortKeyGenerationForArraysChoosesCorrectKey) { TEST(SortKeyGeneratorTest, EnsureSortKeyGenerationForArraysRespectsCollation) { CollatorInterfaceMock collator(CollatorInterfaceMock::MockType::kReverseString); - auto sortKeyGen = stdx::make_unique<SortKeyGenerator>(BSON("a" << 1), &collator); + auto sortKeyGen = std::make_unique<SortKeyGenerator>(BSON("a" << 1), &collator); auto sortKey = sortKeyGen->getSortKey(fromjson("{_id: 0, a: ['aaz', 'zza', 'yya', 'zzb']}"), nullptr); ASSERT_OK(sortKey.getStatus()); @@ -125,7 +126,7 @@ TEST(SortKeyGeneratorTest, EnsureSortKeyGenerationForArraysRespectsCollation) { } TEST(SortKeyGeneratorTest, SortKeyGenerationForArraysRespectsCompoundOrdering) { - auto sortKeyGen = stdx::make_unique<SortKeyGenerator>(BSON("a.b" << 1 << "a.c" << -1), nullptr); + auto sortKeyGen = std::make_unique<SortKeyGenerator>(BSON("a.b" << 1 << "a.c" << -1), nullptr); auto sortKey = sortKeyGen->getSortKey( fromjson("{_id: 0, a: [{b: 1, c: 0}, {b: 0, c: 3}, {b: 0, c: 1}]}"), nullptr); ASSERT_OK(sortKey.getStatus()); @@ -135,63 +136,62 @@ TEST(SortKeyGeneratorTest, SortKeyGenerationForArraysRespectsCompoundOrdering) { DEATH_TEST(SortKeyGeneratorTest, SortPatternComponentWithStringIsFatal, "Invariant failure elt.type() == BSONType::Object") { - MONGO_COMPILER_VARIABLE_UNUSED auto ignored = - stdx::make_unique<SortKeyGenerator>(BSON("a" - << "foo"), - nullptr); + MONGO_COMPILER_VARIABLE_UNUSED auto ignored = std::make_unique<SortKeyGenerator>(BSON("a" + << "foo"), + nullptr); } DEATH_TEST(SortKeyGeneratorTest, SortPatternComponentWhoseObjectHasMultipleKeysIsFatal, "Invariant failure elt.embeddedObject().nFields() == 1") { MONGO_COMPILER_VARIABLE_UNUSED auto ignored = - stdx::make_unique<SortKeyGenerator>(BSON("a" << BSON("$meta" - << "textScore" - << "extra" - << 1)), - nullptr); + std::make_unique<SortKeyGenerator>(BSON("a" << BSON("$meta" + << "textScore" + << "extra" + << 1)), + nullptr); } DEATH_TEST(SortKeyGeneratorTest, SortPatternComponentWithNonMetaObjectSortIsFatal, "Invariant failure metaElem.fieldNameStringData() == \"$meta\"_sd") { MONGO_COMPILER_VARIABLE_UNUSED auto ignored = - stdx::make_unique<SortKeyGenerator>(BSON("a" << BSON("$unknown" - << "textScore")), - nullptr); + std::make_unique<SortKeyGenerator>(BSON("a" << BSON("$unknown" + << "textScore")), + nullptr); } DEATH_TEST(SortKeyGeneratorTest, SortPatternComponentWithUnknownMetaKeywordIsFatal, "Invariant failure metaElem.valueStringData() == \"randVal\"_sd") { MONGO_COMPILER_VARIABLE_UNUSED auto ignored = - stdx::make_unique<SortKeyGenerator>(BSON("a" << BSON("$meta" - << "unknown")), - nullptr); + std::make_unique<SortKeyGenerator>(BSON("a" << BSON("$meta" + << "unknown")), + nullptr); } DEATH_TEST(SortKeyGeneratorTest, NoMetadataWhenPatternHasMetaTextScoreIsFatal, "Invariant failure metadata") { - auto sortKeyGen = stdx::make_unique<SortKeyGenerator>(BSON("a" << BSON("$meta" - << "textScore")), - nullptr); + auto sortKeyGen = std::make_unique<SortKeyGenerator>(BSON("a" << BSON("$meta" + << "textScore")), + nullptr); uassertStatusOK(sortKeyGen->getSortKey(BSONObj{}, nullptr).getStatus()); } DEATH_TEST(SortKeyGeneratorTest, NoMetadataWhenPatternHasMetaRandValIsFatal, "Invariant failure metadata") { - auto sortKeyGen = stdx::make_unique<SortKeyGenerator>(BSON("a" << BSON("$meta" - << "randVal")), - nullptr); + auto sortKeyGen = std::make_unique<SortKeyGenerator>(BSON("a" << BSON("$meta" + << "randVal")), + nullptr); uassertStatusOK(sortKeyGen->getSortKey(BSONObj{}, nullptr).getStatus()); } TEST(SortKeyGeneratorTest, CanGenerateKeysForTextScoreMetaSort) { - auto sortKeyGen = stdx::make_unique<SortKeyGenerator>(BSON("a" << BSON("$meta" - << "textScore")), - nullptr); + auto sortKeyGen = std::make_unique<SortKeyGenerator>(BSON("a" << BSON("$meta" + << "textScore")), + nullptr); SortKeyGenerator::Metadata metadata; metadata.textScore = 1.5; auto sortKey = sortKeyGen->getSortKey(BSONObj{}, &metadata); @@ -200,9 +200,9 @@ TEST(SortKeyGeneratorTest, CanGenerateKeysForTextScoreMetaSort) { } TEST(SortKeyGeneratorTest, CanGenerateKeysForRandValMetaSort) { - auto sortKeyGen = stdx::make_unique<SortKeyGenerator>(BSON("a" << BSON("$meta" - << "randVal")), - nullptr); + auto sortKeyGen = std::make_unique<SortKeyGenerator>(BSON("a" << BSON("$meta" + << "randVal")), + nullptr); SortKeyGenerator::Metadata metadata; metadata.randVal = 0.3; auto sortKey = sortKeyGen->getSortKey(BSONObj{}, &metadata); @@ -213,7 +213,7 @@ TEST(SortKeyGeneratorTest, CanGenerateKeysForRandValMetaSort) { TEST(SortKeyGeneratorTest, CanGenerateKeysForCompoundMetaSort) { BSONObj pattern = fromjson( "{a: 1, b: {$meta: 'randVal'}, c: {$meta: 'textScore'}, d: -1, e: {$meta: 'textScore'}}"); - auto sortKeyGen = stdx::make_unique<SortKeyGenerator>(pattern, nullptr); + auto sortKeyGen = std::make_unique<SortKeyGenerator>(pattern, nullptr); SortKeyGenerator::Metadata metadata; metadata.randVal = 0.3; metadata.textScore = 1.5; diff --git a/src/mongo/db/key_generator_update_test.cpp b/src/mongo/db/key_generator_update_test.cpp index b9cafda3856..bcfc2942bdd 100644 --- a/src/mongo/db/key_generator_update_test.cpp +++ b/src/mongo/db/key_generator_update_test.cpp @@ -29,6 +29,7 @@ #include "mongo/platform/basic.h" +#include <memory> #include <set> #include <string> @@ -39,7 +40,6 @@ #include "mongo/db/logical_clock.h" #include "mongo/s/catalog/dist_lock_manager_mock.h" #include "mongo/s/config_server_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/clock_source_mock.h" #include "mongo/util/fail_point_service.h" @@ -52,9 +52,9 @@ protected: void setUp() override { ConfigServerTestFixture::setUp(); - auto clockSource = stdx::make_unique<ClockSourceMock>(); + auto clockSource = std::make_unique<ClockSourceMock>(); operationContext()->getServiceContext()->setFastClockSource(std::move(clockSource)); - _catalogClient = stdx::make_unique<KeysCollectionClientSharded>( + _catalogClient = std::make_unique<KeysCollectionClientSharded>( Grid::get(operationContext())->catalogClient()); } @@ -68,7 +68,7 @@ protected: */ std::unique_ptr<DistLockManager> makeDistLockManager( std::unique_ptr<DistLockCatalog> distLockCatalog) override { - return stdx::make_unique<DistLockManagerMock>(std::move(distLockCatalog)); + return std::make_unique<DistLockManagerMock>(std::move(distLockCatalog)); } private: diff --git a/src/mongo/db/keys_collection_cache_test.cpp b/src/mongo/db/keys_collection_cache_test.cpp index 223aa2603a4..7f62ca90892 100644 --- a/src/mongo/db/keys_collection_cache_test.cpp +++ b/src/mongo/db/keys_collection_cache_test.cpp @@ -48,7 +48,7 @@ protected: void setUp() override { ConfigServerTestFixture::setUp(); - _catalogClient = stdx::make_unique<KeysCollectionClientSharded>( + _catalogClient = std::make_unique<KeysCollectionClientSharded>( Grid::get(operationContext())->catalogClient()); } diff --git a/src/mongo/db/keys_collection_manager.cpp b/src/mongo/db/keys_collection_manager.cpp index df82ebe71a0..a771a9150ad 100644 --- a/src/mongo/db/keys_collection_manager.cpp +++ b/src/mongo/db/keys_collection_manager.cpp @@ -32,6 +32,8 @@ #include "mongo/db/keys_collection_manager.h" +#include <memory> + #include "mongo/db/key_generator.h" #include "mongo/db/keys_collection_cache.h" #include "mongo/db/keys_collection_client.h" @@ -39,7 +41,6 @@ #include "mongo/db/logical_time.h" #include "mongo/db/operation_context.h" #include "mongo/db/service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/util/concurrency/idle_thread_block.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/log.h" diff --git a/src/mongo/db/keys_collection_manager_sharding_test.cpp b/src/mongo/db/keys_collection_manager_sharding_test.cpp index f495d33e92a..d7d96d15d14 100644 --- a/src/mongo/db/keys_collection_manager_sharding_test.cpp +++ b/src/mongo/db/keys_collection_manager_sharding_test.cpp @@ -29,6 +29,7 @@ #include "mongo/platform/basic.h" +#include <memory> #include <set> #include <string> @@ -39,7 +40,6 @@ #include "mongo/db/logical_clock.h" #include "mongo/s/catalog/dist_lock_manager_mock.h" #include "mongo/s/config_server_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/clock_source_mock.h" #include "mongo/util/fail_point_service.h" @@ -57,16 +57,16 @@ protected: void setUp() override { ConfigServerTestFixture::setUp(); - auto clockSource = stdx::make_unique<ClockSourceMock>(); + auto clockSource = std::make_unique<ClockSourceMock>(); // Timestamps of "0 seconds" are not allowed, so we must advance our clock mock to the first // real second. clockSource->advance(Seconds(1)); operationContext()->getServiceContext()->setFastClockSource(std::move(clockSource)); - auto catalogClient = stdx::make_unique<KeysCollectionClientSharded>( + auto catalogClient = std::make_unique<KeysCollectionClientSharded>( Grid::get(operationContext())->catalogClient()); _keyManager = - stdx::make_unique<KeysCollectionManager>("dummy", std::move(catalogClient), Seconds(1)); + std::make_unique<KeysCollectionManager>("dummy", std::move(catalogClient), Seconds(1)); } void tearDown() override { @@ -81,7 +81,7 @@ protected: */ std::unique_ptr<DistLockManager> makeDistLockManager( std::unique_ptr<DistLockCatalog> distLockCatalog) override { - return stdx::make_unique<DistLockManagerMock>(std::move(distLockCatalog)); + return std::make_unique<DistLockManagerMock>(std::move(distLockCatalog)); } private: diff --git a/src/mongo/db/logical_clock_test.cpp b/src/mongo/db/logical_clock_test.cpp index 10f3afa7be5..e6315e33d48 100644 --- a/src/mongo/db/logical_clock_test.cpp +++ b/src/mongo/db/logical_clock_test.cpp @@ -31,6 +31,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/bson/bsonobj.h" #include "mongo/bson/timestamp.h" #include "mongo/db/dbdirectclient.h" @@ -39,7 +41,6 @@ #include "mongo/db/logical_clock_test_fixture.h" #include "mongo/db/logical_time.h" #include "mongo/db/repl/replication_coordinator_mock.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/clock_source_mock.h" #include "mongo/util/log.h" diff --git a/src/mongo/db/logical_clock_test_fixture.cpp b/src/mongo/db/logical_clock_test_fixture.cpp index 9ae03d3aeb8..342f2679522 100644 --- a/src/mongo/db/logical_clock_test_fixture.cpp +++ b/src/mongo/db/logical_clock_test_fixture.cpp @@ -31,6 +31,8 @@ #include "mongo/db/logical_clock_test_fixture.h" +#include <memory> + #include "mongo/db/dbdirectclient.h" #include "mongo/db/logical_clock.h" #include "mongo/db/logical_time.h" @@ -38,7 +40,6 @@ #include "mongo/db/service_context.h" #include "mongo/db/signed_logical_time.h" #include "mongo/db/time_proof_service.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/clock_source_mock.h" @@ -53,14 +54,14 @@ void LogicalClockTestFixture::setUp() { auto service = getServiceContext(); - auto logicalClock = stdx::make_unique<LogicalClock>(service); + auto logicalClock = std::make_unique<LogicalClock>(service); LogicalClock::set(service, std::move(logicalClock)); _clock = LogicalClock::get(service); - service->setFastClockSource(stdx::make_unique<SharedClockSourceAdapter>(_mockClockSource)); - service->setPreciseClockSource(stdx::make_unique<SharedClockSourceAdapter>(_mockClockSource)); + service->setFastClockSource(std::make_unique<SharedClockSourceAdapter>(_mockClockSource)); + service->setPreciseClockSource(std::make_unique<SharedClockSourceAdapter>(_mockClockSource)); - _dbDirectClient = stdx::make_unique<DBDirectClient>(operationContext()); + _dbDirectClient = std::make_unique<DBDirectClient>(operationContext()); ASSERT_OK(replicationCoordinator()->setFollowerMode(repl::MemberState::RS_PRIMARY)); } @@ -72,7 +73,7 @@ void LogicalClockTestFixture::tearDown() { LogicalClock* LogicalClockTestFixture::resetClock() { auto service = getServiceContext(); - auto logicalClock = stdx::make_unique<LogicalClock>(service); + auto logicalClock = std::make_unique<LogicalClock>(service); LogicalClock::set(service, std::move(logicalClock)); _clock = LogicalClock::get(service); diff --git a/src/mongo/db/logical_session_cache_factory_mongod.cpp b/src/mongo/db/logical_session_cache_factory_mongod.cpp index b54b3119b03..dc276ddfa33 100644 --- a/src/mongo/db/logical_session_cache_factory_mongod.cpp +++ b/src/mongo/db/logical_session_cache_factory_mongod.cpp @@ -33,6 +33,8 @@ #include "mongo/db/logical_session_cache_factory_mongod.h" +#include <memory> + #include "mongo/db/logical_session_cache_impl.h" #include "mongo/db/service_liaison_mongod.h" #include "mongo/db/session_catalog_mongod.h" @@ -40,7 +42,6 @@ #include "mongo/db/sessions_collection_rs.h" #include "mongo/db/sessions_collection_sharded.h" #include "mongo/db/sessions_collection_standalone.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" namespace mongo { diff --git a/src/mongo/db/logical_session_cache_test.cpp b/src/mongo/db/logical_session_cache_test.cpp index d0f41415e8c..ec615a6490c 100644 --- a/src/mongo/db/logical_session_cache_test.cpp +++ b/src/mongo/db/logical_session_cache_test.cpp @@ -31,6 +31,8 @@ #include "mongo/db/logical_session_cache_impl.h" +#include <memory> + #include "mongo/bson/oid.h" #include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/authorization_session_for_test.h" @@ -46,7 +48,6 @@ #include "mongo/db/service_liaison_mock.h" #include "mongo/db/sessions_collection_mock.h" #include "mongo/stdx/future.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/ensure_fcv.h" #include "mongo/unittest/unittest.h" @@ -76,9 +77,9 @@ public: Client::releaseCurrent(); Client::initThread(getThreadName()); _opCtx = makeOperationContext(); - auto mockService = stdx::make_unique<MockServiceLiaison>(_service); - auto mockSessions = stdx::make_unique<MockSessionsCollection>(_sessions); - _cache = stdx::make_unique<LogicalSessionCacheImpl>( + auto mockService = std::make_unique<MockServiceLiaison>(_service); + auto mockSessions = std::make_unique<MockSessionsCollection>(_sessions); + _cache = std::make_unique<LogicalSessionCacheImpl>( std::move(mockService), std::move(mockSessions), [](OperationContext*, SessionsCollection&, Date_t) { diff --git a/src/mongo/db/logical_session_id_test.cpp b/src/mongo/db/logical_session_id_test.cpp index 160e718201d..fac7ab0c5c5 100644 --- a/src/mongo/db/logical_session_id_test.cpp +++ b/src/mongo/db/logical_session_id_test.cpp @@ -88,7 +88,7 @@ public: auto localServiceLiaison = std::make_unique<MockServiceLiaison>(std::make_shared<MockServiceLiaisonImpl>()); - auto localSessionsCollection = stdx::make_unique<MockSessionsCollection>( + auto localSessionsCollection = std::make_unique<MockSessionsCollection>( std::make_shared<MockSessionsCollectionImpl>()); auto localLogicalSessionCache = std::make_unique<LogicalSessionCacheImpl>( diff --git a/src/mongo/db/logical_time_metadata_hook.cpp b/src/mongo/db/logical_time_metadata_hook.cpp index 349d5b735fa..36fda90c1ce 100644 --- a/src/mongo/db/logical_time_metadata_hook.cpp +++ b/src/mongo/db/logical_time_metadata_hook.cpp @@ -31,11 +31,12 @@ #include "mongo/db/logical_time_metadata_hook.h" +#include <memory> + #include "mongo/db/logical_clock.h" #include "mongo/db/logical_time_validator.h" #include "mongo/db/operation_time_tracker.h" #include "mongo/rpc/metadata/logical_time_metadata.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/db/logical_time_metadata_hook.h b/src/mongo/db/logical_time_metadata_hook.h index 4fd0c2436ef..918837544b8 100644 --- a/src/mongo/db/logical_time_metadata_hook.h +++ b/src/mongo/db/logical_time_metadata_hook.h @@ -29,10 +29,10 @@ #pragma once +#include <memory> #include <vector> #include "mongo/rpc/metadata/metadata_hook.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/db/logical_time_validator_test.cpp b/src/mongo/db/logical_time_validator_test.cpp index 3022295b4c3..ce8fea3393e 100644 --- a/src/mongo/db/logical_time_validator_test.cpp +++ b/src/mongo/db/logical_time_validator_test.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/bson/timestamp.h" #include "mongo/db/keys_collection_client_sharded.h" #include "mongo/db/keys_collection_manager.h" @@ -40,7 +42,6 @@ #include "mongo/db/time_proof_service.h" #include "mongo/s/catalog/dist_lock_manager_mock.h" #include "mongo/s/config_server_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/clock_source_mock.h" @@ -57,9 +58,9 @@ protected: void setUp() override { ConfigServerTestFixture::setUp(); - auto clockSource = stdx::make_unique<ClockSourceMock>(); + auto clockSource = std::make_unique<ClockSourceMock>(); operationContext()->getServiceContext()->setFastClockSource(std::move(clockSource)); - auto catalogClient = stdx::make_unique<KeysCollectionClientSharded>( + auto catalogClient = std::make_unique<KeysCollectionClientSharded>( Grid::get(operationContext())->catalogClient()); const LogicalTime currentTime(LogicalTime(Timestamp(1, 0))); @@ -67,7 +68,7 @@ protected: _keyManager = std::make_shared<KeysCollectionManager>( "dummy", std::move(catalogClient), Seconds(1000)); - _validator = stdx::make_unique<LogicalTimeValidator>(_keyManager); + _validator = std::make_unique<LogicalTimeValidator>(_keyManager); _validator->init(operationContext()->getServiceContext()); } @@ -82,7 +83,7 @@ protected: */ std::unique_ptr<DistLockManager> makeDistLockManager( std::unique_ptr<DistLockCatalog> distLockCatalog) override { - return stdx::make_unique<DistLockManagerMock>(std::move(distLockCatalog)); + return std::make_unique<DistLockManagerMock>(std::move(distLockCatalog)); } /** diff --git a/src/mongo/db/matcher/copyable_match_expression.h b/src/mongo/db/matcher/copyable_match_expression.h index 01aa490e8a8..e9a9bb16346 100644 --- a/src/mongo/db/matcher/copyable_match_expression.h +++ b/src/mongo/db/matcher/copyable_match_expression.h @@ -54,7 +54,7 @@ public: CopyableMatchExpression(BSONObj matchAST, const boost::intrusive_ptr<ExpressionContext>& expCtx, std::unique_ptr<const ExtensionsCallback> extensionsCallback = - stdx::make_unique<ExtensionsCallbackNoop>(), + std::make_unique<ExtensionsCallbackNoop>(), MatchExpressionParser::AllowedFeatureSet allowedFeatures = MatchExpressionParser::kDefaultSpecialFeatures) : _matchAST(matchAST), _extensionsCallback(std::move(extensionsCallback)) { diff --git a/src/mongo/db/matcher/expression.h b/src/mongo/db/matcher/expression.h index 50a0aac4578..c01bee6c697 100644 --- a/src/mongo/db/matcher/expression.h +++ b/src/mongo/db/matcher/expression.h @@ -30,6 +30,7 @@ #pragma once #include <functional> +#include <memory> #include "mongo/base/status.h" #include "mongo/bson/bsonobj.h" @@ -37,7 +38,6 @@ #include "mongo/db/matcher/match_details.h" #include "mongo/db/matcher/matchable.h" #include "mongo/db/pipeline/dependencies.h" -#include "mongo/stdx/memory.h" #include "mongo/util/fail_point_service.h" namespace mongo { diff --git a/src/mongo/db/matcher/expression_algo.cpp b/src/mongo/db/matcher/expression_algo.cpp index 67acd98d672..bd57e96b5fe 100644 --- a/src/mongo/db/matcher/expression_algo.cpp +++ b/src/mongo/db/matcher/expression_algo.cpp @@ -250,7 +250,7 @@ unique_ptr<MatchExpression> createAndOfNodes(std::vector<unique_ptr<MatchExpress return std::move(children->at(0)); } - unique_ptr<AndMatchExpression> splitAnd = stdx::make_unique<AndMatchExpression>(); + unique_ptr<AndMatchExpression> splitAnd = std::make_unique<AndMatchExpression>(); for (auto&& expr : *children) { splitAnd->add(expr.release()); } @@ -266,7 +266,7 @@ unique_ptr<MatchExpression> createNorOfNodes(std::vector<unique_ptr<MatchExpress return nullptr; } - unique_ptr<NorMatchExpression> splitNor = stdx::make_unique<NorMatchExpression>(); + unique_ptr<NorMatchExpression> splitNor = std::make_unique<NorMatchExpression>(); for (auto&& expr : *children) { splitNor->add(expr.release()); } diff --git a/src/mongo/db/matcher/expression_always_boolean.h b/src/mongo/db/matcher/expression_always_boolean.h index d638a4b4851..6db02f58bc0 100644 --- a/src/mongo/db/matcher/expression_always_boolean.h +++ b/src/mongo/db/matcher/expression_always_boolean.h @@ -101,7 +101,7 @@ public: } std::unique_ptr<MatchExpression> shallowClone() const final { - return stdx::make_unique<AlwaysFalseMatchExpression>(); + return std::make_unique<AlwaysFalseMatchExpression>(); } bool isTriviallyFalse() const final { @@ -120,7 +120,7 @@ public: } std::unique_ptr<MatchExpression> shallowClone() const final { - return stdx::make_unique<AlwaysTrueMatchExpression>(); + return std::make_unique<AlwaysTrueMatchExpression>(); } bool isTriviallyTrue() const final { diff --git a/src/mongo/db/matcher/expression_always_boolean_test.cpp b/src/mongo/db/matcher/expression_always_boolean_test.cpp index 5f89e36c48c..e18c7be11e8 100644 --- a/src/mongo/db/matcher/expression_always_boolean_test.cpp +++ b/src/mongo/db/matcher/expression_always_boolean_test.cpp @@ -46,7 +46,7 @@ TEST(AlwaysFalseMatchExpression, RejectsAllObjects) { } TEST(AlwaysFalseMatchExpression, EquivalentReturnsCorrectResults) { - auto falseExpr = stdx::make_unique<AlwaysFalseMatchExpression>(); + auto falseExpr = std::make_unique<AlwaysFalseMatchExpression>(); ASSERT_TRUE(falseExpr->equivalent(falseExpr.get())); ASSERT_TRUE(falseExpr->equivalent(falseExpr->shallowClone().get())); @@ -65,7 +65,7 @@ TEST(AlwaysTrueMatchExpression, AcceptsAllObjects) { } TEST(AlwaysTrueMatchExpression, EquivalentReturnsCorrectResults) { - auto trueExpr = stdx::make_unique<AlwaysTrueMatchExpression>(); + auto trueExpr = std::make_unique<AlwaysTrueMatchExpression>(); ASSERT_TRUE(trueExpr->equivalent(trueExpr.get())); ASSERT_TRUE(trueExpr->equivalent(trueExpr->shallowClone().get())); diff --git a/src/mongo/db/matcher/expression_arity.h b/src/mongo/db/matcher/expression_arity.h index 9e1766197b9..2d2d93c5875 100644 --- a/src/mongo/db/matcher/expression_arity.h +++ b/src/mongo/db/matcher/expression_arity.h @@ -31,9 +31,9 @@ #include <algorithm> #include <array> +#include <memory> #include "mongo/db/matcher/expression.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -123,7 +123,7 @@ public: return orig ? orig->shallowClone() : std::unique_ptr<MatchExpression>(nullptr); }); - std::unique_ptr<T> clone = stdx::make_unique<T>(std::move(clonedExpressions)); + std::unique_ptr<T> clone = std::make_unique<T>(std::move(clonedExpressions)); if (getTag()) { clone->setTag(getTag()->clone()); diff --git a/src/mongo/db/matcher/expression_array.h b/src/mongo/db/matcher/expression_array.h index 471549f105e..dc27f2f2ef0 100644 --- a/src/mongo/db/matcher/expression_array.h +++ b/src/mongo/db/matcher/expression_array.h @@ -76,8 +76,8 @@ public: virtual std::unique_ptr<MatchExpression> shallowClone() const { std::unique_ptr<ElemMatchObjectMatchExpression> e = - stdx::make_unique<ElemMatchObjectMatchExpression>(path(), - _sub->shallowClone().release()); + std::make_unique<ElemMatchObjectMatchExpression>(path(), + _sub->shallowClone().release()); if (getTag()) { e->setTag(getTag()->clone()); } @@ -129,7 +129,7 @@ public: virtual std::unique_ptr<MatchExpression> shallowClone() const { std::unique_ptr<ElemMatchValueMatchExpression> e = - stdx::make_unique<ElemMatchValueMatchExpression>(path()); + std::make_unique<ElemMatchValueMatchExpression>(path()); for (size_t i = 0; i < _subs.size(); ++i) { e->add(_subs[i]->shallowClone().release()); } @@ -169,7 +169,7 @@ public: virtual std::unique_ptr<MatchExpression> shallowClone() const { std::unique_ptr<SizeMatchExpression> e = - stdx::make_unique<SizeMatchExpression>(path(), _size); + std::make_unique<SizeMatchExpression>(path(), _size); if (getTag()) { e->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/expression_expr.cpp b/src/mongo/db/matcher/expression_expr.cpp index de1c1f956eb..f58c1c14ef8 100644 --- a/src/mongo/db/matcher/expression_expr.cpp +++ b/src/mongo/db/matcher/expression_expr.cpp @@ -102,7 +102,7 @@ std::unique_ptr<MatchExpression> ExprMatchExpression::shallowClone() const { boost::intrusive_ptr<Expression> clonedExpr = Expression::parseOperand(_expCtx, bob.obj().firstElement(), _expCtx->variablesParseState); - auto clone = stdx::make_unique<ExprMatchExpression>(std::move(clonedExpr), _expCtx); + auto clone = std::make_unique<ExprMatchExpression>(std::move(clonedExpr), _expCtx); if (_rewriteResult) { clone->_rewriteResult = _rewriteResult->clone(); } @@ -126,7 +126,7 @@ MatchExpression::ExpressionOptimizerFunc ExprMatchExpression::getOptimizer() con RewriteExpr::rewrite(exprMatchExpr._expression, exprMatchExpr._expCtx->getCollator()); if (exprMatchExpr._rewriteResult->matchExpression()) { - auto andMatch = stdx::make_unique<AndMatchExpression>(); + auto andMatch = std::make_unique<AndMatchExpression>(); andMatch->add(exprMatchExpr._rewriteResult->releaseMatchExpression().release()); andMatch->add(expression.release()); // Re-optimize the new AND in order to make sure that any AND children are absorbed. diff --git a/src/mongo/db/matcher/expression_expr_test.cpp b/src/mongo/db/matcher/expression_expr_test.cpp index ce97e822b37..16fdd7b6485 100644 --- a/src/mongo/db/matcher/expression_expr_test.cpp +++ b/src/mongo/db/matcher/expression_expr_test.cpp @@ -547,7 +547,7 @@ TEST_F(ExprMatchTest, TEST_F(ExprMatchTest, InitialCollationUsedForComparisons) { auto collator = - stdx::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kToLowerString); + std::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kToLowerString); setCollator(collator.get()); createMatcher(fromjson("{$expr: {$eq: ['$x', 'abc']}}")); @@ -562,7 +562,7 @@ TEST_F(ExprMatchTest, SetCollatorChangesCollationUsedForComparisons) { createMatcher(fromjson("{$expr: {$eq: ['$x', 'abc']}}")); auto collator = - stdx::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kToLowerString); + std::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kToLowerString); setCollator(collator.get()); ASSERT_TRUE(matches(BSON("x" @@ -607,7 +607,7 @@ TEST(ExprMatchTest, IdenticalPostOptimizedExpressionsAreEquivalent) { // Create and optimize an ExprMatchExpression. const boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest()); std::unique_ptr<MatchExpression> matchExpr = - stdx::make_unique<ExprMatchExpression>(expression.firstElement(), expCtx); + std::make_unique<ExprMatchExpression>(expression.firstElement(), expCtx); matchExpr = MatchExpression::optimize(std::move(matchExpr)); // We expect that the optimized 'matchExpr' is still an ExprMatchExpression. @@ -636,7 +636,7 @@ TEST(ExprMatchTest, ExpressionOptimizeRewritesVariableDereferenceAsConstant) { // Create and optimize an ExprMatchExpression. std::unique_ptr<MatchExpression> matchExpr = - stdx::make_unique<ExprMatchExpression>(expression.firstElement(), expCtx); + std::make_unique<ExprMatchExpression>(expression.firstElement(), expCtx); matchExpr = MatchExpression::optimize(std::move(matchExpr)); // We expect that the optimized 'matchExpr' is still an ExprMatchExpression. @@ -656,7 +656,7 @@ TEST(ExprMatchTest, OptimizingIsANoopWhenAlreadyOptimized) { // Create and optimize an ExprMatchExpression. std::unique_ptr<MatchExpression> singlyOptimized = - stdx::make_unique<ExprMatchExpression>(expression.firstElement(), expCtx); + std::make_unique<ExprMatchExpression>(expression.firstElement(), expCtx); singlyOptimized = MatchExpression::optimize(std::move(singlyOptimized)); // We expect that the optimized 'matchExpr' is now an $and. @@ -664,7 +664,7 @@ TEST(ExprMatchTest, OptimizingIsANoopWhenAlreadyOptimized) { // We expect the twice-optimized match expression to be equivalent to the once-optimized one. std::unique_ptr<MatchExpression> doublyOptimized = - stdx::make_unique<ExprMatchExpression>(expression.firstElement(), expCtx); + std::make_unique<ExprMatchExpression>(expression.firstElement(), expCtx); for (size_t i = 0; i < 2u; ++i) { doublyOptimized = MatchExpression::optimize(std::move(doublyOptimized)); } @@ -677,7 +677,7 @@ TEST(ExprMatchTest, OptimizingAnAlreadyOptimizedCloneIsANoop) { // Create and optimize an ExprMatchExpression. std::unique_ptr<MatchExpression> singlyOptimized = - stdx::make_unique<ExprMatchExpression>(expression.firstElement(), expCtx); + std::make_unique<ExprMatchExpression>(expression.firstElement(), expCtx); singlyOptimized = MatchExpression::optimize(std::move(singlyOptimized)); // We expect that the optimized 'matchExpr' is now an $and. diff --git a/src/mongo/db/matcher/expression_geo.cpp b/src/mongo/db/matcher/expression_geo.cpp index 99081c3e910..18e38b319f0 100644 --- a/src/mongo/db/matcher/expression_geo.cpp +++ b/src/mongo/db/matcher/expression_geo.cpp @@ -403,7 +403,7 @@ bool GeoMatchExpression::equivalent(const MatchExpression* other) const { std::unique_ptr<MatchExpression> GeoMatchExpression::shallowClone() const { std::unique_ptr<GeoMatchExpression> next = - stdx::make_unique<GeoMatchExpression>(path(), _query, _rawObj); + std::make_unique<GeoMatchExpression>(path(), _query, _rawObj); next->_canSkipValidation = _canSkipValidation; if (getTag()) { next->setTag(getTag()->clone()); @@ -461,7 +461,7 @@ bool GeoNearMatchExpression::equivalent(const MatchExpression* other) const { std::unique_ptr<MatchExpression> GeoNearMatchExpression::shallowClone() const { std::unique_ptr<GeoNearMatchExpression> next = - stdx::make_unique<GeoNearMatchExpression>(path(), _query, _rawObj); + std::make_unique<GeoNearMatchExpression>(path(), _query, _rawObj); if (getTag()) { next->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/expression_geo_test.cpp b/src/mongo/db/matcher/expression_geo_test.cpp index 56ddaa674ea..5d8d6744a34 100644 --- a/src/mongo/db/matcher/expression_geo_test.cpp +++ b/src/mongo/db/matcher/expression_geo_test.cpp @@ -31,11 +31,12 @@ #include "mongo/unittest/unittest.h" +#include <memory> + #include "mongo/db/jsobj.h" #include "mongo/db/json.h" #include "mongo/db/matcher/expression.h" #include "mongo/db/matcher/expression_geo.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -74,7 +75,7 @@ std::unique_ptr<GeoMatchExpression> makeGeoMatchExpression(const BSONObj& locQue ASSERT_OK(gq->parseFrom(locQuery)); std::unique_ptr<GeoMatchExpression> ge = - stdx::make_unique<GeoMatchExpression>("a", gq.release(), locQuery); + std::make_unique<GeoMatchExpression>("a", gq.release(), locQuery); return ge; } @@ -84,7 +85,7 @@ std::unique_ptr<GeoNearMatchExpression> makeGeoNearMatchExpression(const BSONObj ASSERT_OK(nq->parseFrom(locQuery)); std::unique_ptr<GeoNearMatchExpression> gne = - stdx::make_unique<GeoNearMatchExpression>("a", nq.release(), locQuery); + std::make_unique<GeoNearMatchExpression>("a", nq.release(), locQuery); return gne; } diff --git a/src/mongo/db/matcher/expression_internal_expr_eq.cpp b/src/mongo/db/matcher/expression_internal_expr_eq.cpp index 6757384bcf5..4c7e32f353b 100644 --- a/src/mongo/db/matcher/expression_internal_expr_eq.cpp +++ b/src/mongo/db/matcher/expression_internal_expr_eq.cpp @@ -58,7 +58,7 @@ bool InternalExprEqMatchExpression::matchesSingleElement(const BSONElement& elem } std::unique_ptr<MatchExpression> InternalExprEqMatchExpression::shallowClone() const { - auto clone = stdx::make_unique<InternalExprEqMatchExpression>(path(), _rhs); + auto clone = std::make_unique<InternalExprEqMatchExpression>(path(), _rhs); clone->setCollator(_collator); if (getTag()) { clone->setTag(getTag()->clone()); diff --git a/src/mongo/db/matcher/expression_internal_expr_eq_test.cpp b/src/mongo/db/matcher/expression_internal_expr_eq_test.cpp index 337dc1bfff8..a16a7fe6447 100644 --- a/src/mongo/db/matcher/expression_internal_expr_eq_test.cpp +++ b/src/mongo/db/matcher/expression_internal_expr_eq_test.cpp @@ -291,7 +291,7 @@ TEST(InternalExprEqMatchExpression, EquivalentToClone) { CollatorInterfaceMock collator(CollatorInterfaceMock::MockType::kReverseString); Matcher eq(query, expCtx); eq.getMatchExpression()->setCollator(&collator); - auto relevantTag = stdx::make_unique<RelevantTag>(); + auto relevantTag = std::make_unique<RelevantTag>(); relevantTag->first.push_back(0u); relevantTag->notFirst.push_back(1u); eq.getMatchExpression()->setTag(relevantTag.release()); diff --git a/src/mongo/db/matcher/expression_leaf.cpp b/src/mongo/db/matcher/expression_leaf.cpp index 334dd0201e7..ee43237617e 100644 --- a/src/mongo/db/matcher/expression_leaf.cpp +++ b/src/mongo/db/matcher/expression_leaf.cpp @@ -32,6 +32,7 @@ #include "mongo/db/matcher/expression_leaf.h" #include <cmath> +#include <memory> #include <pcrecpp.h> #include "mongo/bson/bsonelement_comparator.h" @@ -43,7 +44,6 @@ #include "mongo/db/matcher/expression_parser.h" #include "mongo/db/matcher/path.h" #include "mongo/db/query/collation/collator_interface.h" -#include "mongo/stdx/memory.h" #include "mongo/util/regex_util.h" #include "mongo/util/str.h" @@ -367,7 +367,7 @@ InMatchExpression::InMatchExpression(StringData path) _eltCmp(BSONElementComparator::FieldNamesMode::kIgnore, _collator) {} std::unique_ptr<MatchExpression> InMatchExpression::shallowClone() const { - auto next = stdx::make_unique<InMatchExpression>(path()); + auto next = std::make_unique<InMatchExpression>(path()); next->setCollator(_collator); if (getTag()) { next->setTag(getTag()->clone()); @@ -551,7 +551,7 @@ MatchExpression::ExpressionOptimizerFunc InMatchExpression::getOptimizer() const auto& childRe = regexList.front(); invariant(!childRe->getTag()); - auto simplifiedExpression = stdx::make_unique<RegexMatchExpression>( + auto simplifiedExpression = std::make_unique<RegexMatchExpression>( expression->path(), childRe->getString(), childRe->getFlags()); if (expression->getTag()) { simplifiedExpression->setTag(expression->getTag()->clone()); @@ -559,7 +559,7 @@ MatchExpression::ExpressionOptimizerFunc InMatchExpression::getOptimizer() const return std::move(simplifiedExpression); } else if (equalitySet.size() == 1 && regexList.empty()) { // Simplify IN of exactly one equality to be an EqualityMatchExpression. - auto simplifiedExpression = stdx::make_unique<EqualityMatchExpression>( + auto simplifiedExpression = std::make_unique<EqualityMatchExpression>( expression->path(), *(equalitySet.begin())); simplifiedExpression->setCollator(collator); if (expression->getTag()) { diff --git a/src/mongo/db/matcher/expression_leaf.h b/src/mongo/db/matcher/expression_leaf.h index 931ef828d03..df0654e8c87 100644 --- a/src/mongo/db/matcher/expression_leaf.h +++ b/src/mongo/db/matcher/expression_leaf.h @@ -29,13 +29,14 @@ #pragma once +#include <memory> + #include "mongo/bson/bsonelement_comparator.h" #include "mongo/bson/bsonmisc.h" #include "mongo/bson/bsonobj.h" #include "mongo/db/matcher/expression.h" #include "mongo/db/matcher/expression_path.h" #include "mongo/db/query/collation/collator_interface.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/unordered_map.h" namespace pcrecpp { @@ -191,7 +192,7 @@ public: virtual std::unique_ptr<MatchExpression> shallowClone() const { std::unique_ptr<ComparisonMatchExpression> e = - stdx::make_unique<EqualityMatchExpression>(path(), _rhs); + std::make_unique<EqualityMatchExpression>(path(), _rhs); if (getTag()) { e->setTag(getTag()->clone()); } @@ -213,7 +214,7 @@ public: virtual std::unique_ptr<MatchExpression> shallowClone() const { std::unique_ptr<ComparisonMatchExpression> e = - stdx::make_unique<LTEMatchExpression>(path(), _rhs); + std::make_unique<LTEMatchExpression>(path(), _rhs); if (getTag()) { e->setTag(getTag()->clone()); } @@ -235,7 +236,7 @@ public: virtual std::unique_ptr<MatchExpression> shallowClone() const { std::unique_ptr<ComparisonMatchExpression> e = - stdx::make_unique<LTMatchExpression>(path(), _rhs); + std::make_unique<LTMatchExpression>(path(), _rhs); if (getTag()) { e->setTag(getTag()->clone()); } @@ -257,7 +258,7 @@ public: virtual std::unique_ptr<MatchExpression> shallowClone() const { std::unique_ptr<ComparisonMatchExpression> e = - stdx::make_unique<GTMatchExpression>(path(), _rhs); + std::make_unique<GTMatchExpression>(path(), _rhs); if (getTag()) { e->setTag(getTag()->clone()); } @@ -279,7 +280,7 @@ public: virtual std::unique_ptr<MatchExpression> shallowClone() const { std::unique_ptr<ComparisonMatchExpression> e = - stdx::make_unique<GTEMatchExpression>(path(), _rhs); + std::make_unique<GTEMatchExpression>(path(), _rhs); if (getTag()) { e->setTag(getTag()->clone()); } @@ -299,7 +300,7 @@ public: virtual std::unique_ptr<MatchExpression> shallowClone() const { std::unique_ptr<RegexMatchExpression> e = - stdx::make_unique<RegexMatchExpression>(path(), _regex, _flags); + std::make_unique<RegexMatchExpression>(path(), _regex, _flags); if (getTag()) { e->setTag(getTag()->clone()); } @@ -343,7 +344,7 @@ public: virtual std::unique_ptr<MatchExpression> shallowClone() const { std::unique_ptr<ModMatchExpression> m = - stdx::make_unique<ModMatchExpression>(path(), _divisor, _remainder); + std::make_unique<ModMatchExpression>(path(), _divisor, _remainder); if (getTag()) { m->setTag(getTag()->clone()); } @@ -379,7 +380,7 @@ public: explicit ExistsMatchExpression(StringData path); virtual std::unique_ptr<MatchExpression> shallowClone() const { - std::unique_ptr<ExistsMatchExpression> e = stdx::make_unique<ExistsMatchExpression>(path()); + std::unique_ptr<ExistsMatchExpression> e = std::make_unique<ExistsMatchExpression>(path()); if (getTag()) { e->setTag(getTag()->clone()); } @@ -563,7 +564,7 @@ public: virtual std::unique_ptr<MatchExpression> shallowClone() const { std::unique_ptr<BitTestMatchExpression> bitTestMatchExpression = - stdx::make_unique<BitsAllSetMatchExpression>(path(), getBitPositions()); + std::make_unique<BitsAllSetMatchExpression>(path(), getBitPositions()); if (getTag()) { bitTestMatchExpression->setTag(getTag()->clone()); } @@ -584,7 +585,7 @@ public: virtual std::unique_ptr<MatchExpression> shallowClone() const { std::unique_ptr<BitTestMatchExpression> bitTestMatchExpression = - stdx::make_unique<BitsAllClearMatchExpression>(path(), getBitPositions()); + std::make_unique<BitsAllClearMatchExpression>(path(), getBitPositions()); if (getTag()) { bitTestMatchExpression->setTag(getTag()->clone()); } @@ -605,7 +606,7 @@ public: virtual std::unique_ptr<MatchExpression> shallowClone() const { std::unique_ptr<BitTestMatchExpression> bitTestMatchExpression = - stdx::make_unique<BitsAnySetMatchExpression>(path(), getBitPositions()); + std::make_unique<BitsAnySetMatchExpression>(path(), getBitPositions()); if (getTag()) { bitTestMatchExpression->setTag(getTag()->clone()); } @@ -626,7 +627,7 @@ public: virtual std::unique_ptr<MatchExpression> shallowClone() const { std::unique_ptr<BitTestMatchExpression> bitTestMatchExpression = - stdx::make_unique<BitsAnyClearMatchExpression>(path(), getBitPositions()); + std::make_unique<BitsAnyClearMatchExpression>(path(), getBitPositions()); if (getTag()) { bitTestMatchExpression->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/expression_optimize_test.cpp b/src/mongo/db/matcher/expression_optimize_test.cpp index ba9345a84a1..cec775d9eb8 100644 --- a/src/mongo/db/matcher/expression_optimize_test.cpp +++ b/src/mongo/db/matcher/expression_optimize_test.cpp @@ -78,7 +78,7 @@ Status isValid(const std::string& queryStr, const QueryRequest& qrRaw) { TEST(ExpressionOptimizeTest, IsValidText) { // Filter inside QueryRequest is not used. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); ASSERT_OK(qr->validate()); // Valid: regular TEXT. @@ -134,7 +134,7 @@ TEST(ExpressionOptimizeTest, IsValidText) { TEST(ExpressionOptimizeTest, IsValidTextTailable) { // Filter inside QueryRequest is not used. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setTailableMode(TailableModeEnum::kTailable); ASSERT_OK(qr->validate()); @@ -144,7 +144,7 @@ TEST(ExpressionOptimizeTest, IsValidTextTailable) { TEST(ExpressionOptimizeTest, IsValidGeo) { // Filter inside QueryRequest is not used. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); ASSERT_OK(qr->validate()); // Valid: regular GEO_NEAR. @@ -210,7 +210,7 @@ TEST(ExpressionOptimizeTest, IsValidGeo) { TEST(ExpressionOptimizeTest, IsValidTextAndGeo) { // Filter inside QueryRequest is not used. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); ASSERT_OK(qr->validate()); // Invalid: TEXT and GEO_NEAR. @@ -231,7 +231,7 @@ TEST(ExpressionOptimizeTest, IsValidTextAndGeo) { TEST(ExpressionOptimizeTest, IsValidTextAndNaturalAscending) { // Filter inside QueryRequest is not used. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setSort(fromjson("{$natural: 1}")); ASSERT_OK(qr->validate()); @@ -241,7 +241,7 @@ TEST(ExpressionOptimizeTest, IsValidTextAndNaturalAscending) { TEST(ExpressionOptimizeTest, IsValidTextAndNaturalDescending) { // Filter inside QueryRequest is not used. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setSort(fromjson("{$natural: -1}")); ASSERT_OK(qr->validate()); @@ -251,7 +251,7 @@ TEST(ExpressionOptimizeTest, IsValidTextAndNaturalDescending) { TEST(ExpressionOptimizeTest, IsValidTextAndHint) { // Filter inside QueryRequest is not used. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setHint(fromjson("{a: 1}")); ASSERT_OK(qr->validate()); @@ -262,7 +262,7 @@ TEST(ExpressionOptimizeTest, IsValidTextAndHint) { // SERVER-14366 TEST(ExpressionOptimizeTest, IsValidGeoNearNaturalSort) { // Filter inside QueryRequest is not used. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setSort(fromjson("{$natural: 1}")); ASSERT_OK(qr->validate()); @@ -273,7 +273,7 @@ TEST(ExpressionOptimizeTest, IsValidGeoNearNaturalSort) { // SERVER-14366 TEST(ExpressionOptimizeTest, IsValidGeoNearNaturalHint) { // Filter inside QueryRequest is not used. - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setHint(fromjson("{$natural: 1}")); ASSERT_OK(qr->validate()); @@ -331,7 +331,7 @@ TEST(ExpressionOptimizeTest, NormalizeWithInAndRegexPreservesTags) { TEST(ExpressionOptimizeTest, NormalizeWithInPreservesCollator) { CollatorInterfaceMock collator(CollatorInterfaceMock::MockType::kReverseString); BSONObj obj = fromjson("{'': 'string'}"); - auto inMatchExpression = stdx::make_unique<InMatchExpression>(""); + auto inMatchExpression = std::make_unique<InMatchExpression>(""); inMatchExpression->setCollator(&collator); std::vector<BSONElement> equalities{obj.firstElement()}; ASSERT_OK(inMatchExpression->setEqualities(std::move(equalities))); diff --git a/src/mongo/db/matcher/expression_parser.cpp b/src/mongo/db/matcher/expression_parser.cpp index e65d6885227..c92ae07f18a 100644 --- a/src/mongo/db/matcher/expression_parser.cpp +++ b/src/mongo/db/matcher/expression_parser.cpp @@ -31,6 +31,7 @@ #include "mongo/db/matcher/expression_parser.h" +#include <memory> #include <pcrecpp.h> #include "mongo/base/init.h" @@ -65,7 +66,6 @@ #include "mongo/db/matcher/schema/json_schema_parser.h" #include "mongo/db/namespace_string.h" #include "mongo/db/query/query_knobs_gen.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" #include "mongo/util/string_map.h" @@ -139,7 +139,7 @@ StatusWithMatchExpression parseRegexElement(StringData name, BSONElement e) { if (e.type() != BSONType::RegEx) return {Status(ErrorCodes::BadValue, "not a regex")}; - return {stdx::make_unique<RegexMatchExpression>(name, e.regex(), e.regexFlags())}; + return {std::make_unique<RegexMatchExpression>(name, e.regex(), e.regexFlags())}; } StatusWithMatchExpression parseComparison( @@ -242,7 +242,7 @@ StatusWithMatchExpression parse(const BSONObj& obj, const ExtensionsCallback* extensionsCallback, MatchExpressionParser::AllowedFeatureSet allowedFeatures, DocumentParseLevel currentLevel) { - auto root = stdx::make_unique<AndMatchExpression>(); + auto root = std::make_unique<AndMatchExpression>(); const DocumentParseLevel nextLevel = (currentLevel == DocumentParseLevel::kPredicateTopLevel) ? DocumentParseLevel::kUserDocumentTopLevel @@ -300,7 +300,7 @@ StatusWithMatchExpression parse(const BSONObj& obj, auto eq = parseComparison(e.fieldNameStringData(), - stdx::make_unique<EqualityMatchExpression>(e.fieldNameStringData(), e), + std::make_unique<EqualityMatchExpression>(e.fieldNameStringData(), e), e, expCtx, allowedFeatures); @@ -365,7 +365,7 @@ StatusWithMatchExpression parseDBRef(StringData name, const ExtensionsCallback* extensionsCallback, MatchExpressionParser::AllowedFeatureSet allowedFeatures, DocumentParseLevel currentLevel) { - auto eq = stdx::make_unique<EqualityMatchExpression>(elem.fieldName(), elem); + auto eq = std::make_unique<EqualityMatchExpression>(elem.fieldName(), elem); // 'id' is collation-aware. 'ref' and 'db' are compared using binary comparison. eq->setCollator("id"_sd == name ? expCtx->getCollator() : nullptr); @@ -410,7 +410,7 @@ StatusWithMatchExpression parseAlwaysBoolean( str::stream() << T::kName << " must be an integer value of 1")}; } - return {stdx::make_unique<T>()}; + return {std::make_unique<T>()}; } StatusWithMatchExpression parseExpr(StringData name, @@ -428,7 +428,7 @@ StatusWithMatchExpression parseExpr(StringData name, return {Status(ErrorCodes::QueryFeatureNotAllowed, "$expr is not allowed in this context")}; } - return {stdx::make_unique<ExprMatchExpression>(std::move(elem), expCtx)}; + return {std::make_unique<ExprMatchExpression>(std::move(elem), expCtx)}; } StatusWithMatchExpression parseMOD(StringData name, BSONElement e) { @@ -452,7 +452,7 @@ StatusWithMatchExpression parseMOD(StringData name, BSONElement e) { if (i.more()) return {Status(ErrorCodes::BadValue, "malformed mod, too many elements")}; - return {stdx::make_unique<ModMatchExpression>(name, d.numberInt(), r.numberInt())}; + return {std::make_unique<ModMatchExpression>(name, d.numberInt(), r.numberInt())}; } StatusWithMatchExpression parseRegexDocument(StringData name, const BSONObj& doc) { @@ -500,7 +500,7 @@ StatusWithMatchExpression parseRegexDocument(StringData name, const BSONObj& doc } } - return {stdx::make_unique<RegexMatchExpression>(name, regex, regexOptions)}; + return {std::make_unique<RegexMatchExpression>(name, regex, regexOptions)}; } Status parseInExpression(InMatchExpression* inExpression, @@ -515,7 +515,7 @@ Status parseInExpression(InMatchExpression* inExpression, } if (e.type() == BSONType::RegEx) { - auto status = inExpression->addRegex(stdx::make_unique<RegexMatchExpression>(""_sd, e)); + auto status = inExpression->addRegex(std::make_unique<RegexMatchExpression>(""_sd, e)); if (!status.isOK()) { return status; } @@ -538,7 +538,7 @@ StatusWithMatchExpression parseType(StringData name, BSONElement elt) { str::stream() << name << " must match at least one type")}; } - return {stdx::make_unique<T>(name, std::move(typeSet.getValue()))}; + return {std::make_unique<T>(name, std::move(typeSet.getValue()))}; } /** @@ -621,19 +621,19 @@ StatusWithMatchExpression parseBitTest(StringData name, BSONElement e) { if (!bitPositions.isOK()) { return bitPositions.getStatus(); } - bitTestMatchExpression = stdx::make_unique<T>(name, std::move(bitPositions.getValue())); + bitTestMatchExpression = std::make_unique<T>(name, std::move(bitPositions.getValue())); } else if (e.isNumber()) { // Integer bitmask provided as value. auto bitMask = e.parseIntegerElementToNonNegativeLong(); if (!bitMask.isOK()) { return bitMask.getStatus(); } - bitTestMatchExpression = stdx::make_unique<T>(name, bitMask.getValue()); + bitTestMatchExpression = std::make_unique<T>(name, bitMask.getValue()); } else if (e.type() == BSONType::BinData) { // Binary bitmask provided as value. int eBinaryLen; auto eBinary = e.binData(eBinaryLen); - bitTestMatchExpression = stdx::make_unique<T>(name, eBinary, eBinaryLen); + bitTestMatchExpression = std::make_unique<T>(name, eBinary, eBinaryLen); } else { return Status( ErrorCodes::BadValue, @@ -672,7 +672,7 @@ StatusWithMatchExpression parseInternalSchemaFmod(StringData name, BSONElement e return {ErrorCodes::BadValue, str::stream() << path << " has too many elements"}; } - return {stdx::make_unique<InternalSchemaFmodMatchExpression>( + return {std::make_unique<InternalSchemaFmodMatchExpression>( name, d.numberDecimal(), r.numberDecimal())}; } @@ -696,7 +696,7 @@ StatusWithMatchExpression parseInternalSchemaRootDocEq( << elem.type())}; } auto rootDocEq = - stdx::make_unique<InternalSchemaRootDocEqMatchExpression>(elem.embeddedObject()); + std::make_unique<InternalSchemaRootDocEqMatchExpression>(elem.embeddedObject()); return {std::move(rootDocEq)}; } @@ -712,7 +712,7 @@ StatusWithMatchExpression parseInternalSchemaSingleIntegerArgument(StringData na return parsedInt.getStatus(); } - return {stdx::make_unique<T>(name, parsedInt.getValue())}; + return {std::make_unique<T>(name, parsedInt.getValue())}; } /** @@ -731,7 +731,7 @@ StatusWithMatchExpression parseTopLevelInternalSchemaSingleIntegerArgument( if (!parsedInt.isOK()) { return parsedInt.getStatus(); } - return {stdx::make_unique<T>(parsedInt.getValue())}; + return {std::make_unique<T>(parsedInt.getValue())}; } /** @@ -969,7 +969,7 @@ StatusWithMatchExpression parseInternalSchemaAllowedProperties( return properties.getStatus(); } - return {stdx::make_unique<InternalSchemaAllowedPropertiesMatchExpression>( + return {std::make_unique<InternalSchemaAllowedPropertiesMatchExpression>( std::move(properties.getValue()), namePlaceholder.getValue(), std::move(patternProperties.getValue()), @@ -1024,7 +1024,7 @@ StatusWithMatchExpression parseInternalSchemaMatchArrayIndex( return expressionWithPlaceholder.getStatus(); } - return {stdx::make_unique<InternalSchemaMatchArrayIndexMatchExpression>( + return {std::make_unique<InternalSchemaMatchArrayIndexMatchExpression>( path, index.getValue(), std::move(expressionWithPlaceholder.getValue()))}; } @@ -1033,12 +1033,12 @@ StatusWithMatchExpression parseGeo(StringData name, const BSONObj& section, MatchExpressionParser::AllowedFeatureSet allowedFeatures) { if (PathAcceptingKeyword::WITHIN == type || PathAcceptingKeyword::GEO_INTERSECTS == type) { - auto gq = stdx::make_unique<GeoExpression>(name.toString()); + auto gq = std::make_unique<GeoExpression>(name.toString()); auto parseStatus = gq->parseFrom(section); if (!parseStatus.isOK()) { return parseStatus; } - return {stdx::make_unique<GeoMatchExpression>(name, gq.release(), section)}; + return {std::make_unique<GeoMatchExpression>(name, gq.release(), section)}; } else { invariant(PathAcceptingKeyword::GEO_NEAR == type); @@ -1047,12 +1047,12 @@ StatusWithMatchExpression parseGeo(StringData name, "$geoNear, $near, and $nearSphere are not allowed in this context")}; } - auto nq = stdx::make_unique<GeoNearExpression>(name.toString()); + auto nq = std::make_unique<GeoNearExpression>(name.toString()); auto status = nq->parseFrom(section); if (!status.isOK()) { return status; } - return {stdx::make_unique<GeoNearMatchExpression>(name, nq.release(), section)}; + return {std::make_unique<GeoNearMatchExpression>(name, nq.release(), section)}; } } @@ -1068,7 +1068,7 @@ StatusWithMatchExpression parseTreeTopLevel( return {Status(ErrorCodes::BadValue, str::stream() << T::kName << " must be an array")}; } - auto temp = stdx::make_unique<T>(); + auto temp = std::make_unique<T>(); auto arr = elem.Obj(); if (arr.isEmpty()) { @@ -1129,7 +1129,7 @@ StatusWithMatchExpression parseElemMatch(StringData name, if (!s.isOK()) return s; - auto temp = stdx::make_unique<ElemMatchValueMatchExpression>(name); + auto temp = std::make_unique<ElemMatchValueMatchExpression>(name); for (size_t i = 0; i < theAnd.numChildren(); i++) { temp->add(theAnd.getChild(i)); @@ -1157,7 +1157,7 @@ StatusWithMatchExpression parseElemMatch(StringData name, return {Status(ErrorCodes::BadValue, "$elemMatch cannot contain $where expression")}; } - return {stdx::make_unique<ElemMatchObjectMatchExpression>(name, sub.release())}; + return {std::make_unique<ElemMatchObjectMatchExpression>(name, sub.release())}; } StatusWithMatchExpression parseAll(StringData name, @@ -1169,7 +1169,7 @@ StatusWithMatchExpression parseAll(StringData name, return {Status(ErrorCodes::BadValue, "$all needs an array")}; auto arr = e.Obj(); - auto myAnd = stdx::make_unique<AndMatchExpression>(); + auto myAnd = std::make_unique<AndMatchExpression>(); BSONObjIterator i(arr); if (arr.firstElement().type() == BSONType::Object && @@ -1207,20 +1207,20 @@ StatusWithMatchExpression parseAll(StringData name, auto e = i.next(); if (e.type() == BSONType::RegEx) { - auto expr = stdx::make_unique<RegexMatchExpression>(name, e); + auto expr = std::make_unique<RegexMatchExpression>(name, e); myAnd->add(expr.release()); } else if (e.type() == BSONType::Object && MatchExpressionParser::parsePathAcceptingKeyword(e.Obj().firstElement())) { return {Status(ErrorCodes::BadValue, "no $ expressions in $all")}; } else { - auto expr = stdx::make_unique<EqualityMatchExpression>(name, e); + auto expr = std::make_unique<EqualityMatchExpression>(name, e); expr->setCollator(expCtx->getCollator()); myAnd->add(expr.release()); } } if (myAnd->numChildren() == 0) { - return {stdx::make_unique<AlwaysFalseMatchExpression>()}; + return {std::make_unique<AlwaysFalseMatchExpression>()}; } return {std::move(myAnd)}; @@ -1274,7 +1274,7 @@ StatusWithMatchExpression parseInternalSchemaFixedArityArgument( ++position; } - return {stdx::make_unique<T>(std::move(expressions))}; + return {std::make_unique<T>(std::move(expressions))}; } StatusWithMatchExpression parseNot(StringData name, @@ -1288,7 +1288,7 @@ StatusWithMatchExpression parseNot(StringData name, if (!regex.isOK()) { return regex; } - return {stdx::make_unique<NotMatchExpression>(regex.getValue().release())}; + return {std::make_unique<NotMatchExpression>(regex.getValue().release())}; } if (elem.type() != BSONType::Object) { @@ -1300,14 +1300,14 @@ StatusWithMatchExpression parseNot(StringData name, return {ErrorCodes::BadValue, "$not cannot be empty"}; } - auto theAnd = stdx::make_unique<AndMatchExpression>(); + auto theAnd = std::make_unique<AndMatchExpression>(); auto parseStatus = parseSub( name, notObject, theAnd.get(), expCtx, extensionsCallback, allowedFeatures, currentLevel); if (!parseStatus.isOK()) { return parseStatus; } - return {stdx::make_unique<NotMatchExpression>(theAnd.release())}; + return {std::make_unique<NotMatchExpression>(theAnd.release())}; } StatusWithMatchExpression parseInternalSchemaBinDataSubType(StringData name, BSONElement e) { @@ -1333,7 +1333,7 @@ StatusWithMatchExpression parseInternalSchemaBinDataSubType(StringData name, BSO << valueAsInt.getValue()); } - return {stdx::make_unique<InternalSchemaBinDataSubTypeExpression>( + return {std::make_unique<InternalSchemaBinDataSubTypeExpression>( name, static_cast<BinDataType>(valueAsInt.getValue()))}; } @@ -1354,7 +1354,7 @@ StatusWithMatchExpression parseSubField(const BSONObj& context, if ("$eq"_sd == e.fieldNameStringData()) { return parseComparison( - name, stdx::make_unique<EqualityMatchExpression>(name, e), e, expCtx, allowedFeatures); + name, std::make_unique<EqualityMatchExpression>(name, e), e, expCtx, allowedFeatures); } if ("$not"_sd == e.fieldNameStringData()) { @@ -1375,16 +1375,16 @@ StatusWithMatchExpression parseSubField(const BSONObj& context, switch (*parseExpMatchType) { case PathAcceptingKeyword::LESS_THAN: return parseComparison( - name, stdx::make_unique<LTMatchExpression>(name, e), e, expCtx, allowedFeatures); + name, std::make_unique<LTMatchExpression>(name, e), e, expCtx, allowedFeatures); case PathAcceptingKeyword::LESS_THAN_OR_EQUAL: return parseComparison( - name, stdx::make_unique<LTEMatchExpression>(name, e), e, expCtx, allowedFeatures); + name, std::make_unique<LTEMatchExpression>(name, e), e, expCtx, allowedFeatures); case PathAcceptingKeyword::GREATER_THAN: return parseComparison( - name, stdx::make_unique<GTMatchExpression>(name, e), e, expCtx, allowedFeatures); + name, std::make_unique<GTMatchExpression>(name, e), e, expCtx, allowedFeatures); case PathAcceptingKeyword::GREATER_THAN_OR_EQUAL: return parseComparison( - name, stdx::make_unique<GTEMatchExpression>(name, e), e, expCtx, allowedFeatures); + name, std::make_unique<GTEMatchExpression>(name, e), e, expCtx, allowedFeatures); case PathAcceptingKeyword::NOT_EQUAL: { if (BSONType::RegEx == e.type()) { // Just because $ne can be rewritten as the negation of an equality does not mean @@ -1393,15 +1393,15 @@ StatusWithMatchExpression parseSubField(const BSONObj& context, } StatusWithMatchExpression s = parseComparison(name, - stdx::make_unique<EqualityMatchExpression>(name, e), + std::make_unique<EqualityMatchExpression>(name, e), e, expCtx, allowedFeatures); - return {stdx::make_unique<NotMatchExpression>(s.getValue().release())}; + return {std::make_unique<NotMatchExpression>(s.getValue().release())}; } case PathAcceptingKeyword::EQUALITY: return parseComparison(name, - stdx::make_unique<EqualityMatchExpression>(name, e), + std::make_unique<EqualityMatchExpression>(name, e), e, expCtx, allowedFeatures); @@ -1410,7 +1410,7 @@ StatusWithMatchExpression parseSubField(const BSONObj& context, if (e.type() != BSONType::Array) { return {Status(ErrorCodes::BadValue, "$in needs an array")}; } - auto temp = stdx::make_unique<InMatchExpression>(name); + auto temp = std::make_unique<InMatchExpression>(name); auto parseStatus = parseInExpression(temp.get(), e.Obj(), expCtx); if (!parseStatus.isOK()) { return parseStatus; @@ -1422,12 +1422,12 @@ StatusWithMatchExpression parseSubField(const BSONObj& context, if (e.type() != Array) { return {Status(ErrorCodes::BadValue, "$nin needs an array")}; } - auto temp = stdx::make_unique<InMatchExpression>(name); + auto temp = std::make_unique<InMatchExpression>(name); auto parseStatus = parseInExpression(temp.get(), e.Obj(), expCtx); if (!parseStatus.isOK()) { return parseStatus; } - return {stdx::make_unique<NotMatchExpression>(temp.release())}; + return {std::make_unique<NotMatchExpression>(temp.release())}; } case PathAcceptingKeyword::SIZE: { @@ -1454,7 +1454,7 @@ StatusWithMatchExpression parseSubField(const BSONObj& context, if (size < 0) { return {Status(ErrorCodes::BadValue, "$size may not be negative")}; } - return {stdx::make_unique<SizeMatchExpression>(name, size)}; + return {std::make_unique<SizeMatchExpression>(name, size)}; } case PathAcceptingKeyword::EXISTS: { @@ -1462,12 +1462,12 @@ StatusWithMatchExpression parseSubField(const BSONObj& context, return {Status(ErrorCodes::BadValue, "$exists can't be eoo")}; } - auto existsExpr = stdx::make_unique<ExistsMatchExpression>(name); + auto existsExpr = std::make_unique<ExistsMatchExpression>(name); if (e.trueValue()) { return {std::move(existsExpr)}; } - return {stdx::make_unique<NotMatchExpression>(existsExpr.release())}; + return {std::make_unique<NotMatchExpression>(existsExpr.release())}; } case PathAcceptingKeyword::TYPE: @@ -1515,7 +1515,7 @@ StatusWithMatchExpression parseSubField(const BSONObj& context, << typeName(e.type()))}; } - auto exprEqExpr = stdx::make_unique<InternalExprEqMatchExpression>(name, e); + auto exprEqExpr = std::make_unique<InternalExprEqMatchExpression>(name, e); exprEqExpr->setCollator(expCtx->getCollator()); return {std::move(exprEqExpr)}; } @@ -1565,7 +1565,7 @@ StatusWithMatchExpression parseSubField(const BSONObj& context, return parsedSubObjExpr; } - return {stdx::make_unique<InternalSchemaObjectMatchExpression>( + return {std::make_unique<InternalSchemaObjectMatchExpression>( name, std::move(parsedSubObjExpr.getValue()))}; } @@ -1575,7 +1575,7 @@ StatusWithMatchExpression parseSubField(const BSONObj& context, str::stream() << name << " must be a boolean of value true"}; } - return {stdx::make_unique<InternalSchemaUniqueItemsMatchExpression>(name)}; + return {std::make_unique<InternalSchemaUniqueItemsMatchExpression>(name)}; } case PathAcceptingKeyword::INTERNAL_SCHEMA_MIN_LENGTH: { @@ -1653,7 +1653,7 @@ StatusWithMatchExpression parseSubField(const BSONObj& context, if (!exprWithPlaceholder.isOK()) { return exprWithPlaceholder.getStatus(); } - return {stdx::make_unique<InternalSchemaAllElemMatchFromIndexMatchExpression>( + return {std::make_unique<InternalSchemaAllElemMatchFromIndexMatchExpression>( name, parsedIndex.getValue(), std::move(exprWithPlaceholder.getValue()))}; } @@ -1662,7 +1662,7 @@ StatusWithMatchExpression parseSubField(const BSONObj& context, } case PathAcceptingKeyword::INTERNAL_SCHEMA_EQ: { - return {stdx::make_unique<InternalSchemaEqMatchExpression>(name, e)}; + return {std::make_unique<InternalSchemaEqMatchExpression>(name, e)}; } case PathAcceptingKeyword::INTERNAL_SCHEMA_BIN_DATA_ENCRYPTED_TYPE: { @@ -1757,7 +1757,7 @@ std::unique_ptr<StringMap< pathlessOperatorMap; MONGO_INITIALIZER(PathlessOperatorMap)(InitializerContext* context) { - pathlessOperatorMap = stdx::make_unique<StringMap< + pathlessOperatorMap = std::make_unique<StringMap< std::function<StatusWithMatchExpression(StringData, BSONElement, const boost::intrusive_ptr<ExpressionContext>&, @@ -1804,7 +1804,7 @@ std::unique_ptr<StringMap<PathAcceptingKeyword>> queryOperatorMap; MONGO_INITIALIZER(MatchExpressionParser)(InitializerContext* context) { queryOperatorMap = - stdx::make_unique<StringMap<PathAcceptingKeyword>>(StringMap<PathAcceptingKeyword>{ + std::make_unique<StringMap<PathAcceptingKeyword>>(StringMap<PathAcceptingKeyword>{ // TODO: SERVER-19565 Add $eq after auditing callers. {"_internalExprEq", PathAcceptingKeyword::INTERNAL_EXPR_EQ}, {"_internalSchemaAllElemMatchFromIndex", diff --git a/src/mongo/db/matcher/expression_text.cpp b/src/mongo/db/matcher/expression_text.cpp index 8fdcd65befc..49fb5971739 100644 --- a/src/mongo/db/matcher/expression_text.cpp +++ b/src/mongo/db/matcher/expression_text.cpp @@ -31,13 +31,14 @@ #include "mongo/db/matcher/expression_text.h" +#include <memory> + #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/index_catalog.h" #include "mongo/db/db_raii.h" #include "mongo/db/fts/fts_language.h" #include "mongo/db/fts/fts_spec.h" #include "mongo/db/index/fts_access_method.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -101,7 +102,7 @@ TextMatchExpression::TextMatchExpression(OperationContext* opCtx, } std::unique_ptr<MatchExpression> TextMatchExpression::shallowClone() const { - auto expr = stdx::make_unique<TextMatchExpression>(_ftsQuery); + auto expr = std::make_unique<TextMatchExpression>(_ftsQuery); // We use the query-only constructor here directly rather than using the full constructor, to // avoid needing to examine // the index catalog. diff --git a/src/mongo/db/matcher/expression_text_noop.cpp b/src/mongo/db/matcher/expression_text_noop.cpp index a2d45802823..e0dfdbc551e 100644 --- a/src/mongo/db/matcher/expression_text_noop.cpp +++ b/src/mongo/db/matcher/expression_text_noop.cpp @@ -31,7 +31,8 @@ #include "mongo/db/matcher/expression_text_noop.h" -#include "mongo/stdx/memory.h" +#include <memory> + namespace mongo { @@ -51,7 +52,7 @@ std::unique_ptr<MatchExpression> TextNoOpMatchExpression::shallowClone() const { params.caseSensitive = _ftsQuery.getCaseSensitive(); params.diacriticSensitive = _ftsQuery.getDiacriticSensitive(); - auto expr = stdx::make_unique<TextNoOpMatchExpression>(std::move(params)); + auto expr = std::make_unique<TextNoOpMatchExpression>(std::move(params)); if (getTag()) { expr->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/expression_tree.cpp b/src/mongo/db/matcher/expression_tree.cpp index 2cbdb1886f0..b56e96f4924 100644 --- a/src/mongo/db/matcher/expression_tree.cpp +++ b/src/mongo/db/matcher/expression_tree.cpp @@ -137,7 +137,7 @@ MatchExpression::ExpressionOptimizerFunc ListOfMatchExpression::getOptimizer() c // empty AND as the same thing. The planner can create inferior plans for $alwaysTrue which // it would not produce for an AND with no children. if (children.empty() && matchType == MatchExpression::OR) { - return stdx::make_unique<AlwaysFalseMatchExpression>(); + return std::make_unique<AlwaysFalseMatchExpression>(); } if (children.size() == 1) { @@ -149,7 +149,7 @@ MatchExpression::ExpressionOptimizerFunc ListOfMatchExpression::getOptimizer() c return std::unique_ptr<MatchExpression>(simplifiedExpression); } else if (matchType == NOR) { // Simplify NOR of exactly one operand to NOT of that operand. - auto simplifiedExpression = stdx::make_unique<NotMatchExpression>(children.front()); + auto simplifiedExpression = std::make_unique<NotMatchExpression>(children.front()); children.clear(); return std::move(simplifiedExpression); } @@ -160,13 +160,13 @@ MatchExpression::ExpressionOptimizerFunc ListOfMatchExpression::getOptimizer() c // An AND containing an expression that always evaluates to false can be // optimized to a single $alwaysFalse expression. if (childExpression->isTriviallyFalse() && matchType == MatchExpression::AND) { - return stdx::make_unique<AlwaysFalseMatchExpression>(); + return std::make_unique<AlwaysFalseMatchExpression>(); } // Likewise, an OR containing an expression that always evaluates to true can be // optimized to a single $alwaysTrue expression. if (childExpression->isTriviallyTrue() && matchType == MatchExpression::OR) { - return stdx::make_unique<AlwaysTrueMatchExpression>(); + return std::make_unique<AlwaysTrueMatchExpression>(); } } } diff --git a/src/mongo/db/matcher/expression_tree.h b/src/mongo/db/matcher/expression_tree.h index b89efb19461..afecd935d79 100644 --- a/src/mongo/db/matcher/expression_tree.h +++ b/src/mongo/db/matcher/expression_tree.h @@ -115,7 +115,7 @@ public: bool matchesSingleElement(const BSONElement&, MatchDetails* details = nullptr) const final; virtual std::unique_ptr<MatchExpression> shallowClone() const { - std::unique_ptr<AndMatchExpression> self = stdx::make_unique<AndMatchExpression>(); + std::unique_ptr<AndMatchExpression> self = std::make_unique<AndMatchExpression>(); for (size_t i = 0; i < numChildren(); ++i) { self->add(getChild(i)->shallowClone().release()); } @@ -144,7 +144,7 @@ public: bool matchesSingleElement(const BSONElement&, MatchDetails* details = nullptr) const final; virtual std::unique_ptr<MatchExpression> shallowClone() const { - std::unique_ptr<OrMatchExpression> self = stdx::make_unique<OrMatchExpression>(); + std::unique_ptr<OrMatchExpression> self = std::make_unique<OrMatchExpression>(); for (size_t i = 0; i < numChildren(); ++i) { self->add(getChild(i)->shallowClone().release()); } @@ -173,7 +173,7 @@ public: bool matchesSingleElement(const BSONElement&, MatchDetails* details = nullptr) const final; virtual std::unique_ptr<MatchExpression> shallowClone() const { - std::unique_ptr<NorMatchExpression> self = stdx::make_unique<NorMatchExpression>(); + std::unique_ptr<NorMatchExpression> self = std::make_unique<NorMatchExpression>(); for (size_t i = 0; i < numChildren(); ++i) { self->add(getChild(i)->shallowClone().release()); } @@ -194,7 +194,7 @@ public: virtual std::unique_ptr<MatchExpression> shallowClone() const { std::unique_ptr<NotMatchExpression> self = - stdx::make_unique<NotMatchExpression>(_exp->shallowClone().release()); + std::make_unique<NotMatchExpression>(_exp->shallowClone().release()); if (getTag()) { self->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/expression_type.h b/src/mongo/db/matcher/expression_type.h index 3f210103c75..aa2860b8fd2 100644 --- a/src/mongo/db/matcher/expression_type.h +++ b/src/mongo/db/matcher/expression_type.h @@ -67,7 +67,7 @@ public: virtual StringData name() const = 0; std::unique_ptr<MatchExpression> shallowClone() const final { - auto expr = stdx::make_unique<T>(path(), _typeSet); + auto expr = std::make_unique<T>(path(), _typeSet); if (getTag()) { expr->setTag(getTag()->clone()); } @@ -189,7 +189,7 @@ public: std::unique_ptr<MatchExpression> shallowClone() const final { auto expr = - stdx::make_unique<InternalSchemaBinDataSubTypeExpression>(path(), _binDataSubType); + std::make_unique<InternalSchemaBinDataSubTypeExpression>(path(), _binDataSubType); if (getTag()) { expr->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/expression_where.cpp b/src/mongo/db/matcher/expression_where.cpp index 997b673c6cc..ff2069fe9ed 100644 --- a/src/mongo/db/matcher/expression_where.cpp +++ b/src/mongo/db/matcher/expression_where.cpp @@ -31,6 +31,8 @@ #include "mongo/db/matcher/expression_where.h" +#include <memory> + #include "mongo/base/init.h" #include "mongo/db/auth/authorization_session.h" #include "mongo/db/client.h" @@ -39,7 +41,6 @@ #include "mongo/db/matcher/expression_parser.h" #include "mongo/db/namespace_string.h" #include "mongo/scripting/engine.h" -#include "mongo/stdx/memory.h" #include "mongo/util/scopeguard.h" @@ -48,7 +49,6 @@ namespace mongo { using std::unique_ptr; using std::string; using std::stringstream; -using stdx::make_unique; WhereMatchExpression::WhereMatchExpression(OperationContext* opCtx, WhereParams params, @@ -104,7 +104,7 @@ unique_ptr<MatchExpression> WhereMatchExpression::shallowClone() const { params.code = getCode(); params.scope = getScope(); unique_ptr<WhereMatchExpression> e = - make_unique<WhereMatchExpression>(_opCtx, std::move(params), _dbName); + std::make_unique<WhereMatchExpression>(_opCtx, std::move(params), _dbName); if (getTag()) { e->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/expression_where_noop.cpp b/src/mongo/db/matcher/expression_where_noop.cpp index bd1469036e4..8372b0b49fe 100644 --- a/src/mongo/db/matcher/expression_where_noop.cpp +++ b/src/mongo/db/matcher/expression_where_noop.cpp @@ -31,7 +31,8 @@ #include "mongo/db/matcher/expression_where_noop.h" -#include "mongo/stdx/memory.h" +#include <memory> + namespace mongo { @@ -47,7 +48,7 @@ std::unique_ptr<MatchExpression> WhereNoOpMatchExpression::shallowClone() const params.code = getCode(); params.scope = getScope(); std::unique_ptr<WhereNoOpMatchExpression> e = - stdx::make_unique<WhereNoOpMatchExpression>(std::move(params)); + std::make_unique<WhereNoOpMatchExpression>(std::move(params)); if (getTag()) { e->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/expression_with_placeholder.cpp b/src/mongo/db/matcher/expression_with_placeholder.cpp index b0e1f1d118d..408232d9f3f 100644 --- a/src/mongo/db/matcher/expression_with_placeholder.cpp +++ b/src/mongo/db/matcher/expression_with_placeholder.cpp @@ -111,7 +111,7 @@ StatusWith<std::unique_ptr<ExpressionWithPlaceholder>> ExpressionWithPlaceholder } auto exprWithPlaceholder = - stdx::make_unique<ExpressionWithPlaceholder>(std::move(placeholder), std::move(filter)); + std::make_unique<ExpressionWithPlaceholder>(std::move(placeholder), std::move(filter)); return {std::move(exprWithPlaceholder)}; } diff --git a/src/mongo/db/matcher/expression_with_placeholder.h b/src/mongo/db/matcher/expression_with_placeholder.h index dd9150b4b0c..b61e3c6ab4e 100644 --- a/src/mongo/db/matcher/expression_with_placeholder.h +++ b/src/mongo/db/matcher/expression_with_placeholder.h @@ -92,7 +92,7 @@ public: } std::unique_ptr<ExpressionWithPlaceholder> shallowClone() const { - return stdx::make_unique<ExpressionWithPlaceholder>(_placeholder, _filter->shallowClone()); + return std::make_unique<ExpressionWithPlaceholder>(_placeholder, _filter->shallowClone()); } /* diff --git a/src/mongo/db/matcher/extensions_callback_noop.cpp b/src/mongo/db/matcher/extensions_callback_noop.cpp index b4b07efdae2..c4ce0f8f9b2 100644 --- a/src/mongo/db/matcher/extensions_callback_noop.cpp +++ b/src/mongo/db/matcher/extensions_callback_noop.cpp @@ -42,7 +42,7 @@ StatusWithMatchExpression ExtensionsCallbackNoop::parseText(BSONElement text) co return textParams.getStatus(); } - auto expr = stdx::make_unique<TextNoOpMatchExpression>(std::move(textParams.getValue())); + auto expr = std::make_unique<TextNoOpMatchExpression>(std::move(textParams.getValue())); return {std::move(expr)}; } @@ -53,7 +53,7 @@ StatusWithMatchExpression ExtensionsCallbackNoop::parseWhere(BSONElement where) return whereParams.getStatus(); } - return {stdx::make_unique<WhereNoOpMatchExpression>(std::move(whereParams.getValue()))}; + return {std::make_unique<WhereNoOpMatchExpression>(std::move(whereParams.getValue()))}; } } // namespace mongo diff --git a/src/mongo/db/matcher/extensions_callback_real.cpp b/src/mongo/db/matcher/extensions_callback_real.cpp index 97bd30a1089..313602e4752 100644 --- a/src/mongo/db/matcher/extensions_callback_real.cpp +++ b/src/mongo/db/matcher/extensions_callback_real.cpp @@ -47,7 +47,7 @@ StatusWithMatchExpression ExtensionsCallbackReal::parseText(BSONElement text) co } auto exp = - stdx::make_unique<TextMatchExpression>(_opCtx, *_nss, std::move(textParams.getValue())); + std::make_unique<TextMatchExpression>(_opCtx, *_nss, std::move(textParams.getValue())); return {std::move(exp)}; } @@ -58,7 +58,7 @@ StatusWithMatchExpression ExtensionsCallbackReal::parseWhere(BSONElement where) return whereParams.getStatus(); } - auto exp = stdx::make_unique<WhereMatchExpression>( + auto exp = std::make_unique<WhereMatchExpression>( _opCtx, std::move(whereParams.getValue()), _nss->db()); return {std::move(exp)}; } diff --git a/src/mongo/db/matcher/rewrite_expr.cpp b/src/mongo/db/matcher/rewrite_expr.cpp index c03ba61659f..01e5a6e51c5 100644 --- a/src/mongo/db/matcher/rewrite_expr.cpp +++ b/src/mongo/db/matcher/rewrite_expr.cpp @@ -76,7 +76,7 @@ std::unique_ptr<MatchExpression> RewriteExpr::_rewriteExpression( std::unique_ptr<MatchExpression> RewriteExpr::_rewriteAndExpression( const boost::intrusive_ptr<ExpressionAnd>& currExprNode) { - auto andMatch = stdx::make_unique<AndMatchExpression>(); + auto andMatch = std::make_unique<AndMatchExpression>(); for (auto&& child : currExprNode->getOperandList()) { if (auto childMatch = _rewriteExpression(child)) { @@ -94,7 +94,7 @@ std::unique_ptr<MatchExpression> RewriteExpr::_rewriteAndExpression( std::unique_ptr<MatchExpression> RewriteExpr::_rewriteOrExpression( const boost::intrusive_ptr<ExpressionOr>& currExprNode) { - auto orMatch = stdx::make_unique<OrMatchExpression>(); + auto orMatch = std::make_unique<OrMatchExpression>(); for (auto&& child : currExprNode->getOperandList()) { if (auto childExpr = _rewriteExpression(child)) { orMatch->add(childExpr.release()); @@ -151,7 +151,7 @@ std::unique_ptr<MatchExpression> RewriteExpr::_buildComparisonMatchExpression( invariant(comparisonOp == ExpressionCompare::EQ); auto eqMatchExpr = - stdx::make_unique<InternalExprEqMatchExpression>(fieldAndValue.fieldName(), fieldAndValue); + std::make_unique<InternalExprEqMatchExpression>(fieldAndValue.fieldName(), fieldAndValue); eqMatchExpr->setCollator(_collator); return std::move(eqMatchExpr); diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_all_elem_match_from_index.cpp b/src/mongo/db/matcher/schema/expression_internal_schema_all_elem_match_from_index.cpp index 7c2d67425b0..818054c4af1 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_all_elem_match_from_index.cpp +++ b/src/mongo/db/matcher/schema/expression_internal_schema_all_elem_match_from_index.cpp @@ -47,7 +47,7 @@ InternalSchemaAllElemMatchFromIndexMatchExpression:: std::unique_ptr<MatchExpression> InternalSchemaAllElemMatchFromIndexMatchExpression::shallowClone() const { - auto clone = stdx::make_unique<InternalSchemaAllElemMatchFromIndexMatchExpression>( + auto clone = std::make_unique<InternalSchemaAllElemMatchFromIndexMatchExpression>( path(), _index, _expression->shallowClone()); if (getTag()) { clone->setTag(getTag()->clone()); diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_allowed_properties.cpp b/src/mongo/db/matcher/schema/expression_internal_schema_allowed_properties.cpp index ee985195455..e110980de91 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_allowed_properties.cpp +++ b/src/mongo/db/matcher/schema/expression_internal_schema_allowed_properties.cpp @@ -162,7 +162,7 @@ std::unique_ptr<MatchExpression> InternalSchemaAllowedPropertiesMatchExpression: constraint.second->shallowClone()); } - auto clone = stdx::make_unique<InternalSchemaAllowedPropertiesMatchExpression>( + auto clone = std::make_unique<InternalSchemaAllowedPropertiesMatchExpression>( _properties, _namePlaceholder, std::move(clonedPatternProperties), diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_allowed_properties.h b/src/mongo/db/matcher/schema/expression_internal_schema_allowed_properties.h index aff80f95802..e45acba010b 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_allowed_properties.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_allowed_properties.h @@ -29,13 +29,13 @@ #pragma once +#include <memory> #include <pcrecpp.h> #include <utility> #include <vector> #include "mongo/db/matcher/expression.h" #include "mongo/db/matcher/expression_with_placeholder.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -94,7 +94,7 @@ public: */ struct Pattern { explicit Pattern(StringData pattern) - : rawRegex(pattern), regex(stdx::make_unique<pcrecpp::RE>(pattern.toString())) {} + : rawRegex(pattern), regex(std::make_unique<pcrecpp::RE>(pattern.toString())) {} StringData rawRegex; std::unique_ptr<pcrecpp::RE> regex; diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_cond_test.cpp b/src/mongo/db/matcher/schema/expression_internal_schema_cond_test.cpp index a9ad241694d..5d8e82b3d7c 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_cond_test.cpp +++ b/src/mongo/db/matcher/schema/expression_internal_schema_cond_test.cpp @@ -56,7 +56,7 @@ std::unique_ptr<InternalSchemaCondMatchExpression> createCondMatchExpression(BSO std::move(thenBranchExpr.getValue()), std::move(elseBranchExpr.getValue())}}; - auto cond = stdx::make_unique<InternalSchemaCondMatchExpression>(std::move(expressions)); + auto cond = std::make_unique<InternalSchemaCondMatchExpression>(std::move(expressions)); return cond; } diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_eq.cpp b/src/mongo/db/matcher/schema/expression_internal_schema_eq.cpp index c28eb69e4fb..d8a5f27f789 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_eq.cpp +++ b/src/mongo/db/matcher/schema/expression_internal_schema_eq.cpp @@ -83,7 +83,7 @@ bool InternalSchemaEqMatchExpression::equivalent(const MatchExpression* other) c } std::unique_ptr<MatchExpression> InternalSchemaEqMatchExpression::shallowClone() const { - auto clone = stdx::make_unique<InternalSchemaEqMatchExpression>(path(), _rhsElem); + auto clone = std::make_unique<InternalSchemaEqMatchExpression>(path(), _rhsElem); if (getTag()) { clone->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_fmod.h b/src/mongo/db/matcher/schema/expression_internal_schema_fmod.h index 201ec23f70e..5e99274e069 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_fmod.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_fmod.h @@ -43,7 +43,7 @@ public: std::unique_ptr<MatchExpression> shallowClone() const final { std::unique_ptr<InternalSchemaFmodMatchExpression> m = - stdx::make_unique<InternalSchemaFmodMatchExpression>(path(), _divisor, _remainder); + std::make_unique<InternalSchemaFmodMatchExpression>(path(), _divisor, _remainder); if (getTag()) { m->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_match_array_index.cpp b/src/mongo/db/matcher/schema/expression_internal_schema_match_array_index.cpp index f4264c5d1ef..6d5d2ed2ed5 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_match_array_index.cpp +++ b/src/mongo/db/matcher/schema/expression_internal_schema_match_array_index.cpp @@ -86,7 +86,7 @@ BSONObj InternalSchemaMatchArrayIndexMatchExpression::getSerializedRightHandSide std::unique_ptr<MatchExpression> InternalSchemaMatchArrayIndexMatchExpression::shallowClone() const { - auto clone = stdx::make_unique<InternalSchemaMatchArrayIndexMatchExpression>( + auto clone = std::make_unique<InternalSchemaMatchArrayIndexMatchExpression>( path(), _index, _expression->shallowClone()); if (getTag()) { clone->setTag(getTag()->clone()); diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_match_array_index.h b/src/mongo/db/matcher/schema/expression_internal_schema_match_array_index.h index 9a0bb8675b7..54682da09d4 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_match_array_index.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_match_array_index.h @@ -29,9 +29,10 @@ #pragma once +#include <memory> + #include "mongo/db/matcher/expression_array.h" #include "mongo/db/matcher/expression_with_placeholder.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_max_items.h b/src/mongo/db/matcher/schema/expression_internal_schema_max_items.h index 6edcde839c7..e133c67e02e 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_max_items.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_max_items.h @@ -50,7 +50,7 @@ public: std::unique_ptr<MatchExpression> shallowClone() const final { std::unique_ptr<InternalSchemaMaxItemsMatchExpression> maxItems = - stdx::make_unique<InternalSchemaMaxItemsMatchExpression>(path(), numItems()); + std::make_unique<InternalSchemaMaxItemsMatchExpression>(path(), numItems()); if (getTag()) { maxItems->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_max_length.h b/src/mongo/db/matcher/schema/expression_internal_schema_max_length.h index 69b524f18f4..342f958679b 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_max_length.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_max_length.h @@ -50,7 +50,7 @@ public: std::unique_ptr<MatchExpression> shallowClone() const final { std::unique_ptr<InternalSchemaMaxLengthMatchExpression> maxLen = - stdx::make_unique<InternalSchemaMaxLengthMatchExpression>(path(), strLen()); + std::make_unique<InternalSchemaMaxLengthMatchExpression>(path(), strLen()); if (getTag()) { maxLen->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_max_properties.h b/src/mongo/db/matcher/schema/expression_internal_schema_max_properties.h index 0aab4243248..3e5e05ea849 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_max_properties.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_max_properties.h @@ -60,7 +60,7 @@ public: virtual std::unique_ptr<MatchExpression> shallowClone() const final { auto maxProperties = - stdx::make_unique<InternalSchemaMaxPropertiesMatchExpression>(numProperties()); + std::make_unique<InternalSchemaMaxPropertiesMatchExpression>(numProperties()); if (getTag()) { maxProperties->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_min_items.h b/src/mongo/db/matcher/schema/expression_internal_schema_min_items.h index 68f0df7dfc6..2a5978d0326 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_min_items.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_min_items.h @@ -50,7 +50,7 @@ public: std::unique_ptr<MatchExpression> shallowClone() const final { std::unique_ptr<InternalSchemaMinItemsMatchExpression> minItems = - stdx::make_unique<InternalSchemaMinItemsMatchExpression>(path(), numItems()); + std::make_unique<InternalSchemaMinItemsMatchExpression>(path(), numItems()); if (getTag()) { minItems->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_min_length.h b/src/mongo/db/matcher/schema/expression_internal_schema_min_length.h index f3128007500..0c379a61b23 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_min_length.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_min_length.h @@ -50,7 +50,7 @@ public: std::unique_ptr<MatchExpression> shallowClone() const final { std::unique_ptr<InternalSchemaMinLengthMatchExpression> minLen = - stdx::make_unique<InternalSchemaMinLengthMatchExpression>(path(), strLen()); + std::make_unique<InternalSchemaMinLengthMatchExpression>(path(), strLen()); if (getTag()) { minLen->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_min_properties.h b/src/mongo/db/matcher/schema/expression_internal_schema_min_properties.h index f05f1cef785..0e9741a281f 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_min_properties.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_min_properties.h @@ -60,7 +60,7 @@ public: virtual std::unique_ptr<MatchExpression> shallowClone() const final { auto minProperties = - stdx::make_unique<InternalSchemaMinPropertiesMatchExpression>(numProperties()); + std::make_unique<InternalSchemaMinPropertiesMatchExpression>(numProperties()); if (getTag()) { minProperties->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_object_match.cpp b/src/mongo/db/matcher/schema/expression_internal_schema_object_match.cpp index 36a921a4380..b6ca5118644 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_object_match.cpp +++ b/src/mongo/db/matcher/schema/expression_internal_schema_object_match.cpp @@ -76,7 +76,7 @@ bool InternalSchemaObjectMatchExpression::equivalent(const MatchExpression* othe std::unique_ptr<MatchExpression> InternalSchemaObjectMatchExpression::shallowClone() const { auto clone = - stdx::make_unique<InternalSchemaObjectMatchExpression>(path(), _sub->shallowClone()); + std::make_unique<InternalSchemaObjectMatchExpression>(path(), _sub->shallowClone()); if (getTag()) { clone->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_root_doc_eq.cpp b/src/mongo/db/matcher/schema/expression_internal_schema_root_doc_eq.cpp index 1b1fc6ae29f..24ba5b22afa 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_root_doc_eq.cpp +++ b/src/mongo/db/matcher/schema/expression_internal_schema_root_doc_eq.cpp @@ -70,7 +70,7 @@ bool InternalSchemaRootDocEqMatchExpression::equivalent(const MatchExpression* o } std::unique_ptr<MatchExpression> InternalSchemaRootDocEqMatchExpression::shallowClone() const { - auto clone = stdx::make_unique<InternalSchemaRootDocEqMatchExpression>(_rhsObj.copy()); + auto clone = std::make_unique<InternalSchemaRootDocEqMatchExpression>(_rhsObj.copy()); if (getTag()) { clone->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_unique_items.cpp b/src/mongo/db/matcher/schema/expression_internal_schema_unique_items.cpp index afb0a39cbe4..6d132badf27 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_unique_items.cpp +++ b/src/mongo/db/matcher/schema/expression_internal_schema_unique_items.cpp @@ -66,7 +66,7 @@ BSONObj InternalSchemaUniqueItemsMatchExpression::getSerializedRightHandSide() c } std::unique_ptr<MatchExpression> InternalSchemaUniqueItemsMatchExpression::shallowClone() const { - auto clone = stdx::make_unique<InternalSchemaUniqueItemsMatchExpression>(path()); + auto clone = std::make_unique<InternalSchemaUniqueItemsMatchExpression>(path()); if (getTag()) { clone->setTag(getTag()->clone()); } diff --git a/src/mongo/db/matcher/schema/expression_internal_schema_xor.h b/src/mongo/db/matcher/schema/expression_internal_schema_xor.h index b11d1641a33..9aebb07d68d 100644 --- a/src/mongo/db/matcher/schema/expression_internal_schema_xor.h +++ b/src/mongo/db/matcher/schema/expression_internal_schema_xor.h @@ -48,7 +48,7 @@ public: bool matchesSingleElement(const BSONElement&, MatchDetails* details = nullptr) const final; virtual std::unique_ptr<MatchExpression> shallowClone() const { - auto xorCopy = stdx::make_unique<InternalSchemaXorMatchExpression>(); + auto xorCopy = std::make_unique<InternalSchemaXorMatchExpression>(); for (size_t i = 0; i < numChildren(); ++i) { xorCopy->add(getChild(i)->shallowClone().release()); } diff --git a/src/mongo/db/matcher/schema/json_schema_parser.cpp b/src/mongo/db/matcher/schema/json_schema_parser.cpp index 6f0d6e6c947..cd1ac4a4e47 100644 --- a/src/mongo/db/matcher/schema/json_schema_parser.cpp +++ b/src/mongo/db/matcher/schema/json_schema_parser.cpp @@ -33,6 +33,8 @@ #include "mongo/db/matcher/schema/json_schema_parser.h" +#include <memory> + #include "mongo/bson/bsontypes.h" #include "mongo/bson/unordered_fields_bsonelement_comparator.h" #include "mongo/db/commands/feature_compatibility_version_documentation.h" @@ -58,7 +60,6 @@ #include "mongo/db/matcher/schema/expression_internal_schema_xor.h" #include "mongo/db/matcher/schema/json_pointer.h" #include "mongo/logger/log_component_settings.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/string_map.h" @@ -123,7 +124,7 @@ std::unique_ptr<MatchExpression> makeRestriction(const MatcherTypeSet& restricti } else { // This restriction doesn't take any effect, since the type of the schema is different // from the type to which this retriction applies. - return stdx::make_unique<AlwaysTrueMatchExpression>(); + return std::make_unique<AlwaysTrueMatchExpression>(); } } @@ -133,11 +134,11 @@ std::unique_ptr<MatchExpression> makeRestriction(const MatcherTypeSet& restricti // // We need to do this because restriction keywords do not apply when a field is either not // present or of a different type. - auto typeExpr = stdx::make_unique<InternalSchemaTypeExpression>(path, restrictionType); + auto typeExpr = std::make_unique<InternalSchemaTypeExpression>(path, restrictionType); - auto notExpr = stdx::make_unique<NotMatchExpression>(typeExpr.release()); + auto notExpr = std::make_unique<NotMatchExpression>(typeExpr.release()); - auto orExpr = stdx::make_unique<OrMatchExpression>(); + auto orExpr = std::make_unique<OrMatchExpression>(); orExpr->add(notExpr.release()); orExpr->add(restrictionExpr.release()); @@ -162,7 +163,7 @@ StatusWith<std::unique_ptr<InternalSchemaTypeExpression>> parseType( } auto typeExpr = - stdx::make_unique<InternalSchemaTypeExpression>(path, std::move(typeSet.getValue())); + std::make_unique<InternalSchemaTypeExpression>(path, std::move(typeSet.getValue())); return {std::move(typeExpr)}; } @@ -180,14 +181,14 @@ StatusWithMatchExpression parseMaximum(StringData path, if (path.empty()) { // This restriction has no effect in a top-level schema, since we only store objects. - return {stdx::make_unique<AlwaysTrueMatchExpression>()}; + return {std::make_unique<AlwaysTrueMatchExpression>()}; } std::unique_ptr<ComparisonMatchExpression> expr; if (isExclusiveMaximum) { - expr = stdx::make_unique<LTMatchExpression>(path, maximum); + expr = std::make_unique<LTMatchExpression>(path, maximum); } else { - expr = stdx::make_unique<LTEMatchExpression>(path, maximum); + expr = std::make_unique<LTEMatchExpression>(path, maximum); } MatcherTypeSet restrictionType; @@ -208,14 +209,14 @@ StatusWithMatchExpression parseMinimum(StringData path, if (path.empty()) { // This restriction has no effect in a top-level schema, since we only store objects. - return {stdx::make_unique<AlwaysTrueMatchExpression>()}; + return {std::make_unique<AlwaysTrueMatchExpression>()}; } std::unique_ptr<ComparisonMatchExpression> expr; if (isExclusiveMinimum) { - expr = stdx::make_unique<GTMatchExpression>(path, minimum); + expr = std::make_unique<GTMatchExpression>(path, minimum); } else { - expr = stdx::make_unique<GTEMatchExpression>(path, minimum); + expr = std::make_unique<GTEMatchExpression>(path, minimum); } MatcherTypeSet restrictionType; @@ -237,10 +238,10 @@ StatusWithMatchExpression parseLength(StringData path, } if (path.empty()) { - return {stdx::make_unique<AlwaysTrueMatchExpression>()}; + return {std::make_unique<AlwaysTrueMatchExpression>()}; } - auto expr = stdx::make_unique<T>(path, parsedLength.getValue()); + auto expr = std::make_unique<T>(path, parsedLength.getValue()); return makeRestriction(restrictionType, path, std::move(expr), typeExpr); } @@ -255,13 +256,12 @@ StatusWithMatchExpression parsePattern(StringData path, } if (path.empty()) { - return {stdx::make_unique<AlwaysTrueMatchExpression>()}; + return {std::make_unique<AlwaysTrueMatchExpression>()}; } // JSON Schema does not allow regex flags to be specified. constexpr auto emptyFlags = ""; - auto expr = - stdx::make_unique<RegexMatchExpression>(path, pattern.valueStringData(), emptyFlags); + auto expr = std::make_unique<RegexMatchExpression>(path, pattern.valueStringData(), emptyFlags); return makeRestriction(BSONType::String, path, std::move(expr), typeExpr); } @@ -283,10 +283,10 @@ StatusWithMatchExpression parseMultipleOf(StringData path, << "' must have a positive value")}; } if (path.empty()) { - return {stdx::make_unique<AlwaysTrueMatchExpression>()}; + return {std::make_unique<AlwaysTrueMatchExpression>()}; } - auto expr = stdx::make_unique<InternalSchemaFmodMatchExpression>( + auto expr = std::make_unique<InternalSchemaFmodMatchExpression>( path, multipleOf.numberDecimal(), Decimal128(0)); MatcherTypeSet restrictionType; @@ -312,7 +312,7 @@ StatusWithMatchExpression parseLogicalKeyword(const boost::intrusive_ptr<Express << "' must be a non-empty array"}; } - std::unique_ptr<T> listOfExpr = stdx::make_unique<T>(); + std::unique_ptr<T> listOfExpr = std::make_unique<T>(); for (const auto& elem : logicalElementObj) { if (elem.type() != BSONType::Object) { return {ErrorCodes::TypeMismatch, @@ -347,7 +347,7 @@ StatusWithMatchExpression parseEnum(StringData path, BSONElement enumElement) { << "' cannot be an empty array"}; } - auto orExpr = stdx::make_unique<OrMatchExpression>(); + auto orExpr = std::make_unique<OrMatchExpression>(); UnorderedFieldsBSONElementComparator eltComp; BSONEltSet eqSet = eltComp.makeBSONEltSet(); for (auto&& arrayElem : enumArray) { @@ -363,12 +363,12 @@ StatusWithMatchExpression parseEnum(StringData path, BSONElement enumElement) { // Top-level non-object enum values can be safely ignored, since MongoDB only stores // objects, not scalars or arrays. if (arrayElem.type() == BSONType::Object) { - auto rootDocEq = stdx::make_unique<InternalSchemaRootDocEqMatchExpression>( + auto rootDocEq = std::make_unique<InternalSchemaRootDocEqMatchExpression>( arrayElem.embeddedObject()); orExpr->add(rootDocEq.release()); } } else { - auto eqExpr = stdx::make_unique<InternalSchemaEqMatchExpression>(path, arrayElem); + auto eqExpr = std::make_unique<InternalSchemaEqMatchExpression>(path, arrayElem); orExpr->add(eqExpr.release()); } @@ -376,7 +376,7 @@ StatusWithMatchExpression parseEnum(StringData path, BSONElement enumElement) { // Make sure that the OR expression has at least 1 child. if (orExpr->numChildren() == 0) { - return {stdx::make_unique<AlwaysFalseMatchExpression>()}; + return {std::make_unique<AlwaysFalseMatchExpression>()}; } return {std::move(orExpr)}; @@ -430,7 +430,7 @@ StatusWith<StringDataSet> parseRequired(BSONElement requiredElt) { StatusWithMatchExpression translateRequired(const StringDataSet& requiredProperties, StringData path, InternalSchemaTypeExpression* typeExpr) { - auto andExpr = stdx::make_unique<AndMatchExpression>(); + auto andExpr = std::make_unique<AndMatchExpression>(); std::vector<StringData> sortedProperties(requiredProperties.begin(), requiredProperties.end()); std::sort(sortedProperties.begin(), sortedProperties.end()); @@ -445,7 +445,7 @@ StatusWithMatchExpression translateRequired(const StringDataSet& requiredPropert } auto objectMatch = - stdx::make_unique<InternalSchemaObjectMatchExpression>(path, std::move(andExpr)); + std::make_unique<InternalSchemaObjectMatchExpression>(path, std::move(andExpr)); return makeRestriction(BSONType::Object, path, std::move(objectMatch), typeExpr); } @@ -464,7 +464,7 @@ StatusWithMatchExpression parseProperties(const boost::intrusive_ptr<ExpressionC } auto propertiesObj = propertiesElt.embeddedObject(); - auto andExpr = stdx::make_unique<AndMatchExpression>(); + auto andExpr = std::make_unique<AndMatchExpression>(); for (auto&& property : propertiesObj) { if (property.type() != BSONType::Object) { return {ErrorCodes::TypeMismatch, @@ -489,11 +489,11 @@ StatusWithMatchExpression parseProperties(const boost::intrusive_ptr<ExpressionC // This property either must not exist or must match the nested schema. Therefore, we // generate the match expression (OR (NOT (EXISTS)) <nestedSchemaMatch>). auto existsExpr = - stdx::make_unique<ExistsMatchExpression>(property.fieldNameStringData()); + std::make_unique<ExistsMatchExpression>(property.fieldNameStringData()); - auto notExpr = stdx::make_unique<NotMatchExpression>(existsExpr.release()); + auto notExpr = std::make_unique<NotMatchExpression>(existsExpr.release()); - auto orExpr = stdx::make_unique<OrMatchExpression>(); + auto orExpr = std::make_unique<OrMatchExpression>(); orExpr->add(notExpr.release()); orExpr->add(nestedSchemaMatch.getValue().release()); @@ -508,7 +508,7 @@ StatusWithMatchExpression parseProperties(const boost::intrusive_ptr<ExpressionC } auto objectMatch = - stdx::make_unique<InternalSchemaObjectMatchExpression>(path, std::move(andExpr)); + std::make_unique<InternalSchemaObjectMatchExpression>(path, std::move(andExpr)); return makeRestriction(BSONType::Object, path, std::move(objectMatch), typeExpr); } @@ -547,7 +547,7 @@ StatusWith<std::vector<PatternSchema>> parsePatternProperties( return nestedSchemaMatch.getStatus(); } - auto exprWithPlaceholder = stdx::make_unique<ExpressionWithPlaceholder>( + auto exprWithPlaceholder = std::make_unique<ExpressionWithPlaceholder>( kNamePlaceholder.toString(), std::move(nestedSchemaMatch.getValue())); Pattern pattern{patternSchema.fieldNameStringData()}; patternProperties.emplace_back(std::move(pattern), std::move(exprWithPlaceholder)); @@ -563,7 +563,7 @@ StatusWithMatchExpression parseAdditionalProperties( if (!additionalPropertiesElt) { // The absence of the 'additionalProperties' keyword is identical in meaning to the presence // of 'additionalProperties' with a value of true. - return {stdx::make_unique<AlwaysTrueMatchExpression>()}; + return {std::make_unique<AlwaysTrueMatchExpression>()}; } if (additionalPropertiesElt.type() != BSONType::Bool && @@ -576,9 +576,9 @@ StatusWithMatchExpression parseAdditionalProperties( if (additionalPropertiesElt.type() == BSONType::Bool) { if (additionalPropertiesElt.boolean()) { - return {stdx::make_unique<AlwaysTrueMatchExpression>()}; + return {std::make_unique<AlwaysTrueMatchExpression>()}; } else { - return {stdx::make_unique<AlwaysFalseMatchExpression>()}; + return {std::make_unique<AlwaysFalseMatchExpression>()}; } } @@ -626,10 +626,10 @@ StatusWithMatchExpression parseAllowedProperties( if (!otherwiseExpr.isOK()) { return otherwiseExpr.getStatus(); } - auto otherwiseWithPlaceholder = stdx::make_unique<ExpressionWithPlaceholder>( + auto otherwiseWithPlaceholder = std::make_unique<ExpressionWithPlaceholder>( kNamePlaceholder.toString(), std::move(otherwiseExpr.getValue())); - auto allowedPropertiesExpr = stdx::make_unique<InternalSchemaAllowedPropertiesMatchExpression>( + auto allowedPropertiesExpr = std::make_unique<InternalSchemaAllowedPropertiesMatchExpression>( std::move(propertyNames), kNamePlaceholder, std::move(patternProperties.getValue()), @@ -641,7 +641,7 @@ StatusWithMatchExpression parseAllowedProperties( return {std::move(allowedPropertiesExpr)}; } - auto objectMatch = stdx::make_unique<InternalSchemaObjectMatchExpression>( + auto objectMatch = std::make_unique<InternalSchemaObjectMatchExpression>( path, std::move(allowedPropertiesExpr)); return makeRestriction(BSONType::Object, path, std::move(objectMatch), typeExpr); @@ -659,28 +659,27 @@ StatusWithMatchExpression parseNumProperties(StringData path, return parsedNumProps.getStatus(); } - auto expr = stdx::make_unique<T>(parsedNumProps.getValue()); + auto expr = std::make_unique<T>(parsedNumProps.getValue()); if (path.empty()) { // This is a top-level schema. return {std::move(expr)}; } - auto objectMatch = - stdx::make_unique<InternalSchemaObjectMatchExpression>(path, std::move(expr)); + auto objectMatch = std::make_unique<InternalSchemaObjectMatchExpression>(path, std::move(expr)); return makeRestriction(BSONType::Object, path, std::move(objectMatch), typeExpr); } StatusWithMatchExpression makeDependencyExistsClause(StringData path, StringData dependencyName) { - auto existsExpr = stdx::make_unique<ExistsMatchExpression>(dependencyName); + auto existsExpr = std::make_unique<ExistsMatchExpression>(dependencyName); if (path.empty()) { return {std::move(existsExpr)}; } auto objectMatch = - stdx::make_unique<InternalSchemaObjectMatchExpression>(path, std::move(existsExpr)); + std::make_unique<InternalSchemaObjectMatchExpression>(path, std::move(existsExpr)); return {std::move(objectMatch)}; } @@ -706,9 +705,9 @@ StatusWithMatchExpression translateSchemaDependency( std::array<std::unique_ptr<MatchExpression>, 3> expressions = { std::move(ifClause.getValue()), std::move(nestedSchemaMatch.getValue()), - stdx::make_unique<AlwaysTrueMatchExpression>()}; + std::make_unique<AlwaysTrueMatchExpression>()}; - auto condExpr = stdx::make_unique<InternalSchemaCondMatchExpression>(std::move(expressions)); + auto condExpr = std::make_unique<InternalSchemaCondMatchExpression>(std::move(expressions)); return {std::move(condExpr)}; } @@ -723,7 +722,7 @@ StatusWithMatchExpression translatePropertyDependency(StringData path, BSONEleme << "' cannot be an empty array"}; } - auto propertyDependencyExpr = stdx::make_unique<AndMatchExpression>(); + auto propertyDependencyExpr = std::make_unique<AndMatchExpression>(); std::set<StringData> propertyDependencyNames; for (auto&& propertyDependency : dependency.embeddedObject()) { if (propertyDependency.type() != BSONType::String) { @@ -762,9 +761,9 @@ StatusWithMatchExpression translatePropertyDependency(StringData path, BSONEleme std::array<std::unique_ptr<MatchExpression>, 3> expressions = { {std::move(ifClause.getValue()), std::move(propertyDependencyExpr), - stdx::make_unique<AlwaysTrueMatchExpression>()}}; + std::make_unique<AlwaysTrueMatchExpression>()}}; - auto condExpr = stdx::make_unique<InternalSchemaCondMatchExpression>(std::move(expressions)); + auto condExpr = std::make_unique<InternalSchemaCondMatchExpression>(std::move(expressions)); return {std::move(condExpr)}; } @@ -779,7 +778,7 @@ StatusWithMatchExpression parseDependencies(const boost::intrusive_ptr<Expressio << "' must be an object"}; } - auto andExpr = stdx::make_unique<AndMatchExpression>(); + auto andExpr = std::make_unique<AndMatchExpression>(); for (auto&& dependency : dependencies.embeddedObject()) { if (dependency.type() != BSONType::Object && dependency.type() != BSONType::Array) { return {ErrorCodes::TypeMismatch, @@ -811,13 +810,13 @@ StatusWithMatchExpression parseUniqueItems(BSONElement uniqueItemsElt, << JSONSchemaParser::kSchemaUniqueItemsKeyword << "' must be a boolean"}; } else if (path.empty()) { - return {stdx::make_unique<AlwaysTrueMatchExpression>()}; + return {std::make_unique<AlwaysTrueMatchExpression>()}; } else if (uniqueItemsElt.boolean()) { - auto uniqueItemsExpr = stdx::make_unique<InternalSchemaUniqueItemsMatchExpression>(path); + auto uniqueItemsExpr = std::make_unique<InternalSchemaUniqueItemsMatchExpression>(path); return makeRestriction(BSONType::Array, path, std::move(uniqueItemsExpr), typeExpr); } - return {stdx::make_unique<AlwaysTrueMatchExpression>()}; + return {std::make_unique<AlwaysTrueMatchExpression>()}; } /** @@ -835,7 +834,7 @@ StatusWith<boost::optional<long long>> parseItems( if (itemsElt.type() == BSONType::Array) { // When "items" is an array, generate match expressions for each subschema for each position // in the array, which are bundled together in an AndMatchExpression. - auto andExprForSubschemas = stdx::make_unique<AndMatchExpression>(); + auto andExprForSubschemas = std::make_unique<AndMatchExpression>(); auto index = 0LL; for (auto subschema : itemsElt.embeddedObject()) { if (subschema.type() != BSONType::Object) { @@ -854,9 +853,9 @@ StatusWith<boost::optional<long long>> parseItems( if (!parsedSubschema.isOK()) { return parsedSubschema.getStatus(); } - auto exprWithPlaceholder = stdx::make_unique<ExpressionWithPlaceholder>( + auto exprWithPlaceholder = std::make_unique<ExpressionWithPlaceholder>( kNamePlaceholder.toString(), std::move(parsedSubschema.getValue())); - auto matchArrayIndex = stdx::make_unique<InternalSchemaMatchArrayIndexMatchExpression>( + auto matchArrayIndex = std::make_unique<InternalSchemaMatchArrayIndexMatchExpression>( path, index, std::move(exprWithPlaceholder)); andExprForSubschemas->add(matchArrayIndex.release()); ++index; @@ -864,7 +863,7 @@ StatusWith<boost::optional<long long>> parseItems( startIndexForAdditionalItems = index; if (path.empty()) { - andExpr->add(stdx::make_unique<AlwaysTrueMatchExpression>().release()); + andExpr->add(std::make_unique<AlwaysTrueMatchExpression>().release()); } else { andExpr->add( makeRestriction(BSONType::Array, path, std::move(andExprForSubschemas), typeExpr) @@ -879,15 +878,15 @@ StatusWith<boost::optional<long long>> parseItems( if (!nestedItemsSchema.isOK()) { return nestedItemsSchema.getStatus(); } - auto exprWithPlaceholder = stdx::make_unique<ExpressionWithPlaceholder>( + auto exprWithPlaceholder = std::make_unique<ExpressionWithPlaceholder>( kNamePlaceholder.toString(), std::move(nestedItemsSchema.getValue())); if (path.empty()) { - andExpr->add(stdx::make_unique<AlwaysTrueMatchExpression>().release()); + andExpr->add(std::make_unique<AlwaysTrueMatchExpression>().release()); } else { constexpr auto startIndexForItems = 0LL; auto allElemMatch = - stdx::make_unique<InternalSchemaAllElemMatchFromIndexMatchExpression>( + std::make_unique<InternalSchemaAllElemMatchFromIndexMatchExpression>( path, startIndexForItems, std::move(exprWithPlaceholder)); andExpr->add(makeRestriction(BSONType::Array, path, std::move(allElemMatch), typeExpr) .release()); @@ -913,11 +912,11 @@ Status parseAdditionalItems(const boost::intrusive_ptr<ExpressionContext>& expCt if (additionalItemsElt.type() == BSONType::Bool) { const auto emptyPlaceholder = boost::none; if (additionalItemsElt.boolean()) { - otherwiseExpr = stdx::make_unique<ExpressionWithPlaceholder>( - emptyPlaceholder, stdx::make_unique<AlwaysTrueMatchExpression>()); + otherwiseExpr = std::make_unique<ExpressionWithPlaceholder>( + emptyPlaceholder, std::make_unique<AlwaysTrueMatchExpression>()); } else { - otherwiseExpr = stdx::make_unique<ExpressionWithPlaceholder>( - emptyPlaceholder, stdx::make_unique<AlwaysFalseMatchExpression>()); + otherwiseExpr = std::make_unique<ExpressionWithPlaceholder>( + emptyPlaceholder, std::make_unique<AlwaysFalseMatchExpression>()); } } else if (additionalItemsElt.type() == BSONType::Object) { auto parsedOtherwiseExpr = _parse( @@ -925,7 +924,7 @@ Status parseAdditionalItems(const boost::intrusive_ptr<ExpressionContext>& expCt if (!parsedOtherwiseExpr.isOK()) { return parsedOtherwiseExpr.getStatus(); } - otherwiseExpr = stdx::make_unique<ExpressionWithPlaceholder>( + otherwiseExpr = std::make_unique<ExpressionWithPlaceholder>( kNamePlaceholder.toString(), std::move(parsedOtherwiseExpr.getValue())); } else { return {ErrorCodes::TypeMismatch, @@ -938,10 +937,10 @@ Status parseAdditionalItems(const boost::intrusive_ptr<ExpressionContext>& expCt // Only generate a match expression if needed. if (startIndexForAdditionalItems) { if (path.empty()) { - andExpr->add(stdx::make_unique<AlwaysTrueMatchExpression>().release()); + andExpr->add(std::make_unique<AlwaysTrueMatchExpression>().release()); } else { auto allElemMatch = - stdx::make_unique<InternalSchemaAllElemMatchFromIndexMatchExpression>( + std::make_unique<InternalSchemaAllElemMatchFromIndexMatchExpression>( path, *startIndexForAdditionalItems, std::move(otherwiseExpr)); andExpr->add(makeRestriction(BSONType::Array, path, std::move(allElemMatch), typeExpr) .release()); @@ -1033,7 +1032,7 @@ Status translateLogicalKeywords(StringMap<BSONElement>& keywordMap, return parsedExpr.getStatus(); } - auto notMatchExpr = stdx::make_unique<NotMatchExpression>(parsedExpr.getValue().release()); + auto notMatchExpr = std::make_unique<NotMatchExpression>(parsedExpr.getValue().release()); andExpr->add(notMatchExpr.release()); } @@ -1525,11 +1524,11 @@ StatusWithMatchExpression _parse(const boost::intrusive_ptr<ExpressionContext>& } else if (encryptElem) { // The presence of the encrypt keyword implies the restriction that the field must be // of type BinData. - typeExpr = stdx::make_unique<InternalSchemaTypeExpression>( - path, MatcherTypeSet(BSONType::BinData)); + typeExpr = + std::make_unique<InternalSchemaTypeExpression>(path, MatcherTypeSet(BSONType::BinData)); } - auto andExpr = stdx::make_unique<AndMatchExpression>(); + auto andExpr = std::make_unique<AndMatchExpression>(); auto translationStatus = translateScalarKeywords(keywordMap, path, typeExpr.get(), andExpr.get()); @@ -1563,7 +1562,7 @@ StatusWithMatchExpression _parse(const boost::intrusive_ptr<ExpressionContext>& if (path.empty() && typeExpr && !typeExpr->typeSet().hasType(BSONType::Object)) { // This is a top-level schema which requires that the type is something other than // "object". Since we only know how to store objects, this schema matches nothing. - return {stdx::make_unique<AlwaysFalseMatchExpression>()}; + return {std::make_unique<AlwaysFalseMatchExpression>()}; } if (!path.empty() && typeExpr) { diff --git a/src/mongo/db/op_observer_impl_test.cpp b/src/mongo/db/op_observer_impl_test.cpp index 3fd8661a42c..d75ec6032cd 100644 --- a/src/mongo/db/op_observer_impl_test.cpp +++ b/src/mongo/db/op_observer_impl_test.cpp @@ -65,12 +65,12 @@ public: auto service = getServiceContext(); auto opCtx = cc().makeOperationContext(); - repl::StorageInterface::set(service, stdx::make_unique<repl::StorageInterfaceMock>()); + repl::StorageInterface::set(service, std::make_unique<repl::StorageInterfaceMock>()); // Set up ReplicationCoordinator and create oplog. repl::ReplicationCoordinator::set( service, - stdx::make_unique<repl::ReplicationCoordinatorMock>(service, createReplSettings())); + std::make_unique<repl::ReplicationCoordinatorMock>(service, createReplSettings())); repl::setOplogCollectionName(service); repl::createOplog(opCtx.get()); @@ -520,7 +520,7 @@ TEST_F(OpObserverTest, MultipleAboutToDeleteAndOnDelete) { DEATH_TEST_F(OpObserverTest, AboutToDeleteMustPreceedOnDelete, "invariant") { OpObserverImpl opObserver; auto opCtx = cc().makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerNoop>()); + opCtx->swapLockState(std::make_unique<LockerNoop>()); NamespaceString nss = {"test", "coll"}; opObserver.onDelete(opCtx.get(), nss, {}, {}, false, {}); } @@ -528,7 +528,7 @@ DEATH_TEST_F(OpObserverTest, AboutToDeleteMustPreceedOnDelete, "invariant") { DEATH_TEST_F(OpObserverTest, EachOnDeleteRequiresAboutToDelete, "invariant") { OpObserverImpl opObserver; auto opCtx = cc().makeOperationContext(); - opCtx->swapLockState(stdx::make_unique<LockerNoop>()); + opCtx->swapLockState(std::make_unique<LockerNoop>()); NamespaceString nss = {"test", "coll"}; opObserver.aboutToDelete(opCtx.get(), nss, {}); opObserver.onDelete(opCtx.get(), nss, {}, {}, false, {}); diff --git a/src/mongo/db/op_observer_registry_test.cpp b/src/mongo/db/op_observer_registry_test.cpp index b77de91b116..14be2cbfa8a 100644 --- a/src/mongo/db/op_observer_registry_test.cpp +++ b/src/mongo/db/op_observer_registry_test.cpp @@ -100,8 +100,8 @@ struct ThrowingObserver : public TestObserver { struct OpObserverRegistryTest : public unittest::Test { NamespaceString testNss = {"test", "coll"}; - std::unique_ptr<TestObserver> unique1 = stdx::make_unique<TestObserver>(); - std::unique_ptr<TestObserver> unique2 = stdx::make_unique<TestObserver>(); + std::unique_ptr<TestObserver> unique1 = std::make_unique<TestObserver>(); + std::unique_ptr<TestObserver> unique2 = std::make_unique<TestObserver>(); TestObserver* observer1 = unique1.get(); TestObserver* observer2 = unique2.get(); OpObserverRegistry registry; @@ -149,7 +149,7 @@ TEST_F(OpObserverRegistryTest, TwoObservers) { TEST_F(OpObserverRegistryTest, ThrowingObserver1) { OperationContextNoop opCtx; - unique1 = stdx::make_unique<ThrowingObserver>(); + unique1 = std::make_unique<ThrowingObserver>(); observer1 = unique1.get(); registry.addObserver(std::move(unique1)); registry.addObserver(std::move(unique2)); @@ -160,7 +160,7 @@ TEST_F(OpObserverRegistryTest, ThrowingObserver1) { TEST_F(OpObserverRegistryTest, ThrowingObserver2) { OperationContextNoop opCtx; - unique2 = stdx::make_unique<ThrowingObserver>(); + unique2 = std::make_unique<ThrowingObserver>(); observer2 = unique1.get(); registry.addObserver(std::move(unique1)); registry.addObserver(std::move(unique2)); diff --git a/src/mongo/db/operation_context_test.cpp b/src/mongo/db/operation_context_test.cpp index 81a24cb65e9..43b4a51df5d 100644 --- a/src/mongo/db/operation_context_test.cpp +++ b/src/mongo/db/operation_context_test.cpp @@ -30,6 +30,7 @@ #include "mongo/platform/basic.h" #include <boost/optional.hpp> +#include <memory> #include "mongo/db/client.h" #include "mongo/db/json.h" @@ -38,7 +39,6 @@ #include "mongo/db/operation_context_group.h" #include "mongo/db/service_context.h" #include "mongo/stdx/future.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/unittest/barrier.h" #include "mongo/unittest/death_test.h" @@ -247,9 +247,9 @@ class OperationDeadlineTests : public unittest::Test { public: void setUp() { service = ServiceContext::make(); - service->setFastClockSource(stdx::make_unique<SharedClockSourceAdapter>(mockClock)); - service->setPreciseClockSource(stdx::make_unique<SharedClockSourceAdapter>(mockClock)); - service->setTickSource(stdx::make_unique<TickSourceMock<>>()); + service->setFastClockSource(std::make_unique<SharedClockSourceAdapter>(mockClock)); + service->setPreciseClockSource(std::make_unique<SharedClockSourceAdapter>(mockClock)); + service->setTickSource(std::make_unique<TickSourceMock<>>()); client = service->makeClient("OperationDeadlineTest"); } diff --git a/src/mongo/db/ops/parsed_delete.cpp b/src/mongo/db/ops/parsed_delete.cpp index c0b757fe69e..63262fac82d 100644 --- a/src/mongo/db/ops/parsed_delete.cpp +++ b/src/mongo/db/ops/parsed_delete.cpp @@ -74,7 +74,7 @@ Status ParsedDelete::parseQueryToCQ() { // The projection needs to be applied after the delete operation, so we do not specify a // projection during canonicalization. - auto qr = stdx::make_unique<QueryRequest>(_request->getNamespaceString()); + auto qr = std::make_unique<QueryRequest>(_request->getNamespaceString()); qr->setFilter(_request->getQuery()); qr->setSort(_request->getSort()); qr->setCollation(_request->getCollation()); diff --git a/src/mongo/db/ops/parsed_update.cpp b/src/mongo/db/ops/parsed_update.cpp index 67215128ce0..c2e355e945a 100644 --- a/src/mongo/db/ops/parsed_update.cpp +++ b/src/mongo/db/ops/parsed_update.cpp @@ -99,7 +99,7 @@ Status ParsedUpdate::parseQueryToCQ() { // The projection needs to be applied after the update operation, so we do not specify a // projection during canonicalization. - auto qr = stdx::make_unique<QueryRequest>(_request->getNamespaceString()); + auto qr = std::make_unique<QueryRequest>(_request->getNamespaceString()); qr->setFilter(_request->getQuery()); qr->setSort(_request->getSort()); qr->setCollation(_request->getCollation()); diff --git a/src/mongo/db/ops/write_ops_exec.cpp b/src/mongo/db/ops/write_ops_exec.cpp index 79b519779c8..8b026bdcca0 100644 --- a/src/mongo/db/ops/write_ops_exec.cpp +++ b/src/mongo/db/ops/write_ops_exec.cpp @@ -76,7 +76,6 @@ #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/s/cannot_implicitly_create_collection_info.h" #include "mongo/s/would_change_owning_shard_exception.h" -#include "mongo/stdx/memory.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/log.h" #include "mongo/util/log_and_backoff.h" diff --git a/src/mongo/db/pipeline/accumulator_test.cpp b/src/mongo/db/pipeline/accumulator_test.cpp index af727e21df7..4f56047ee11 100644 --- a/src/mongo/db/pipeline/accumulator_test.cpp +++ b/src/mongo/db/pipeline/accumulator_test.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/pipeline/accumulation_statement.h" #include "mongo/db/pipeline/accumulator.h" #include "mongo/db/pipeline/document.h" @@ -36,7 +38,6 @@ #include "mongo/db/pipeline/expression_context_for_test.h" #include "mongo/db/query/collation/collator_interface_mock.h" #include "mongo/dbtests/dbtests.h" -#include "mongo/stdx/memory.h" namespace AccumulatorTests { diff --git a/src/mongo/db/pipeline/aggregation_context_fixture.h b/src/mongo/db/pipeline/aggregation_context_fixture.h index 46771fe3836..58a947117cc 100644 --- a/src/mongo/db/pipeline/aggregation_context_fixture.h +++ b/src/mongo/db/pipeline/aggregation_context_fixture.h @@ -34,7 +34,6 @@ #include "mongo/db/pipeline/expression_context_for_test.h" #include "mongo/db/service_context_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/temp_dir.h" #include "mongo/unittest/unittest.h" diff --git a/src/mongo/db/pipeline/document_source_change_stream.h b/src/mongo/db/pipeline/document_source_change_stream.h index 29b6d59c8b7..e662072094c 100644 --- a/src/mongo/db/pipeline/document_source_change_stream.h +++ b/src/mongo/db/pipeline/document_source_change_stream.h @@ -48,7 +48,7 @@ public: public: static std::unique_ptr<LiteParsed> parse(const AggregationRequest& request, const BSONElement& spec) { - return stdx::make_unique<LiteParsed>(request.getNamespaceString()); + return std::make_unique<LiteParsed>(request.getNamespaceString()); } explicit LiteParsed(NamespaceString nss) : _nss(std::move(nss)) {} diff --git a/src/mongo/db/pipeline/document_source_change_stream_test.cpp b/src/mongo/db/pipeline/document_source_change_stream_test.cpp index 016d7132283..40a55a2c2f8 100644 --- a/src/mongo/db/pipeline/document_source_change_stream_test.cpp +++ b/src/mongo/db/pipeline/document_source_change_stream_test.cpp @@ -30,6 +30,7 @@ #include "mongo/platform/basic.h" #include <boost/intrusive_ptr.hpp> +#include <memory> #include <vector> #include "mongo/bson/bsonobj.h" @@ -54,7 +55,6 @@ #include "mongo/db/repl/oplog_entry.h" #include "mongo/db/repl/replication_coordinator_mock.h" #include "mongo/db/transaction_history_iterator.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" #include "mongo/util/uuid.h" @@ -116,7 +116,7 @@ struct MockMongoInterface final : public StubMongoProcessInterface { // For tests of transactions that involve multiple oplog entries. std::unique_ptr<TransactionHistoryIteratorBase> createTransactionHistoryIterator( repl::OpTime time) const { - auto iterator = stdx::make_unique<MockTransactionHistoryIterator>(); + auto iterator = std::make_unique<MockTransactionHistoryIterator>(); // Simulate a lookup on the oplog timestamp by manually advancing the iterator until we // reach the desired timestamp. @@ -161,7 +161,7 @@ public: explicit ChangeStreamStageTest(NamespaceString nsString) : ChangeStreamStageTestNoSetup(nsString) { repl::ReplicationCoordinator::set(getExpCtx()->opCtx->getServiceContext(), - stdx::make_unique<repl::ReplicationCoordinatorMock>( + std::make_unique<repl::ReplicationCoordinatorMock>( getExpCtx()->opCtx->getServiceContext())); } @@ -175,7 +175,7 @@ public: auto closeCursor = stages.back(); getExpCtx()->mongoProcessInterface = - stdx::make_unique<MockMongoInterface>(docKeyFields, transactionEntries); + std::make_unique<MockMongoInterface>(docKeyFields, transactionEntries); auto next = closeCursor->getNext(); // Match stage should pass the doc down if expectedDoc is given. @@ -202,7 +202,7 @@ public: DSChangeStream::createFromBson(spec.firstElement(), getExpCtx()); vector<intrusive_ptr<DocumentSource>> stages(std::begin(result), std::end(result)); getExpCtx()->mongoProcessInterface = - stdx::make_unique<MockMongoInterface>(std::vector<FieldPath>{}); + std::make_unique<MockMongoInterface>(std::vector<FieldPath>{}); // This match stage is a DocumentSourceOplogMatch, which we explicitly disallow from // executing as a safety mechanism, since it needs to use the collection-default collation, @@ -1120,7 +1120,7 @@ TEST_F(ChangeStreamStageTest, TransactionWithMultipleOplogEntries) { invariant(dynamic_cast<DocumentSourceChangeStreamTransform*>(transform) != nullptr); // Populate the MockTransactionHistoryEditor in reverse chronological order. - getExpCtx()->mongoProcessInterface = stdx::make_unique<MockMongoInterface>( + getExpCtx()->mongoProcessInterface = std::make_unique<MockMongoInterface>( std::vector<FieldPath>{}, std::vector<repl::OplogEntry>{transactionEntry2, transactionEntry1}); @@ -1249,7 +1249,7 @@ TEST_F(ChangeStreamStageTest, PreparedTransactionWithMultipleOplogEntries) { invariant(dynamic_cast<DocumentSourceChangeStreamTransform*>(transform) != nullptr); // Populate the MockTransactionHistoryEditor in reverse chronological order. - getExpCtx()->mongoProcessInterface = stdx::make_unique<MockMongoInterface>( + getExpCtx()->mongoProcessInterface = std::make_unique<MockMongoInterface>( std::vector<FieldPath>{}, std::vector<repl::OplogEntry>{commitEntry, transactionEntry2, transactionEntry1}); diff --git a/src/mongo/db/pipeline/document_source_check_resume_token_test.cpp b/src/mongo/db/pipeline/document_source_check_resume_token_test.cpp index 85d424b3bdd..f3e0fb0d768 100644 --- a/src/mongo/db/pipeline/document_source_check_resume_token_test.cpp +++ b/src/mongo/db/pipeline/document_source_check_resume_token_test.cpp @@ -44,7 +44,6 @@ #include "mongo/db/pipeline/stub_mongo_process_interface.h" #include "mongo/db/query/collation/collator_interface_mock.h" #include "mongo/db/service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" #include "mongo/util/uuid.h" diff --git a/src/mongo/db/pipeline/document_source_coll_stats.h b/src/mongo/db/pipeline/document_source_coll_stats.h index 9fd9fedf791..a950afb1813 100644 --- a/src/mongo/db/pipeline/document_source_coll_stats.h +++ b/src/mongo/db/pipeline/document_source_coll_stats.h @@ -43,7 +43,7 @@ public: public: static std::unique_ptr<LiteParsed> parse(const AggregationRequest& request, const BSONElement& spec) { - return stdx::make_unique<LiteParsed>(request.getNamespaceString()); + return std::make_unique<LiteParsed>(request.getNamespaceString()); } explicit LiteParsed(NamespaceString nss) : _nss(std::move(nss)) {} diff --git a/src/mongo/db/pipeline/document_source_current_op.cpp b/src/mongo/db/pipeline/document_source_current_op.cpp index 0010bd25ce3..134bb58145a 100644 --- a/src/mongo/db/pipeline/document_source_current_op.cpp +++ b/src/mongo/db/pipeline/document_source_current_op.cpp @@ -99,7 +99,7 @@ std::unique_ptr<DocumentSourceCurrentOp::LiteParsed> DocumentSourceCurrentOp::Li } } - return stdx::make_unique<DocumentSourceCurrentOp::LiteParsed>(allUsers, localOps); + return std::make_unique<DocumentSourceCurrentOp::LiteParsed>(allUsers, localOps); } diff --git a/src/mongo/db/pipeline/document_source_facet.cpp b/src/mongo/db/pipeline/document_source_facet.cpp index 6974dfc44f2..95214ab1560 100644 --- a/src/mongo/db/pipeline/document_source_facet.cpp +++ b/src/mongo/db/pipeline/document_source_facet.cpp @@ -45,7 +45,6 @@ #include "mongo/db/pipeline/pipeline.h" #include "mongo/db/pipeline/tee_buffer.h" #include "mongo/db/pipeline/value.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/str.h" @@ -142,8 +141,8 @@ std::unique_ptr<DocumentSourceFacet::LiteParsed> DocumentSourceFacet::LiteParsed pipeline.requiredPrivileges(unusedIsMongosFlag)); } - return stdx::make_unique<DocumentSourceFacet::LiteParsed>(std::move(liteParsedPipelines), - std::move(requiredPrivileges)); + return std::make_unique<DocumentSourceFacet::LiteParsed>(std::move(liteParsedPipelines), + std::move(requiredPrivileges)); } stdx::unordered_set<NamespaceString> DocumentSourceFacet::LiteParsed::getInvolvedNamespaces() diff --git a/src/mongo/db/pipeline/document_source_facet_test.cpp b/src/mongo/db/pipeline/document_source_facet_test.cpp index 7bc70618e1e..5e8668b7de9 100644 --- a/src/mongo/db/pipeline/document_source_facet_test.cpp +++ b/src/mongo/db/pipeline/document_source_facet_test.cpp @@ -556,7 +556,7 @@ TEST_F(DocumentSourceFacetTest, ShouldPropagateDetachingAndReattachingOfOpCtx) { auto ctx = getExpCtx(); // We're going to be changing the OperationContext, so we need to use a MongoProcessInterface // that won't throw when we do so. - ctx->mongoProcessInterface = stdx::make_unique<StubMongoProcessOkWithOpCtxChanges>(); + ctx->mongoProcessInterface = std::make_unique<StubMongoProcessOkWithOpCtxChanges>(); auto firstDummy = DocumentSourcePassthrough::create(); auto firstPipeline = unittest::assertGet(Pipeline::createFacetPipeline({firstDummy}, ctx)); diff --git a/src/mongo/db/pipeline/document_source_graph_lookup.cpp b/src/mongo/db/pipeline/document_source_graph_lookup.cpp index b2f349f1829..937da2a46cc 100644 --- a/src/mongo/db/pipeline/document_source_graph_lookup.cpp +++ b/src/mongo/db/pipeline/document_source_graph_lookup.cpp @@ -31,6 +31,8 @@ #include "mongo/db/pipeline/document_source_graph_lookup.h" +#include <memory> + #include "mongo/base/init.h" #include "mongo/db/bson/dotted_path_support.h" #include "mongo/db/jsobj.h" @@ -41,7 +43,6 @@ #include "mongo/db/pipeline/expression_context.h" #include "mongo/db/pipeline/value.h" #include "mongo/db/query/query_planner_common.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/db/pipeline/document_source_group.cpp b/src/mongo/db/pipeline/document_source_group.cpp index d8ce48bca13..dd14584ecc9 100644 --- a/src/mongo/db/pipeline/document_source_group.cpp +++ b/src/mongo/db/pipeline/document_source_group.cpp @@ -30,6 +30,7 @@ #include "mongo/platform/basic.h" #include <boost/filesystem/operations.hpp> +#include <memory> #include "mongo/db/jsobj.h" #include "mongo/db/pipeline/accumulation_statement.h" @@ -41,7 +42,6 @@ #include "mongo/db/pipeline/lite_parsed_document_source.h" #include "mongo/db/pipeline/value.h" #include "mongo/db/pipeline/value_comparator.h" -#include "mongo/stdx/memory.h" #include "mongo/util/destructor_guard.h" namespace mongo { diff --git a/src/mongo/db/pipeline/document_source_group_test.cpp b/src/mongo/db/pipeline/document_source_group_test.cpp index 8ea0cbc912a..998255cfee8 100644 --- a/src/mongo/db/pipeline/document_source_group_test.cpp +++ b/src/mongo/db/pipeline/document_source_group_test.cpp @@ -32,6 +32,7 @@ #include <boost/intrusive_ptr.hpp> #include <deque> #include <map> +#include <memory> #include <string> #include <vector> @@ -50,7 +51,6 @@ #include "mongo/db/pipeline/value_comparator.h" #include "mongo/db/query/query_test_service_context.h" #include "mongo/dbtests/dbtests.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/unordered_set.h" #include "mongo/unittest/temp_dir.h" #include "mongo/unittest/unittest.h" diff --git a/src/mongo/db/pipeline/document_source_index_stats.h b/src/mongo/db/pipeline/document_source_index_stats.h index 6462c109af7..2493970e333 100644 --- a/src/mongo/db/pipeline/document_source_index_stats.h +++ b/src/mongo/db/pipeline/document_source_index_stats.h @@ -44,7 +44,7 @@ public: public: static std::unique_ptr<LiteParsed> parse(const AggregationRequest& request, const BSONElement& spec) { - return stdx::make_unique<LiteParsed>(request.getNamespaceString()); + return std::make_unique<LiteParsed>(request.getNamespaceString()); } explicit LiteParsed(NamespaceString nss) : _nss(std::move(nss)) {} diff --git a/src/mongo/db/pipeline/document_source_list_cached_and_active_users.h b/src/mongo/db/pipeline/document_source_list_cached_and_active_users.h index 3dca331efee..408a2c5820a 100644 --- a/src/mongo/db/pipeline/document_source_list_cached_and_active_users.h +++ b/src/mongo/db/pipeline/document_source_list_cached_and_active_users.h @@ -49,7 +49,7 @@ public: public: static std::unique_ptr<LiteParsed> parse(const AggregationRequest& request, const BSONElement& spec) { - return stdx::make_unique<LiteParsed>(); + return std::make_unique<LiteParsed>(); } stdx::unordered_set<NamespaceString> getInvolvedNamespaces() const final { diff --git a/src/mongo/db/pipeline/document_source_list_local_sessions.h b/src/mongo/db/pipeline/document_source_list_local_sessions.h index 80129190c83..d39f7998233 100644 --- a/src/mongo/db/pipeline/document_source_list_local_sessions.h +++ b/src/mongo/db/pipeline/document_source_list_local_sessions.h @@ -59,7 +59,7 @@ public: static std::unique_ptr<LiteParsed> parse(const AggregationRequest& request, const BSONElement& spec) { - return stdx::make_unique<LiteParsed>(listSessionsParseSpec(kStageName, spec)); + return std::make_unique<LiteParsed>(listSessionsParseSpec(kStageName, spec)); } explicit LiteParsed(const ListSessionsSpec& spec) : _spec(spec) {} diff --git a/src/mongo/db/pipeline/document_source_list_sessions.h b/src/mongo/db/pipeline/document_source_list_sessions.h index c88c2e63fbc..e8068747799 100644 --- a/src/mongo/db/pipeline/document_source_list_sessions.h +++ b/src/mongo/db/pipeline/document_source_list_sessions.h @@ -53,7 +53,7 @@ public: public: static std::unique_ptr<LiteParsed> parse(const AggregationRequest& request, const BSONElement& spec) { - return stdx::make_unique<LiteParsed>(listSessionsParseSpec(kStageName, spec)); + return std::make_unique<LiteParsed>(listSessionsParseSpec(kStageName, spec)); } explicit LiteParsed(const ListSessionsSpec& spec) : _spec(spec) {} diff --git a/src/mongo/db/pipeline/document_source_lookup.cpp b/src/mongo/db/pipeline/document_source_lookup.cpp index 5a1d7767e5f..da994cc3ca7 100644 --- a/src/mongo/db/pipeline/document_source_lookup.cpp +++ b/src/mongo/db/pipeline/document_source_lookup.cpp @@ -31,6 +31,8 @@ #include "mongo/db/pipeline/document_source_lookup.h" +#include <memory> + #include "mongo/base/init.h" #include "mongo/db/jsobj.h" #include "mongo/db/matcher/expression_algo.h" @@ -40,7 +42,6 @@ #include "mongo/db/pipeline/expression_context.h" #include "mongo/db/pipeline/value.h" #include "mongo/db/query/query_knobs_gen.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -151,7 +152,7 @@ std::unique_ptr<DocumentSourceLookUp::LiteParsed> DocumentSourceLookUp::LitePars foreignNssSet.insert(fromNss); - return stdx::make_unique<DocumentSourceLookUp::LiteParsed>( + return std::make_unique<DocumentSourceLookUp::LiteParsed>( std::move(fromNss), std::move(foreignNssSet), std::move(liteParsedPipeline)); } diff --git a/src/mongo/db/pipeline/document_source_lookup_change_post_image_test.cpp b/src/mongo/db/pipeline/document_source_lookup_change_post_image_test.cpp index bd88e955337..e40c5b4068c 100644 --- a/src/mongo/db/pipeline/document_source_lookup_change_post_image_test.cpp +++ b/src/mongo/db/pipeline/document_source_lookup_change_post_image_test.cpp @@ -95,7 +95,7 @@ TEST_F(DocumentSourceLookupChangePostImageTest, ShouldErrorIfMissingDocumentKeyO // Mock out the foreign collection. getExpCtx()->mongoProcessInterface = - stdx::make_unique<MockMongoInterface>(deque<DocumentSource::GetNextResult>{}); + std::make_unique<MockMongoInterface>(deque<DocumentSource::GetNextResult>{}); ASSERT_THROWS_CODE(lookupChangeStage->getNext(), AssertionException, 40578); } @@ -117,7 +117,7 @@ TEST_F(DocumentSourceLookupChangePostImageTest, ShouldErrorIfMissingOperationTyp // Mock out the foreign collection. getExpCtx()->mongoProcessInterface = - stdx::make_unique<MockMongoInterface>(deque<DocumentSource::GetNextResult>{}); + std::make_unique<MockMongoInterface>(deque<DocumentSource::GetNextResult>{}); ASSERT_THROWS_CODE(lookupChangeStage->getNext(), AssertionException, 40578); } @@ -139,7 +139,7 @@ TEST_F(DocumentSourceLookupChangePostImageTest, ShouldErrorIfMissingNamespace) { // Mock out the foreign collection. getExpCtx()->mongoProcessInterface = - stdx::make_unique<MockMongoInterface>(deque<DocumentSource::GetNextResult>{}); + std::make_unique<MockMongoInterface>(deque<DocumentSource::GetNextResult>{}); ASSERT_THROWS_CODE(lookupChangeStage->getNext(), AssertionException, 40578); } @@ -161,7 +161,7 @@ TEST_F(DocumentSourceLookupChangePostImageTest, ShouldErrorIfNsFieldHasWrongType // Mock out the foreign collection. getExpCtx()->mongoProcessInterface = - stdx::make_unique<MockMongoInterface>(deque<DocumentSource::GetNextResult>{}); + std::make_unique<MockMongoInterface>(deque<DocumentSource::GetNextResult>{}); ASSERT_THROWS_CODE(lookupChangeStage->getNext(), AssertionException, 40578); } @@ -183,7 +183,7 @@ TEST_F(DocumentSourceLookupChangePostImageTest, ShouldErrorIfNsFieldDoesNotMatch // Mock out the foreign collection. getExpCtx()->mongoProcessInterface = - stdx::make_unique<MockMongoInterface>(deque<DocumentSource::GetNextResult>{}); + std::make_unique<MockMongoInterface>(deque<DocumentSource::GetNextResult>{}); ASSERT_THROWS_CODE(lookupChangeStage->getNext(), AssertionException, 40579); } @@ -207,7 +207,7 @@ TEST_F(DocumentSourceLookupChangePostImageTest, ShouldErrorIfDatabaseMismatchOnC // Mock out the foreign collection. deque<DocumentSource::GetNextResult> mockForeignContents{Document{{"_id", 0}}}; - expCtx->mongoProcessInterface = stdx::make_unique<MockMongoInterface>(mockForeignContents); + expCtx->mongoProcessInterface = std::make_unique<MockMongoInterface>(mockForeignContents); ASSERT_THROWS_CODE(lookupChangeStage->getNext(), AssertionException, 40579); } @@ -222,7 +222,7 @@ TEST_F(DocumentSourceLookupChangePostImageTest, ShouldPassIfDatabaseMatchesOnCol // Mock out the foreign collection. deque<DocumentSource::GetNextResult> mockForeignContents{Document{{"_id", 0}}}; - expCtx->mongoProcessInterface = stdx::make_unique<MockMongoInterface>(mockForeignContents); + expCtx->mongoProcessInterface = std::make_unique<MockMongoInterface>(mockForeignContents); auto mockLocalSource = DocumentSourceMock::createForTest( Document{{"_id", makeResumeToken(0)}, @@ -262,7 +262,7 @@ TEST_F(DocumentSourceLookupChangePostImageTest, ShouldErrorIfDocumentKeyIsNotUni deque<DocumentSource::GetNextResult> foreignCollection = {Document{{"_id", 0}}, Document{{"_id", 0}}}; getExpCtx()->mongoProcessInterface = - stdx::make_unique<MockMongoInterface>(std::move(foreignCollection)); + std::make_unique<MockMongoInterface>(std::move(foreignCollection)); ASSERT_THROWS_CODE( lookupChangeStage->getNext(), AssertionException, ErrorCodes::TooManyMatchingDocuments); @@ -294,7 +294,7 @@ TEST_F(DocumentSourceLookupChangePostImageTest, ShouldPropagatePauses) { deque<DocumentSource::GetNextResult> mockForeignContents{Document{{"_id", 0}}, Document{{"_id", 1}}}; getExpCtx()->mongoProcessInterface = - stdx::make_unique<MockMongoInterface>(std::move(mockForeignContents)); + std::make_unique<MockMongoInterface>(std::move(mockForeignContents)); auto next = lookupChangeStage->getNext(); ASSERT_TRUE(next.isAdvanced()); diff --git a/src/mongo/db/pipeline/document_source_lookup_test.cpp b/src/mongo/db/pipeline/document_source_lookup_test.cpp index bc406def88e..24d640ea85f 100644 --- a/src/mongo/db/pipeline/document_source_lookup_test.cpp +++ b/src/mongo/db/pipeline/document_source_lookup_test.cpp @@ -71,8 +71,8 @@ public: settings.setReplSetString("lookupTestSet/node1:12345"); - repl::StorageInterface::set(service, stdx::make_unique<repl::StorageInterfaceMock>()); - auto replCoord = stdx::make_unique<repl::ReplicationCoordinatorMock>(service, settings); + repl::StorageInterface::set(service, std::make_unique<repl::StorageInterfaceMock>()); + auto replCoord = std::make_unique<repl::ReplicationCoordinatorMock>(service, settings); // Ensure that we are primary. ASSERT_OK(replCoord->setFollowerMode(repl::MemberState::RS_PRIMARY)); diff --git a/src/mongo/db/pipeline/document_source_match.cpp b/src/mongo/db/pipeline/document_source_match.cpp index 1900a644627..d29fe8285aa 100644 --- a/src/mongo/db/pipeline/document_source_match.cpp +++ b/src/mongo/db/pipeline/document_source_match.cpp @@ -31,6 +31,8 @@ #include "mongo/db/pipeline/document_source_match.h" +#include <memory> + #include "mongo/db/jsobj.h" #include "mongo/db/matcher/expression_algo.h" #include "mongo/db/matcher/expression_array.h" @@ -41,7 +43,6 @@ #include "mongo/db/pipeline/document_path_support.h" #include "mongo/db/pipeline/expression.h" #include "mongo/db/pipeline/lite_parsed_document_source.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { diff --git a/src/mongo/db/pipeline/document_source_merge.cpp b/src/mongo/db/pipeline/document_source_merge.cpp index 2550e5a490f..01917bd5c2f 100644 --- a/src/mongo/db/pipeline/document_source_merge.cpp +++ b/src/mongo/db/pipeline/document_source_merge.cpp @@ -310,8 +310,8 @@ std::unique_ptr<DocumentSourceMerge::LiteParsed> DocumentSourceMerge::LiteParsed PrivilegeVector privileges{{ResourcePattern::forExactNamespace(targetNss), actions}}; - return stdx::make_unique<DocumentSourceMerge::LiteParsed>(std::move(targetNss), - std::move(privileges)); + return std::make_unique<DocumentSourceMerge::LiteParsed>(std::move(targetNss), + std::move(privileges)); } DocumentSourceMerge::DocumentSourceMerge(NamespaceString outputNs, diff --git a/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp b/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp index e6b26b06c70..b344097425d 100644 --- a/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp +++ b/src/mongo/db/pipeline/document_source_merge_cursors_test.cpp @@ -31,6 +31,8 @@ #include "mongo/s/query/document_source_merge_cursors.h" +#include <memory> + #include "mongo/client/remote_command_targeter_factory_mock.h" #include "mongo/client/remote_command_targeter_mock.h" #include "mongo/db/json.h" @@ -49,7 +51,6 @@ #include "mongo/s/catalog/type_shard.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/sharding_router_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/unittest/unittest.h" @@ -97,7 +98,7 @@ public: shards.push_back(shardType); std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); targeter->setConnectionStringReturnValue(ConnectionString(kTestShardHosts[i])); targeter->setFindHostReturnValue(kTestShardHosts[i]); diff --git a/src/mongo/db/pipeline/document_source_out.cpp b/src/mongo/db/pipeline/document_source_out.cpp index ab340885632..11cb1e3b3ef 100644 --- a/src/mongo/db/pipeline/document_source_out.cpp +++ b/src/mongo/db/pipeline/document_source_out.cpp @@ -96,8 +96,8 @@ std::unique_ptr<DocumentSourceOut::LiteParsed> DocumentSourceOut::LiteParsed::pa PrivilegeVector privileges{Privilege(ResourcePattern::forExactNamespace(targetNss), actions)}; - return stdx::make_unique<DocumentSourceOut::LiteParsed>(std::move(targetNss), - std::move(privileges)); + return std::make_unique<DocumentSourceOut::LiteParsed>(std::move(targetNss), + std::move(privileges)); } void DocumentSourceOut::initialize() { diff --git a/src/mongo/db/pipeline/document_source_plan_cache_stats.h b/src/mongo/db/pipeline/document_source_plan_cache_stats.h index fd7d332a660..5a2284c50bd 100644 --- a/src/mongo/db/pipeline/document_source_plan_cache_stats.h +++ b/src/mongo/db/pipeline/document_source_plan_cache_stats.h @@ -42,7 +42,7 @@ public: public: static std::unique_ptr<LiteParsed> parse(const AggregationRequest& request, const BSONElement& spec) { - return stdx::make_unique<LiteParsed>(request.getNamespaceString()); + return std::make_unique<LiteParsed>(request.getNamespaceString()); } explicit LiteParsed(NamespaceString nss) : _nss(std::move(nss)) {} diff --git a/src/mongo/db/pipeline/document_source_sample_test.cpp b/src/mongo/db/pipeline/document_source_sample_test.cpp index 0cd406abbcb..039456ac440 100644 --- a/src/mongo/db/pipeline/document_source_sample_test.cpp +++ b/src/mongo/db/pipeline/document_source_sample_test.cpp @@ -41,7 +41,6 @@ #include "mongo/db/pipeline/document_source_sample_from_random_cursor.h" #include "mongo/db/pipeline/document_value_test_util.h" #include "mongo/db/pipeline/expression_context.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" #include "mongo/util/clock_source_mock.h" diff --git a/src/mongo/db/pipeline/document_source_unwind_test.cpp b/src/mongo/db/pipeline/document_source_unwind_test.cpp index ec8bb3af24c..9eed7c7446b 100644 --- a/src/mongo/db/pipeline/document_source_unwind_test.cpp +++ b/src/mongo/db/pipeline/document_source_unwind_test.cpp @@ -48,7 +48,6 @@ #include "mongo/db/query/query_test_service_context.h" #include "mongo/db/service_context.h" #include "mongo/dbtests/dbtests.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -69,7 +68,7 @@ static const char* const ns = "unittests.document_source_group_tests"; class CheckResultsBase { public: CheckResultsBase() - : _queryServiceContext(stdx::make_unique<QueryTestServiceContext>()), + : _queryServiceContext(std::make_unique<QueryTestServiceContext>()), _opCtx(_queryServiceContext->makeOperationContext()), _ctx(new ExpressionContextForTest(_opCtx.get(), AggregationRequest(NamespaceString(ns), {}))) {} diff --git a/src/mongo/db/pipeline/expression_context_for_test.h b/src/mongo/db/pipeline/expression_context_for_test.h index d402f304bb3..b67ae6acd99 100644 --- a/src/mongo/db/pipeline/expression_context_for_test.h +++ b/src/mongo/db/pipeline/expression_context_for_test.h @@ -54,7 +54,7 @@ public: std::move(nss), std::make_shared<StubMongoProcessInterface>(), kNullTimeZoneDatabase), _testOpCtx(_serviceContext.makeOperationContext()) { TimeZoneDatabase::set(_serviceContext.getServiceContext(), - stdx::make_unique<TimeZoneDatabase>()); + std::make_unique<TimeZoneDatabase>()); // As we don't have the TimeZoneDatabase prior to ExpressionContext construction, we must // initialize with a nullptr and set post-construction. diff --git a/src/mongo/db/pipeline/expression_test.cpp b/src/mongo/db/pipeline/expression_test.cpp index 30a5eb0dcd0..029320c1b2f 100644 --- a/src/mongo/db/pipeline/expression_test.cpp +++ b/src/mongo/db/pipeline/expression_test.cpp @@ -5100,7 +5100,7 @@ TEST(ExpressionTrimTest, DoesNotTrimAnyThingWithEmptyChars) { TEST(ExpressionTrimTest, TrimComparisonsShouldNotRespectCollation) { intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest()); auto caseInsensitive = - stdx::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kToLowerString); + std::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kToLowerString); expCtx->setCollator(caseInsensitive.get()); auto trim = Expression::parseExpression(expCtx, diff --git a/src/mongo/db/pipeline/lite_parsed_document_source.h b/src/mongo/db/pipeline/lite_parsed_document_source.h index af311de66fc..6bc8a0fc6b5 100644 --- a/src/mongo/db/pipeline/lite_parsed_document_source.h +++ b/src/mongo/db/pipeline/lite_parsed_document_source.h @@ -38,7 +38,6 @@ #include "mongo/db/namespace_string.h" #include "mongo/db/pipeline/aggregation_request.h" #include "mongo/db/repl/read_concern_args.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/unordered_set.h" namespace mongo { @@ -153,7 +152,7 @@ public: */ static std::unique_ptr<LiteParsedDocumentSourceDefault> parse(const AggregationRequest& request, const BSONElement& spec) { - return stdx::make_unique<LiteParsedDocumentSourceDefault>(); + return std::make_unique<LiteParsedDocumentSourceDefault>(); } LiteParsedDocumentSourceDefault() = default; diff --git a/src/mongo/db/pipeline/parsed_add_fields.cpp b/src/mongo/db/pipeline/parsed_add_fields.cpp index 7ede5be4d5d..2e2a1602414 100644 --- a/src/mongo/db/pipeline/parsed_add_fields.cpp +++ b/src/mongo/db/pipeline/parsed_add_fields.cpp @@ -43,7 +43,7 @@ std::unique_ptr<ParsedAddFields> ParsedAddFields::create( const boost::intrusive_ptr<ExpressionContext>& expCtx, const BSONObj& spec) { // Verify that we don't have conflicting field paths, etc. ProjectionSpecValidator::uassertValid(spec, "$addFields"); - std::unique_ptr<ParsedAddFields> parsedAddFields = stdx::make_unique<ParsedAddFields>(expCtx); + std::unique_ptr<ParsedAddFields> parsedAddFields = std::make_unique<ParsedAddFields>(expCtx); // Actually parse the specification. parsedAddFields->parse(spec); diff --git a/src/mongo/db/pipeline/parsed_add_fields.h b/src/mongo/db/pipeline/parsed_add_fields.h index 469f6d79d9d..0960bfc1cf5 100644 --- a/src/mongo/db/pipeline/parsed_add_fields.h +++ b/src/mongo/db/pipeline/parsed_add_fields.h @@ -35,7 +35,6 @@ #include "mongo/db/pipeline/expression_context.h" #include "mongo/db/pipeline/parsed_aggregation_projection.h" #include "mongo/db/pipeline/parsed_inclusion_projection.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/db/pipeline/parsed_exclusion_projection.cpp b/src/mongo/db/pipeline/parsed_exclusion_projection.cpp index 1ce444ab22f..01b245e455e 100644 --- a/src/mongo/db/pipeline/parsed_exclusion_projection.cpp +++ b/src/mongo/db/pipeline/parsed_exclusion_projection.cpp @@ -31,10 +31,11 @@ #include "mongo/db/pipeline/parsed_exclusion_projection.h" +#include <memory> + #include "mongo/db/pipeline/document.h" #include "mongo/db/pipeline/field_path.h" #include "mongo/db/pipeline/value.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/db/pipeline/parsed_inclusion_projection.h b/src/mongo/db/pipeline/parsed_inclusion_projection.h index b1bce15c6fe..46c93bf6a29 100644 --- a/src/mongo/db/pipeline/parsed_inclusion_projection.h +++ b/src/mongo/db/pipeline/parsed_inclusion_projection.h @@ -35,7 +35,6 @@ #include "mongo/db/pipeline/expression_context.h" #include "mongo/db/pipeline/parsed_aggregation_projection.h" #include "mongo/db/pipeline/parsed_aggregation_projection_node.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/unordered_map.h" #include "mongo/stdx/unordered_set.h" diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp index 178426d0c94..ef2b73846f3 100644 --- a/src/mongo/db/pipeline/pipeline_d.cpp +++ b/src/mongo/db/pipeline/pipeline_d.cpp @@ -33,6 +33,8 @@ #include "mongo/db/pipeline/pipeline_d.h" +#include <memory> + #include "mongo/bson/simple_bsonobj_comparator.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" @@ -83,7 +85,6 @@ #include "mongo/s/grid.h" #include "mongo/s/query/document_source_merge_cursors.h" #include "mongo/s/write_ops/cluster_write.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/time_support.h" @@ -178,7 +179,7 @@ StatusWith<std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>> attemptToGetExe const AggregationRequest* aggRequest, const size_t plannerOpts, const MatchExpressionParser::AllowedFeatureSet& matcherFeatures) { - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setTailableMode(pExpCtx->tailableMode); qr->setOplogReplay(oplogReplay); qr->setFilter(queryObj); diff --git a/src/mongo/db/pipeline/pipeline_test.cpp b/src/mongo/db/pipeline/pipeline_test.cpp index d6179e48e78..5c824ff38ce 100644 --- a/src/mongo/db/pipeline/pipeline_test.cpp +++ b/src/mongo/db/pipeline/pipeline_test.cpp @@ -75,7 +75,7 @@ const NamespaceString kTestNss = NamespaceString("a.collection"); void setMockReplicationCoordinatorOnOpCtx(OperationContext* opCtx) { repl::ReplicationCoordinator::set( opCtx->getServiceContext(), - stdx::make_unique<repl::ReplicationCoordinatorMock>(opCtx->getServiceContext())); + std::make_unique<repl::ReplicationCoordinatorMock>(opCtx->getServiceContext())); } namespace Optimizations { diff --git a/src/mongo/db/pipeline/stub_mongo_process_interface_lookup_single_document.h b/src/mongo/db/pipeline/stub_mongo_process_interface_lookup_single_document.h index 36d9dd81cbc..e8f74bc5277 100644 --- a/src/mongo/db/pipeline/stub_mongo_process_interface_lookup_single_document.h +++ b/src/mongo/db/pipeline/stub_mongo_process_interface_lookup_single_document.h @@ -89,7 +89,7 @@ public: if (expCtx->inMongos) { return nullptr; } else { - return stdx::make_unique<StubShardFilterer>(); + return std::make_unique<StubShardFilterer>(); } } diff --git a/src/mongo/db/pipeline/variables.h b/src/mongo/db/pipeline/variables.h index 9627659b25b..2a606ac0572 100644 --- a/src/mongo/db/pipeline/variables.h +++ b/src/mongo/db/pipeline/variables.h @@ -29,10 +29,11 @@ #pragma once +#include <memory> + #include "mongo/db/operation_context.h" #include "mongo/db/pipeline/document.h" #include "mongo/db/pipeline/runtime_constants_gen.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/unordered_map.h" #include "mongo/util/string_map.h" diff --git a/src/mongo/db/query/canonical_query.cpp b/src/mongo/db/query/canonical_query.cpp index ff77f314fa2..cba8c2e2736 100644 --- a/src/mongo/db/query/canonical_query.cpp +++ b/src/mongo/db/query/canonical_query.cpp @@ -184,7 +184,7 @@ StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize( // static StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize( OperationContext* opCtx, const CanonicalQuery& baseQuery, MatchExpression* root) { - auto qr = stdx::make_unique<QueryRequest>(baseQuery.nss()); + auto qr = std::make_unique<QueryRequest>(baseQuery.nss()); BSONObjBuilder builder; root->serialize(&builder); qr->setFilter(builder.obj()); diff --git a/src/mongo/db/query/canonical_query_encoder_test.cpp b/src/mongo/db/query/canonical_query_encoder_test.cpp index 672336e090b..4086f64402f 100644 --- a/src/mongo/db/query/canonical_query_encoder_test.cpp +++ b/src/mongo/db/query/canonical_query_encoder_test.cpp @@ -55,7 +55,7 @@ unique_ptr<CanonicalQuery> canonicalize(BSONObj query, QueryTestServiceContext serviceContext; auto opCtx = serviceContext.makeOperationContext(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(query); qr->setSort(sort); qr->setProj(proj); diff --git a/src/mongo/db/query/canonical_query_test.cpp b/src/mongo/db/query/canonical_query_test.cpp index 8926ce0dd2d..a9517301859 100644 --- a/src/mongo/db/query/canonical_query_test.cpp +++ b/src/mongo/db/query/canonical_query_test.cpp @@ -182,7 +182,7 @@ unique_ptr<CanonicalQuery> canonicalize(const char* queryStr, QueryTestServiceContext serviceContext; auto opCtx = serviceContext.makeOperationContext(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson(queryStr)); auto statusWithCQ = CanonicalQuery::canonicalize( @@ -198,7 +198,7 @@ std::unique_ptr<CanonicalQuery> canonicalize(const char* queryStr, QueryTestServiceContext serviceContext; auto opCtx = serviceContext.makeOperationContext(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson(queryStr)); qr->setSort(fromjson(sortStr)); qr->setProj(fromjson(projStr)); @@ -290,7 +290,7 @@ TEST(CanonicalQueryTest, CanonicalQueryFromQRWithNoCollation) { QueryTestServiceContext serviceContext; auto opCtx = serviceContext.makeOperationContext(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); auto cq = assertGet(CanonicalQuery::canonicalize(opCtx.get(), std::move(qr))); ASSERT_TRUE(cq->getCollator() == nullptr); } @@ -299,7 +299,7 @@ TEST(CanonicalQueryTest, CanonicalQueryFromQRWithCollation) { QueryTestServiceContext serviceContext; auto opCtx = serviceContext.makeOperationContext(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setCollation(BSON("locale" << "reverse")); auto cq = assertGet(CanonicalQuery::canonicalize(opCtx.get(), std::move(qr))); @@ -311,7 +311,7 @@ TEST(CanonicalQueryTest, CanonicalQueryFromBaseQueryWithNoCollation) { QueryTestServiceContext serviceContext; auto opCtx = serviceContext.makeOperationContext(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson("{$or:[{a:1,b:1},{a:1,c:1}]}")); auto baseCq = assertGet(CanonicalQuery::canonicalize(opCtx.get(), std::move(qr))); MatchExpression* firstClauseExpr = baseCq->root()->getChild(0); @@ -324,7 +324,7 @@ TEST(CanonicalQueryTest, CanonicalQueryFromBaseQueryWithCollation) { QueryTestServiceContext serviceContext; auto opCtx = serviceContext.makeOperationContext(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson("{$or:[{a:1,b:1},{a:1,c:1}]}")); qr->setCollation(BSON("locale" << "reverse")); @@ -340,7 +340,7 @@ TEST(CanonicalQueryTest, SettingCollatorUpdatesCollatorAndMatchExpression) { QueryTestServiceContext serviceContext; auto opCtx = serviceContext.makeOperationContext(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson("{a: 'foo', b: {$in: ['bar', 'baz']}}")); auto cq = assertGet(CanonicalQuery::canonicalize(opCtx.get(), std::move(qr))); ASSERT_EQUALS(2U, cq->root()->numChildren()); diff --git a/src/mongo/db/query/collation/collation_index_key.cpp b/src/mongo/db/query/collation/collation_index_key.cpp index 3af408e8abd..48d971d3f7e 100644 --- a/src/mongo/db/query/collation/collation_index_key.cpp +++ b/src/mongo/db/query/collation/collation_index_key.cpp @@ -31,13 +31,13 @@ #include "mongo/db/query/collation/collation_index_key.h" +#include <memory> #include <stack> #include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonobjbuilder.h" #include "mongo/bson/util/builder.h" #include "mongo/db/query/collation/collator_interface.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" namespace mongo { diff --git a/src/mongo/db/query/collation/collator_factory_icu.cpp b/src/mongo/db/query/collation/collator_factory_icu.cpp index c8b8de7a5ab..f9662b0a22a 100644 --- a/src/mongo/db/query/collation/collator_factory_icu.cpp +++ b/src/mongo/db/query/collation/collator_factory_icu.cpp @@ -31,6 +31,8 @@ #include "mongo/db/query/collation/collator_factory_icu.h" +#include <memory> + #include <unicode/coll.h> #include <unicode/errorcode.h> #include <unicode/ucol.h> @@ -39,7 +41,6 @@ #include "mongo/bson/bsonobj.h" #include "mongo/bson/util/bson_extract.h" #include "mongo/db/query/collation/collator_interface_icu.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { @@ -754,8 +755,8 @@ StatusWith<std::unique_ptr<CollatorInterface>> CollatorFactoryICU::makeFromBSON( return validateSpecStatus; } - auto mongoCollator = stdx::make_unique<CollatorInterfaceICU>(std::move(parsedSpec.getValue()), - std::move(icuCollator)); + auto mongoCollator = std::make_unique<CollatorInterfaceICU>(std::move(parsedSpec.getValue()), + std::move(icuCollator)); return {std::move(mongoCollator)}; } diff --git a/src/mongo/db/query/collation/collator_factory_icu_decoration.cpp b/src/mongo/db/query/collation/collator_factory_icu_decoration.cpp index df6233398ba..654f4f4c7b3 100644 --- a/src/mongo/db/query/collation/collator_factory_icu_decoration.cpp +++ b/src/mongo/db/query/collation/collator_factory_icu_decoration.cpp @@ -29,10 +29,11 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/base/init.h" #include "mongo/db/query/collation/collator_factory_icu.h" #include "mongo/db/service_context.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -42,7 +43,7 @@ ServiceContext::ConstructorActionRegisterer registerIcuCollator{ "CreateCollatorFactory", {"LoadICUData"}, [](ServiceContext* service) { - CollatorFactoryInterface::set(service, stdx::make_unique<CollatorFactoryICU>()); + CollatorFactoryInterface::set(service, std::make_unique<CollatorFactoryICU>()); }}; } // namespace diff --git a/src/mongo/db/query/collation/collator_factory_icu_test.cpp b/src/mongo/db/query/collation/collator_factory_icu_test.cpp index 052e03decee..7024303dffd 100644 --- a/src/mongo/db/query/collation/collator_factory_icu_test.cpp +++ b/src/mongo/db/query/collation/collator_factory_icu_test.cpp @@ -31,9 +31,10 @@ #include "mongo/db/query/collation/collator_factory_icu.h" +#include <memory> + #include "mongo/base/init.h" #include "mongo/bson/bsonobjbuilder.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace { diff --git a/src/mongo/db/query/collation/collator_factory_mock.cpp b/src/mongo/db/query/collation/collator_factory_mock.cpp index e273572ff95..cc82e36522a 100644 --- a/src/mongo/db/query/collation/collator_factory_mock.cpp +++ b/src/mongo/db/query/collation/collator_factory_mock.cpp @@ -31,12 +31,13 @@ #include "mongo/db/query/collation/collator_factory_mock.h" +#include <memory> + #include "mongo/base/status_with.h" #include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonobjbuilder.h" #include "mongo/bson/simple_bsonobj_comparator.h" #include "mongo/db/query/collation/collator_interface_mock.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -46,7 +47,7 @@ StatusWith<std::unique_ptr<CollatorInterface>> CollatorFactoryMock::makeFromBSON return {nullptr}; } auto collator = - stdx::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kReverseString); + std::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kReverseString); return {std::move(collator)}; } diff --git a/src/mongo/db/query/collation/collator_interface_icu.cpp b/src/mongo/db/query/collation/collator_interface_icu.cpp index 28fcce5db7d..db35958c63a 100644 --- a/src/mongo/db/query/collation/collator_interface_icu.cpp +++ b/src/mongo/db/query/collation/collator_interface_icu.cpp @@ -31,10 +31,11 @@ #include "mongo/db/query/collation/collator_interface_icu.h" +#include <memory> + #include <unicode/coll.h> #include <unicode/sortkey.h> -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" namespace mongo { @@ -44,7 +45,7 @@ CollatorInterfaceICU::CollatorInterfaceICU(CollationSpec spec, : CollatorInterface(std::move(spec)), _collator(std::move(collator)) {} std::unique_ptr<CollatorInterface> CollatorInterfaceICU::clone() const { - auto clone = stdx::make_unique<CollatorInterfaceICU>( + auto clone = std::make_unique<CollatorInterfaceICU>( getSpec(), std::unique_ptr<icu::Collator>(_collator->clone())); return {std::move(clone)}; } diff --git a/src/mongo/db/query/collation/collator_interface_mock.cpp b/src/mongo/db/query/collation/collator_interface_mock.cpp index 405262bfb75..0ace0847984 100644 --- a/src/mongo/db/query/collation/collator_interface_mock.cpp +++ b/src/mongo/db/query/collation/collator_interface_mock.cpp @@ -33,9 +33,9 @@ #include <algorithm> #include <cctype> +#include <memory> #include <string> -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" namespace mongo { @@ -62,7 +62,7 @@ CollatorInterfaceMock::CollatorInterfaceMock(MockType mockType) _mockType(mockType) {} std::unique_ptr<CollatorInterface> CollatorInterfaceMock::clone() const { - auto clone = stdx::make_unique<CollatorInterfaceMock>(_mockType); + auto clone = std::make_unique<CollatorInterfaceMock>(_mockType); return {std::move(clone)}; } diff --git a/src/mongo/db/query/datetime/date_time_support.cpp b/src/mongo/db/query/datetime/date_time_support.cpp index 01397b1c605..0d8b8f0c684 100644 --- a/src/mongo/db/query/datetime/date_time_support.cpp +++ b/src/mongo/db/query/datetime/date_time_support.cpp @@ -39,7 +39,6 @@ #include "mongo/base/init.h" #include "mongo/bson/util/builder.h" #include "mongo/db/service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/duration.h" #include "mongo/util/log.h" diff --git a/src/mongo/db/query/datetime/init_timezone_data.cpp b/src/mongo/db/query/datetime/init_timezone_data.cpp index dea7322dd90..970e6db7de4 100644 --- a/src/mongo/db/query/datetime/init_timezone_data.cpp +++ b/src/mongo/db/query/datetime/init_timezone_data.cpp @@ -29,13 +29,14 @@ #include "mongo/platform/basic.h" +#include <memory> + #include <timelib.h> #include "mongo/base/init.h" #include "mongo/db/query/datetime/date_time_support.h" #include "mongo/db/server_options.h" #include "mongo/db/service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { @@ -53,10 +54,10 @@ ServiceContext::ConstructorActionRegisterer loadTimeZoneDB{ << "\""); } TimeZoneDatabase::set(service, - stdx::make_unique<TimeZoneDatabase>(std::move(timeZoneDatabase))); + std::make_unique<TimeZoneDatabase>(std::move(timeZoneDatabase))); } else { // No 'zoneInfo' specified on the command line, fall back to the built-in rules. - TimeZoneDatabase::set(service, stdx::make_unique<TimeZoneDatabase>()); + TimeZoneDatabase::set(service, std::make_unique<TimeZoneDatabase>()); } }}; } // namespace diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp index 10464c58641..ff1e443abc9 100644 --- a/src/mongo/db/query/find.cpp +++ b/src/mongo/db/query/find.cpp @@ -33,6 +33,8 @@ #include "mongo/db/query/find.h" +#include <memory> + #include "mongo/base/error_codes.h" #include "mongo/db/auth/authorization_session.h" #include "mongo/db/catalog/collection.h" @@ -62,7 +64,6 @@ #include "mongo/db/views/view_catalog.h" #include "mongo/s/chunk_version.h" #include "mongo/s/stale_exception.h" -#include "mongo/stdx/memory.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/log.h" #include "mongo/util/scopeguard.h" @@ -71,7 +72,6 @@ namespace mongo { using std::unique_ptr; -using stdx::make_unique; // Failpoint for checking whether we've received a getmore. MONGO_FAIL_POINT_DEFINE(failReceivedGetmore); diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp index 27f3d451dac..eb3c8ec79d0 100644 --- a/src/mongo/db/query/get_executor.cpp +++ b/src/mongo/db/query/get_executor.cpp @@ -84,7 +84,6 @@ #include "mongo/db/storage/oplog_hack.h" #include "mongo/db/storage/storage_options.h" #include "mongo/scripting/engine.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/str.h" @@ -93,7 +92,6 @@ namespace mongo { using std::string; using std::unique_ptr; using std::vector; -using stdx::make_unique; // static void filterAllowedIndexEntries(const AllowedIndicesFilter& allowedIndicesFilter, @@ -366,7 +364,7 @@ StatusWith<PrepareExecutionResult> prepareExecution(OperationContext* opCtx, const string& ns = canonicalQuery->ns(); LOG(2) << "Collection " << ns << " does not exist." << " Using EOF plan: " << redact(canonicalQuery->toStringShort()); - root = make_unique<EOFStage>(opCtx); + root = std::make_unique<EOFStage>(opCtx); return PrepareExecutionResult(std::move(canonicalQuery), nullptr, std::move(root)); } @@ -388,11 +386,11 @@ StatusWith<PrepareExecutionResult> prepareExecution(OperationContext* opCtx, if (descriptor && IDHackStage::supportsQuery(collection, *canonicalQuery)) { LOG(2) << "Using idhack: " << redact(canonicalQuery->toStringShort()); - root = make_unique<IDHackStage>(opCtx, canonicalQuery.get(), ws, descriptor); + root = std::make_unique<IDHackStage>(opCtx, canonicalQuery.get(), ws, descriptor); // Might have to filter out orphaned docs. if (plannerParams.options & QueryPlannerParams::INCLUDE_SHARD_FILTER) { - root = make_unique<ShardFilterStage>( + root = std::make_unique<ShardFilterStage>( opCtx, CollectionShardingState::get(opCtx, canonicalQuery->nss())->getOrphansFilter(opCtx), ws, @@ -406,12 +404,12 @@ StatusWith<PrepareExecutionResult> prepareExecution(OperationContext* opCtx, // Add a SortKeyGeneratorStage if there is a $meta sortKey projection. if (canonicalQuery->getProj()->wantSortKey()) { - root = - make_unique<SortKeyGeneratorStage>(opCtx, - root.release(), - ws, - canonicalQuery->getQueryRequest().getSort(), - canonicalQuery->getCollator()); + root = std::make_unique<SortKeyGeneratorStage>( + opCtx, + root.release(), + ws, + canonicalQuery->getQueryRequest().getSort(), + canonicalQuery->getCollator()); } // Stuff the right data into the params depending on what proj impl we use. @@ -419,14 +417,15 @@ StatusWith<PrepareExecutionResult> prepareExecution(OperationContext* opCtx, canonicalQuery->getProj()->wantIndexKey() || canonicalQuery->getProj()->wantSortKey() || canonicalQuery->getProj()->hasDottedFieldPath()) { - root = make_unique<ProjectionStageDefault>(opCtx, - canonicalQuery->getProj()->getProjObj(), - ws, - std::move(root), - *canonicalQuery->root(), - canonicalQuery->getCollator()); + root = std::make_unique<ProjectionStageDefault>( + opCtx, + canonicalQuery->getProj()->getProjObj(), + ws, + std::move(root), + *canonicalQuery->root(), + canonicalQuery->getCollator()); } else { - root = make_unique<ProjectionStageSimple>( + root = std::make_unique<ProjectionStageSimple>( opCtx, canonicalQuery->getProj()->getProjObj(), ws, std::move(root)); } } @@ -474,13 +473,13 @@ StatusWith<PrepareExecutionResult> prepareExecution(OperationContext* opCtx, // // 'decisionWorks' is used to determine whether the existing cache entry should // be evicted, and the query replanned. - root = make_unique<CachedPlanStage>(opCtx, - collection, - ws, - canonicalQuery.get(), - plannerParams, - cs->decisionWorks, - rawRoot); + root = std::make_unique<CachedPlanStage>(opCtx, + collection, + ws, + canonicalQuery.get(), + plannerParams, + cs->decisionWorks, + rawRoot); return PrepareExecutionResult( std::move(canonicalQuery), std::move(querySolution), std::move(root)); } @@ -491,8 +490,8 @@ StatusWith<PrepareExecutionResult> prepareExecution(OperationContext* opCtx, SubplanStage::canUseSubplanning(*canonicalQuery)) { LOG(2) << "Running query as sub-queries: " << redact(canonicalQuery->toStringShort()); - root = - make_unique<SubplanStage>(opCtx, collection, ws, plannerParams, canonicalQuery.get()); + root = std::make_unique<SubplanStage>( + opCtx, collection, ws, plannerParams, canonicalQuery.get()); return PrepareExecutionResult(std::move(canonicalQuery), nullptr, std::move(root)); } @@ -547,7 +546,8 @@ StatusWith<PrepareExecutionResult> prepareExecution(OperationContext* opCtx, } else { // Many solutions. Create a MultiPlanStage to pick the best, update the cache, // and so on. The working set will be shared by all candidate plans. - auto multiPlanStage = make_unique<MultiPlanStage>(opCtx, collection, canonicalQuery.get()); + auto multiPlanStage = + std::make_unique<MultiPlanStage>(opCtx, collection, canonicalQuery.get()); for (size_t ix = 0; ix < solutions.size(); ++ix) { if (solutions[ix]->cacheData.get()) { @@ -576,7 +576,7 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutor( unique_ptr<CanonicalQuery> canonicalQuery, PlanExecutor::YieldPolicy yieldPolicy, size_t plannerOptions) { - unique_ptr<WorkingSet> ws = make_unique<WorkingSet>(); + unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>(); StatusWith<PrepareExecutionResult> executionResult = prepareExecution(opCtx, collection, ws.get(), std::move(canonicalQuery), plannerOptions); if (!executionResult.isOK()) { @@ -722,8 +722,8 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getOplogStartHack( params.stopApplyingFilterAfterFirstMatch = true; } - auto ws = make_unique<WorkingSet>(); - auto cs = make_unique<CollectionScan>(opCtx, collection, params, ws.get(), cq->root()); + auto ws = std::make_unique<WorkingSet>(); + auto cs = std::make_unique<CollectionScan>(opCtx, collection, params, ws.get(), cq->root()); return PlanExecutor::make( opCtx, std::move(ws), std::move(cs), std::move(cq), collection, PlanExecutor::YIELD_AUTO); } @@ -811,12 +811,12 @@ StatusWith<unique_ptr<PlanStage>> applyProjection(OperationContext* opCtx, "Cannot use a $meta sortKey projection in findAndModify commands."}; } - return {make_unique<ProjectionStageDefault>(opCtx, - proj, - ws, - std::unique_ptr<PlanStage>(root.release()), - *cq->root(), - cq->getCollator())}; + return {std::make_unique<ProjectionStageDefault>(opCtx, + proj, + ws, + std::unique_ptr<PlanStage>(root.release()), + *cq->root(), + cq->getCollator())}; } } // namespace @@ -862,7 +862,7 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutorDelete( deleteStageParams->opDebug = opDebug; deleteStageParams->stmtId = request->getStmtId(); - unique_ptr<WorkingSet> ws = make_unique<WorkingSet>(); + unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>(); const PlanExecutor::YieldPolicy policy = parsedDelete->yieldPolicy(); if (!collection) { @@ -900,7 +900,7 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutorDelete( auto idHackStage = std::make_unique<IDHackStage>( opCtx, unparsedQuery["_id"].wrap(), ws.get(), descriptor); - unique_ptr<DeleteStage> root = make_unique<DeleteStage>( + unique_ptr<DeleteStage> root = std::make_unique<DeleteStage>( opCtx, std::move(deleteStageParams), ws.get(), collection, idHackStage.release()); return PlanExecutor::make(opCtx, std::move(ws), std::move(root), collection, policy); } @@ -929,7 +929,7 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutorDelete( deleteStageParams->canonicalQuery = cq.get(); invariant(root); - root = make_unique<DeleteStage>( + root = std::make_unique<DeleteStage>( opCtx, std::move(deleteStageParams), ws.get(), collection, root.release()); if (!request->getProj().isEmpty()) { @@ -1003,7 +1003,7 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutorUpdate( const PlanExecutor::YieldPolicy policy = parsedUpdate->yieldPolicy(); - unique_ptr<WorkingSet> ws = make_unique<WorkingSet>(); + unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>(); UpdateStageParams updateStageParams(request, driver, opDebug); // If the collection doesn't exist, then return a PlanExecutor for a no-op EOF plan. We have @@ -1070,7 +1070,7 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutorUpdate( invariant(root); updateStageParams.canonicalQuery = cq.get(); - root = stdx::make_unique<UpdateStage>( + root = std::make_unique<UpdateStage>( opCtx, updateStageParams, ws.get(), collection, root.release()); if (!request->getProj().isEmpty()) { @@ -1218,9 +1218,9 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutorCount( const CountCommand& request, bool explain, const NamespaceString& nss) { - unique_ptr<WorkingSet> ws = make_unique<WorkingSet>(); + unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(request.getQuery()); auto collation = request.getCollation().value_or(BSONObj()); qr->setCollation(collation); @@ -1255,8 +1255,8 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutorCount( // Treat collections that do not exist as empty collections. Note that the explain reporting // machinery always assumes that the root stage for a count operation is a CountStage, so in // this case we put a CountStage on top of an EOFStage. - unique_ptr<PlanStage> root = - make_unique<CountStage>(opCtx, collection, limit, skip, ws.get(), new EOFStage(opCtx)); + unique_ptr<PlanStage> root = std::make_unique<CountStage>( + opCtx, collection, limit, skip, ws.get(), new EOFStage(opCtx)); return PlanExecutor::make(opCtx, std::move(ws), std::move(root), nss, yieldPolicy); } @@ -1271,7 +1271,7 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutorCount( if (useRecordStoreCount) { unique_ptr<PlanStage> root = - make_unique<RecordStoreFastCountStage>(opCtx, collection, skip, limit); + std::make_unique<RecordStoreFastCountStage>(opCtx, collection, skip, limit); return PlanExecutor::make(opCtx, std::move(ws), std::move(root), nss, yieldPolicy); } @@ -1292,7 +1292,7 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutorCount( invariant(root); // Make a CountStage to be the new root. - root = make_unique<CountStage>(opCtx, collection, limit, skip, ws.get(), root.release()); + root = std::make_unique<CountStage>(opCtx, collection, limit, skip, ws.get(), root.release()); // We must have a tree of stages in order to have a valid plan executor, but the query // solution may be NULL. Takes ownership of all args other than 'collection' and 'opCtx' return PlanExecutor::make(opCtx, @@ -1430,7 +1430,7 @@ bool turnIxscanIntoDistinctIxscan(QuerySolution* soln, } // Make a new DistinctNode. We will swap this for the ixscan in the provided solution. - auto distinctNode = stdx::make_unique<DistinctNode>(indexScanNode->index); + auto distinctNode = std::make_unique<DistinctNode>(indexScanNode->index); distinctNode->direction = indexScanNode->direction; distinctNode->bounds = indexScanNode->bounds; distinctNode->queryCollator = indexScanNode->queryCollator; @@ -1561,7 +1561,7 @@ StatusWith<std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutorForS return {nullptr}; } - auto dn = stdx::make_unique<DistinctNode>(plannerParams.indices[distinctNodeIndex]); + auto dn = std::make_unique<DistinctNode>(plannerParams.indices[distinctNodeIndex]); dn->direction = 1; IndexBoundsBuilder::allValuesBounds(dn->index.keyPattern, &dn->bounds); dn->queryCollator = collator; @@ -1571,7 +1571,7 @@ StatusWith<std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutorForS std::unique_ptr<QuerySolutionNode> solnRoot = std::move(dn); if (plannerParams.indices[distinctNodeIndex].collator) { if (!solnRoot->fetched()) { - auto fetch = stdx::make_unique<FetchNode>(); + auto fetch = std::make_unique<FetchNode>(); fetch->children.push_back(solnRoot.release()); solnRoot = std::move(fetch); } @@ -1583,7 +1583,7 @@ StatusWith<std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutorForS *parsedDistinct->getQuery(), params, std::move(solnRoot)); invariant(soln); - unique_ptr<WorkingSet> ws = make_unique<WorkingSet>(); + unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>(); PlanStage* rawRoot; verify(StageBuilder::build( opCtx, collection, *parsedDistinct->getQuery(), *soln, ws.get(), &rawRoot)); @@ -1625,7 +1625,7 @@ getExecutorDistinctFromIndexSolutions(OperationContext* opCtx, if (turnIxscanIntoDistinctIxscan( solutions[i].get(), parsedDistinct->getKey(), strictDistinctOnly)) { // Build and return the SSR over solutions[i]. - unique_ptr<WorkingSet> ws = make_unique<WorkingSet>(); + unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>(); unique_ptr<QuerySolution> currentSolution = std::move(solutions[i]); PlanStage* rawRoot; verify(StageBuilder::build(opCtx, @@ -1662,7 +1662,7 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutorWithoutPr const CanonicalQuery* cq, PlanExecutor::YieldPolicy yieldPolicy, size_t plannerOptions) { - auto qr = stdx::make_unique<QueryRequest>(cq->getQueryRequest()); + auto qr = std::make_unique<QueryRequest>(cq->getQueryRequest()); qr->setProj(BSONObj()); const boost::intrusive_ptr<ExpressionContext> expCtx; @@ -1693,8 +1693,8 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutorDistinct( if (!collection) { // Treat collections that do not exist as empty collections. return PlanExecutor::make(opCtx, - make_unique<WorkingSet>(), - make_unique<EOFStage>(opCtx), + std::make_unique<WorkingSet>(), + std::make_unique<EOFStage>(opCtx), parsedDistinct->releaseQuery(), collection, yieldPolicy); diff --git a/src/mongo/db/query/get_executor_test.cpp b/src/mongo/db/query/get_executor_test.cpp index 16cdf77016a..6281cedc01a 100644 --- a/src/mongo/db/query/get_executor_test.cpp +++ b/src/mongo/db/query/get_executor_test.cpp @@ -61,7 +61,7 @@ unique_ptr<CanonicalQuery> canonicalize(const char* queryStr, QueryTestServiceContext serviceContext; auto opCtx = serviceContext.makeOperationContext(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson(queryStr)); qr->setSort(fromjson(sortStr)); qr->setProj(fromjson(projStr)); diff --git a/src/mongo/db/query/index_tag.cpp b/src/mongo/db/query/index_tag.cpp index 5fe91012a3a..0381e2ac9ba 100644 --- a/src/mongo/db/query/index_tag.cpp +++ b/src/mongo/db/query/index_tag.cpp @@ -120,7 +120,7 @@ void attachNode(MatchExpression* node, AndMatchExpression* andNode = static_cast<AndMatchExpression*>(target); andNode->add(clone.release()); } else { - std::unique_ptr<AndMatchExpression> andNode = stdx::make_unique<AndMatchExpression>(); + std::unique_ptr<AndMatchExpression> andNode = std::make_unique<AndMatchExpression>(); IndexTag* indexTag = static_cast<IndexTag*>(clone->getTag()); andNode->setTag(new IndexTag(indexTag->index)); andNode->add(target); diff --git a/src/mongo/db/query/index_tag.h b/src/mongo/db/query/index_tag.h index 0afa60d7130..be4423d3179 100644 --- a/src/mongo/db/query/index_tag.h +++ b/src/mongo/db/query/index_tag.h @@ -207,7 +207,7 @@ public: } MatchExpression::TagData* clone() const override { - std::unique_ptr<OrPushdownTag> clone = stdx::make_unique<OrPushdownTag>(); + std::unique_ptr<OrPushdownTag> clone = std::make_unique<OrPushdownTag>(); for (const auto& dest : _destinations) { clone->addDestination(dest.clone()); } diff --git a/src/mongo/db/query/internal_plans.cpp b/src/mongo/db/query/internal_plans.cpp index f303d1169ba..bfd88fb27df 100644 --- a/src/mongo/db/query/internal_plans.cpp +++ b/src/mongo/db/query/internal_plans.cpp @@ -31,6 +31,8 @@ #include "mongo/db/query/internal_plans.h" +#include <memory> + #include "mongo/db/catalog/database.h" #include "mongo/db/client.h" #include "mongo/db/exec/collection_scan.h" @@ -41,7 +43,6 @@ #include "mongo/db/exec/index_scan.h" #include "mongo/db/exec/update_stage.h" #include "mongo/db/query/get_executor.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -52,10 +53,10 @@ std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> InternalPlanner::collection PlanExecutor::YieldPolicy yieldPolicy, const Direction direction, const RecordId startLoc) { - std::unique_ptr<WorkingSet> ws = stdx::make_unique<WorkingSet>(); + std::unique_ptr<WorkingSet> ws = std::make_unique<WorkingSet>(); if (NULL == collection) { - auto eof = stdx::make_unique<EOFStage>(opCtx); + auto eof = std::make_unique<EOFStage>(opCtx); // Takes ownership of 'ws' and 'eof'. auto statusWithPlanExecutor = PlanExecutor::make( opCtx, std::move(ws), std::move(eof), NamespaceString(ns), yieldPolicy); @@ -82,11 +83,11 @@ std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> InternalPlanner::deleteWith Direction direction, const RecordId& startLoc) { invariant(collection); - auto ws = stdx::make_unique<WorkingSet>(); + auto ws = std::make_unique<WorkingSet>(); auto root = _collectionScan(opCtx, ws.get(), collection, direction, startLoc); - root = stdx::make_unique<DeleteStage>( + root = std::make_unique<DeleteStage>( opCtx, std::move(params), ws.get(), collection, root.release()); auto executor = @@ -106,7 +107,7 @@ std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> InternalPlanner::indexScan( PlanExecutor::YieldPolicy yieldPolicy, Direction direction, int options) { - auto ws = stdx::make_unique<WorkingSet>(); + auto ws = std::make_unique<WorkingSet>(); std::unique_ptr<PlanStage> root = _indexScan(opCtx, ws.get(), @@ -135,7 +136,7 @@ std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> InternalPlanner::deleteWith PlanExecutor::YieldPolicy yieldPolicy, Direction direction) { invariant(collection); - auto ws = stdx::make_unique<WorkingSet>(); + auto ws = std::make_unique<WorkingSet>(); std::unique_ptr<PlanStage> root = _indexScan(opCtx, ws.get(), @@ -147,7 +148,7 @@ std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> InternalPlanner::deleteWith direction, InternalPlanner::IXSCAN_FETCH); - root = stdx::make_unique<DeleteStage>( + root = std::make_unique<DeleteStage>( opCtx, std::move(params), ws.get(), collection, root.release()); auto executor = @@ -164,11 +165,11 @@ std::unique_ptr<PlanExecutor, PlanExecutor::Deleter> InternalPlanner::updateWith const BSONObj& key, PlanExecutor::YieldPolicy yieldPolicy) { invariant(collection); - auto ws = stdx::make_unique<WorkingSet>(); + auto ws = std::make_unique<WorkingSet>(); - auto idHackStage = stdx::make_unique<IDHackStage>(opCtx, key, ws.get(), descriptor); + auto idHackStage = std::make_unique<IDHackStage>(opCtx, key, ws.get(), descriptor); auto root = - stdx::make_unique<UpdateStage>(opCtx, params, ws.get(), collection, idHackStage.release()); + std::make_unique<UpdateStage>(opCtx, params, ws.get(), collection, idHackStage.release()); auto executor = PlanExecutor::make(opCtx, std::move(ws), std::move(root), collection, yieldPolicy); @@ -193,7 +194,7 @@ std::unique_ptr<PlanStage> InternalPlanner::_collectionScan(OperationContext* op params.direction = CollectionScanParams::BACKWARD; } - return stdx::make_unique<CollectionScan>(opCtx, collection, params, ws, nullptr); + return std::make_unique<CollectionScan>(opCtx, collection, params, ws, nullptr); } std::unique_ptr<PlanStage> InternalPlanner::_indexScan(OperationContext* opCtx, @@ -217,10 +218,10 @@ std::unique_ptr<PlanStage> InternalPlanner::_indexScan(OperationContext* opCtx, params.shouldDedup = descriptor->isMultikey(opCtx); std::unique_ptr<PlanStage> root = - stdx::make_unique<IndexScan>(opCtx, std::move(params), ws, nullptr); + std::make_unique<IndexScan>(opCtx, std::move(params), ws, nullptr); if (InternalPlanner::IXSCAN_FETCH & options) { - root = stdx::make_unique<FetchStage>(opCtx, ws, root.release(), nullptr, collection); + root = std::make_unique<FetchStage>(opCtx, ws, root.release(), nullptr, collection); } return root; diff --git a/src/mongo/db/query/parsed_distinct.cpp b/src/mongo/db/query/parsed_distinct.cpp index 2d5a74af4c0..9ade1492a5d 100644 --- a/src/mongo/db/query/parsed_distinct.cpp +++ b/src/mongo/db/query/parsed_distinct.cpp @@ -31,6 +31,8 @@ #include "mongo/db/query/parsed_distinct.h" +#include <memory> + #include "mongo/bson/bsonelement.h" #include "mongo/bson/util/bson_extract.h" #include "mongo/db/query/canonical_query.h" @@ -38,7 +40,6 @@ #include "mongo/db/query/query_request.h" #include "mongo/db/repl/read_concern_args.h" #include "mongo/idl/idl_parser.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { @@ -265,7 +266,7 @@ StatusWith<ParsedDistinct> ParsedDistinct::parse(OperationContext* opCtx, return exceptionToStatus(); } - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); if (parsedDistinct.getKey().find('\0') != std::string::npos) { return Status(ErrorCodes::Error(31032), "Key field cannot contain an embedded null byte"); diff --git a/src/mongo/db/query/plan_cache.cpp b/src/mongo/db/query/plan_cache.cpp index 4defd1cdd20..ba32ff91e7f 100644 --- a/src/mongo/db/query/plan_cache.cpp +++ b/src/mongo/db/query/plan_cache.cpp @@ -222,7 +222,7 @@ PlanCacheEntry::~PlanCacheEntry() { PlanCacheEntry* PlanCacheEntry::clone() const { std::vector<std::unique_ptr<QuerySolution>> solutions; for (size_t i = 0; i < plannerData.size(); ++i) { - auto qs = stdx::make_unique<QuerySolution>(); + auto qs = std::make_unique<QuerySolution>(); qs->cacheData.reset(plannerData[i]->clone()); solutions.push_back(std::move(qs)); } @@ -585,7 +585,7 @@ PlanCache::GetResult PlanCache::get(const PlanCacheKey& key) const { auto state = entry->isActive ? CacheEntryState::kPresentActive : CacheEntryState::kPresentInactive; - return {state, stdx::make_unique<CachedSolution>(key, *entry)}; + return {state, std::make_unique<CachedSolution>(key, *entry)}; } Status PlanCache::feedback(const CanonicalQuery& cq, double score) { diff --git a/src/mongo/db/query/plan_cache_indexability.cpp b/src/mongo/db/query/plan_cache_indexability.cpp index 7687ed1dca6..9e0d9f717c6 100644 --- a/src/mongo/db/query/plan_cache_indexability.cpp +++ b/src/mongo/db/query/plan_cache_indexability.cpp @@ -31,6 +31,8 @@ #include "mongo/db/query/plan_cache_indexability.h" +#include <memory> + #include "mongo/base/init.h" #include "mongo/base/owned_pointer_vector.h" #include "mongo/db/index/wildcard_key_generator.h" @@ -42,7 +44,6 @@ #include "mongo/db/query/collation/collator_interface.h" #include "mongo/db/query/index_entry.h" #include "mongo/db/query/planner_ixselect.h" -#include "mongo/stdx/memory.h" #include <memory> namespace mongo { diff --git a/src/mongo/db/query/plan_cache_test.cpp b/src/mongo/db/query/plan_cache_test.cpp index 5614137b90a..c6543f5da59 100644 --- a/src/mongo/db/query/plan_cache_test.cpp +++ b/src/mongo/db/query/plan_cache_test.cpp @@ -74,7 +74,7 @@ unique_ptr<CanonicalQuery> canonicalize(const BSONObj& queryObj) { QueryTestServiceContext serviceContext; auto opCtx = serviceContext.makeOperationContext(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(queryObj); const boost::intrusive_ptr<ExpressionContext> expCtx; auto statusWithCQ = @@ -99,7 +99,7 @@ unique_ptr<CanonicalQuery> canonicalize(BSONObj query, QueryTestServiceContext serviceContext; auto opCtx = serviceContext.makeOperationContext(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(query); qr->setSort(sort); qr->setProj(proj); @@ -134,7 +134,7 @@ unique_ptr<CanonicalQuery> canonicalize(const char* queryStr, QueryTestServiceContext serviceContext; auto opCtx = serviceContext.makeOperationContext(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson(queryStr)); qr->setSort(fromjson(sortStr)); qr->setProj(fromjson(projStr)); @@ -170,7 +170,7 @@ unique_ptr<CanonicalQuery> canonicalize(const char* queryStr, QueryTestServiceContext serviceContext; auto opCtx = serviceContext.makeOperationContext(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(fromjson(queryStr)); qr->setSort(fromjson(sortStr)); qr->setProj(fromjson(projStr)); @@ -298,7 +298,7 @@ std::unique_ptr<PlanRankingDecision> createDecision(size_t numPlans, size_t work unique_ptr<PlanRankingDecision> why(new PlanRankingDecision()); for (size_t i = 0; i < numPlans; ++i) { CommonStats common("COLLSCAN"); - auto stats = stdx::make_unique<PlanStageStats>(common, STAGE_COLLSCAN); + auto stats = std::make_unique<PlanStageStats>(common, STAGE_COLLSCAN); stats->specific.reset(new CollectionScanStats()); why->stats.push_back(std::move(stats)); why->stats[i]->common.works = works; @@ -344,8 +344,8 @@ void assertShouldNotCacheQuery(const char* queryStr) { std::unique_ptr<QuerySolution> getQuerySolutionForCaching() { std::unique_ptr<QuerySolution> qs = std::make_unique<QuerySolution>(); - qs->cacheData = stdx::make_unique<SolutionCacheData>(); - qs->cacheData->tree = stdx::make_unique<PlanCacheIndexTree>(); + qs->cacheData = std::make_unique<SolutionCacheData>(); + qs->cacheData->tree = std::make_unique<PlanCacheIndexTree>(); return qs; } @@ -1108,7 +1108,7 @@ protected: QueryTestServiceContext serviceContext; auto opCtx = serviceContext.makeOperationContext(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(query); qr->setSort(sort); qr->setProj(proj); diff --git a/src/mongo/db/query/plan_enumerator.cpp b/src/mongo/db/query/plan_enumerator.cpp index 7c6d498007c..19f2188f303 100644 --- a/src/mongo/db/query/plan_enumerator.cpp +++ b/src/mongo/db/query/plan_enumerator.cpp @@ -805,7 +805,7 @@ void PlanEnumerator::assignPredicate( // This method should only be called if we can combine bounds. const bool canCombineBounds = true; dest.tagData = - stdx::make_unique<IndexTag>(indexAssignment->index, position, canCombineBounds); + std::make_unique<IndexTag>(indexAssignment->index, position, canCombineBounds); indexAssignment->orPushdowns.emplace_back(pred, std::move(dest)); } else { indexAssignment->preds.push_back(pred); diff --git a/src/mongo/db/query/plan_executor_impl.cpp b/src/mongo/db/query/plan_executor_impl.cpp index b01b49efba9..849993364c5 100644 --- a/src/mongo/db/query/plan_executor_impl.cpp +++ b/src/mongo/db/query/plan_executor_impl.cpp @@ -33,6 +33,8 @@ #include "mongo/db/query/plan_executor_impl.h" +#include <memory> + #include "mongo/bson/simple_bsonobj_comparator.h" #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" @@ -54,7 +56,6 @@ #include "mongo/db/query/plan_yield_policy.h" #include "mongo/db/repl/replication_coordinator.h" #include "mongo/db/service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/log.h" #include "mongo/util/scopeguard.h" @@ -91,13 +92,13 @@ std::unique_ptr<PlanYieldPolicy> makeYieldPolicy(PlanExecutor* exec, case PlanExecutor::YieldPolicy::NO_YIELD: case PlanExecutor::YieldPolicy::WRITE_CONFLICT_RETRY_ONLY: case PlanExecutor::YieldPolicy::INTERRUPT_ONLY: { - return stdx::make_unique<PlanYieldPolicy>(exec, policy); + return std::make_unique<PlanYieldPolicy>(exec, policy); } case PlanExecutor::YieldPolicy::ALWAYS_TIME_OUT: { - return stdx::make_unique<AlwaysTimeOutYieldPolicy>(exec); + return std::make_unique<AlwaysTimeOutYieldPolicy>(exec); } case PlanExecutor::YieldPolicy::ALWAYS_MARK_KILLED: { - return stdx::make_unique<AlwaysPlanKilledYieldPolicy>(exec); + return std::make_unique<AlwaysPlanKilledYieldPolicy>(exec); } default: MONGO_UNREACHABLE; diff --git a/src/mongo/db/query/planner_access.cpp b/src/mongo/db/query/planner_access.cpp index 7065fa25e9b..9ac03670c3a 100644 --- a/src/mongo/db/query/planner_access.cpp +++ b/src/mongo/db/query/planner_access.cpp @@ -50,7 +50,6 @@ #include "mongo/db/query/query_knobs_gen.h" #include "mongo/db/query/query_planner.h" #include "mongo/db/query/query_planner_common.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/transitional_tools_do_not_use/vector_spooling.h" @@ -143,12 +142,11 @@ namespace mongo { using std::unique_ptr; using std::vector; -using stdx::make_unique; std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::makeCollectionScan( const CanonicalQuery& query, bool tailable, const QueryPlannerParams& params) { // Make the (only) node, a collection scan. - auto csn = stdx::make_unique<CollectionScanNode>(); + auto csn = std::make_unique<CollectionScanNode>(); csn->name = query.ns(); csn->filter = query.root()->shallowClone(); csn->tailable = tailable; @@ -204,7 +202,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::makeLeafNode( bool indexIs2D = (String == elt.type() && "2d" == elt.String()); if (indexIs2D) { - auto ret = stdx::make_unique<GeoNear2DNode>(index); + auto ret = std::make_unique<GeoNear2DNode>(index); ret->nq = &nearExpr->getData(); ret->baseBounds.fields.resize(index.keyPattern.nFields()); if (NULL != query.getProj()) { @@ -214,7 +212,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::makeLeafNode( return std::move(ret); } else { - auto ret = stdx::make_unique<GeoNear2DSphereNode>(index); + auto ret = std::make_unique<GeoNear2DSphereNode>(index); ret->nq = &nearExpr->getData(); ret->baseBounds.fields.resize(index.keyPattern.nFields()); if (NULL != query.getProj()) { @@ -227,7 +225,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::makeLeafNode( // We must not keep the expression node around. *tightnessOut = IndexBoundsBuilder::EXACT; auto textExpr = static_cast<const TextMatchExpressionBase*>(expr); - auto ret = stdx::make_unique<TextNode>(index); + auto ret = std::make_unique<TextNode>(index); ret->ftsQuery = textExpr->getFTSQuery().clone(); // Count the number of prefix fields before the "text" field. @@ -244,7 +242,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::makeLeafNode( } else { // Note that indexKeyPattern.firstElement().fieldName() may not equal expr->path() // because expr might be inside an array operator that provides a path prefix. - auto isn = stdx::make_unique<IndexScanNode>(index); + auto isn = std::make_unique<IndexScanNode>(index); isn->bounds.fields.resize(index.keyPattern.nFields()); isn->addKeyMetadata = query.getQueryRequest().returnKey(); isn->queryCollator = query.getCollator(); @@ -552,7 +550,7 @@ void QueryPlannerAccess::finishAndOutputLeaf(ScanBuildingState* scanState, // In order to correctly evaluate the predicates for this index, we have to // fetch the full documents. Add a fetch node above the index scan whose filter // includes *all* of the predicates used to generate the ixscan. - auto fetch = stdx::make_unique<FetchNode>(); + auto fetch = std::make_unique<FetchNode>(); // Takes ownership. fetch->filter = std::move(scanState->curOr); // Takes ownership. @@ -700,7 +698,7 @@ std::vector<std::unique_ptr<QuerySolutionNode>> QueryPlannerAccess::collapseEqui // Both the 'from' and 'into' nodes have filters. We join them with an // OrMatchExpression. std::unique_ptr<OrMatchExpression> collapsedFilter = - stdx::make_unique<OrMatchExpression>(); + std::make_unique<OrMatchExpression>(); collapsedFilter->add(collapseFromFetch->filter.release()); collapsedFilter->add(collapseIntoFetch->filter.release()); @@ -1012,12 +1010,12 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::buildIndexedAnd( } } if (allSortedByDiskLoc) { - auto asn = stdx::make_unique<AndSortedNode>(); + auto asn = std::make_unique<AndSortedNode>(); asn->addChildren(std::move(ixscanNodes)); andResult = std::move(asn); } else if (internalQueryPlannerEnableHashIntersection.load()) { { - auto ahn = stdx::make_unique<AndHashNode>(); + auto ahn = std::make_unique<AndHashNode>(); ahn->addChildren(std::move(ixscanNodes)); andResult = std::move(ahn); } @@ -1054,7 +1052,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::buildIndexedAnd( // matches all indexed predicates simultaneously. Therefore, it is necessary to add a fetch // stage which will explicitly evaluate the entire predicate (see SERVER-16750). invariant(clonedRoot); - auto fetch = stdx::make_unique<FetchNode>(); + auto fetch = std::make_unique<FetchNode>(); fetch->filter = std::move(clonedRoot); // Takes ownership of 'andResult'. fetch->children.push_back(andResult.release()); @@ -1064,7 +1062,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::buildIndexedAnd( // If there are any nodes still attached to the AND, we can't answer them using the // index, so we put a fetch with filter. if (root->numChildren() > 0) { - auto fetch = stdx::make_unique<FetchNode>(); + auto fetch = std::make_unique<FetchNode>(); verify(ownedRoot); if (ownedRoot->numChildren() == 1) { // An $and of one thing is that thing. @@ -1140,12 +1138,12 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::buildIndexedOr( } } - auto msn = stdx::make_unique<MergeSortNode>(); + auto msn = std::make_unique<MergeSortNode>(); msn->sort = query.getQueryRequest().getSort(); msn->addChildren(std::move(ixscanNodes)); orResult = std::move(msn); } else { - auto orn = stdx::make_unique<OrNode>(); + auto orn = std::make_unique<OrNode>(); orn->addChildren(std::move(ixscanNodes)); orResult = std::move(orn); } @@ -1222,7 +1220,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::_buildIndexedDataAccess( soln->filter = std::move(ownedRoot); return soln; } else { - auto fetch = stdx::make_unique<FetchNode>(); + auto fetch = std::make_unique<FetchNode>(); fetch->filter = std::move(ownedRoot); fetch->children.push_back(soln.release()); return std::move(fetch); @@ -1246,7 +1244,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::_buildIndexedDataAccess( return solution; } - auto fetch = stdx::make_unique<FetchNode>(); + auto fetch = std::make_unique<FetchNode>(); fetch->filter = std::move(ownedRoot); fetch->children.push_back(solution.release()); return std::move(fetch); @@ -1264,7 +1262,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::scanWholeIndex( std::unique_ptr<QuerySolutionNode> solnRoot; // Build an ixscan over the id index, use it, and return it. - unique_ptr<IndexScanNode> isn = make_unique<IndexScanNode>(index); + unique_ptr<IndexScanNode> isn = std::make_unique<IndexScanNode>(index); isn->addKeyMetadata = query.getQueryRequest().returnKey(); isn->queryCollator = query.getCollator(); @@ -1283,7 +1281,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::scanWholeIndex( } else { // TODO: We may not need to do the fetch if the predicates in root are covered. But // for now it's safe (though *maybe* slower). - unique_ptr<FetchNode> fetch = make_unique<FetchNode>(); + unique_ptr<FetchNode> fetch = std::make_unique<FetchNode>(); fetch->filter = std::move(filter); fetch->children.push_back(isn.release()); solnRoot = std::move(fetch); @@ -1308,10 +1306,10 @@ void QueryPlannerAccess::addFilterToSolutionNode(QuerySolutionNode* node, // by adding an OR node. unique_ptr<ListOfMatchExpression> listFilter; if (MatchExpression::AND == type) { - listFilter = make_unique<AndMatchExpression>(); + listFilter = std::make_unique<AndMatchExpression>(); } else { verify(MatchExpression::OR == type); - listFilter = make_unique<OrMatchExpression>(); + listFilter = std::make_unique<OrMatchExpression>(); } unique_ptr<MatchExpression> oldFilter = node->filter->shallowClone(); listFilter->add(oldFilter.release()); @@ -1395,7 +1393,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::makeIndexScan( std::unique_ptr<QuerySolutionNode> solnRoot; // Build an ixscan over the id index, use it, and return it. - auto isn = stdx::make_unique<IndexScanNode>(index); + auto isn = std::make_unique<IndexScanNode>(index); isn->direction = 1; isn->addKeyMetadata = query.getQueryRequest().returnKey(); isn->bounds.isSimpleRange = true; @@ -1412,7 +1410,7 @@ std::unique_ptr<QuerySolutionNode> QueryPlannerAccess::makeIndexScan( } else { // TODO: We may not need to do the fetch if the predicates in root are covered. But // for now it's safe (though *maybe* slower). - unique_ptr<FetchNode> fetch = make_unique<FetchNode>(); + unique_ptr<FetchNode> fetch = std::make_unique<FetchNode>(); fetch->filter = std::move(filter); fetch->children.push_back(isn.release()); solnRoot = std::move(fetch); diff --git a/src/mongo/db/query/planner_access.h b/src/mongo/db/query/planner_access.h index e663b0a6189..e0744d55311 100644 --- a/src/mongo/db/query/planner_access.h +++ b/src/mongo/db/query/planner_access.h @@ -163,7 +163,7 @@ private: loosestBounds = IndexBoundsBuilder::EXACT; if (MatchExpression::OR == root->matchType()) { - curOr = stdx::make_unique<OrMatchExpression>(); + curOr = std::make_unique<OrMatchExpression>(); } } diff --git a/src/mongo/db/query/planner_analysis_test.cpp b/src/mongo/db/query/planner_analysis_test.cpp index d7c7fe5ffc8..57102d314cf 100644 --- a/src/mongo/db/query/planner_analysis_test.cpp +++ b/src/mongo/db/query/planner_analysis_test.cpp @@ -195,9 +195,9 @@ TEST(QueryPlannerAnalysis, GeoSkipValidation) { QueryPlannerParams params; - std::unique_ptr<FetchNode> fetchNodePtr = stdx::make_unique<FetchNode>(); + std::unique_ptr<FetchNode> fetchNodePtr = std::make_unique<FetchNode>(); std::unique_ptr<GeoMatchExpression> exprPtr = - stdx::make_unique<GeoMatchExpression>("geometry.field", nullptr, BSONObj()); + std::make_unique<GeoMatchExpression>("geometry.field", nullptr, BSONObj()); GeoMatchExpression* expr = exprPtr.get(); diff --git a/src/mongo/db/query/query_planner.cpp b/src/mongo/db/query/query_planner.cpp index 9e8349b18d5..ad97acfc6c1 100644 --- a/src/mongo/db/query/query_planner.cpp +++ b/src/mongo/db/query/query_planner.cpp @@ -303,7 +303,7 @@ StatusWith<std::unique_ptr<PlanCacheIndexTree>> QueryPlanner::cacheDataFromTagge return Status(ErrorCodes::BadValue, "Cannot produce cache data: tree is NULL."); } - auto indexTree = stdx::make_unique<PlanCacheIndexTree>(); + auto indexTree = std::make_unique<PlanCacheIndexTree>(); if (taggedTree->getTag() && taggedTree->getTag()->getType() == MatchExpression::TagData::Type::IndexTag) { @@ -341,7 +341,7 @@ StatusWith<std::unique_ptr<PlanCacheIndexTree>> QueryPlanner::cacheDataFromTagge } std::unique_ptr<IndexEntry> indexEntry = - stdx::make_unique<IndexEntry>(relevantIndices[itag->index]); + std::make_unique<IndexEntry>(relevantIndices[itag->index]); indexTree->entry.reset(indexEntry.release()); indexTree->index_pos = itag->pos; indexTree->canCombineBounds = itag->canCombineBounds; @@ -411,7 +411,7 @@ Status QueryPlanner::tagAccordingToCache(MatchExpression* filter, } OrPushdownTag::Destination dest; dest.route = orPushdown.route; - dest.tagData = stdx::make_unique<IndexTag>( + dest.tagData = std::make_unique<IndexTag>( index->second, orPushdown.position, orPushdown.canCombineBounds); orPushdownTag->addDestination(std::move(dest)); } diff --git a/src/mongo/db/query/query_planner_test.cpp b/src/mongo/db/query/query_planner_test.cpp index 3c38b272fd1..757625df59d 100644 --- a/src/mongo/db/query/query_planner_test.cpp +++ b/src/mongo/db/query/query_planner_test.cpp @@ -4610,7 +4610,7 @@ TEST_F(QueryPlannerTest, CacheDataFromTaggedTreeFailsOnBadInput) { // No relevant index matching the index tag. relevantIndices.push_back(buildSimpleIndexEntry(BSON("a" << 1), "a_1")); - auto qr = stdx::make_unique<QueryRequest>(NamespaceString("test.collection")); + auto qr = std::make_unique<QueryRequest>(NamespaceString("test.collection")); qr->setFilter(BSON("a" << 3)); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx.get(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); @@ -4624,7 +4624,7 @@ TEST_F(QueryPlannerTest, CacheDataFromTaggedTreeFailsOnBadInput) { TEST_F(QueryPlannerTest, TagAccordingToCacheFailsOnBadInput) { const NamespaceString nss("test.collection"); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(BSON("a" << 3)); auto statusWithCQ = CanonicalQuery::canonicalize(opCtx.get(), std::move(qr)); ASSERT_OK(statusWithCQ.getStatus()); @@ -4653,7 +4653,7 @@ TEST_F(QueryPlannerTest, TagAccordingToCacheFailsOnBadInput) { ASSERT_OK(s); // Regenerate canonical query in order to clear tags. - auto newQR = stdx::make_unique<QueryRequest>(nss); + auto newQR = std::make_unique<QueryRequest>(nss); newQR->setFilter(BSON("a" << 3)); statusWithCQ = CanonicalQuery::canonicalize(opCtx.get(), std::move(newQR)); ASSERT_OK(statusWithCQ.getStatus()); diff --git a/src/mongo/db/query/query_planner_test_fixture.cpp b/src/mongo/db/query/query_planner_test_fixture.cpp index 59306ff1feb..d96e3e822f0 100644 --- a/src/mongo/db/query/query_planner_test_fixture.cpp +++ b/src/mongo/db/query/query_planner_test_fixture.cpp @@ -308,7 +308,7 @@ void QueryPlannerTest::runQueryFull(const BSONObj& query, const BSONObj& maxObj) { clearState(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(query); qr->setSort(sort); qr->setProj(proj); @@ -389,7 +389,7 @@ void QueryPlannerTest::runInvalidQueryFull(const BSONObj& query, const BSONObj& maxObj) { clearState(); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(query); qr->setSort(sort); qr->setProj(proj); diff --git a/src/mongo/db/query/query_request.cpp b/src/mongo/db/query/query_request.cpp index c43317b584b..5072c883430 100644 --- a/src/mongo/db/query/query_request.cpp +++ b/src/mongo/db/query/query_request.cpp @@ -31,6 +31,8 @@ #include "mongo/db/query/query_request.h" +#include <memory> + #include "mongo/base/status.h" #include "mongo/base/status_with.h" #include "mongo/bson/simple_bsonobj_comparator.h" @@ -40,7 +42,6 @@ #include "mongo/db/dbmessage.h" #include "mongo/db/namespace_string.h" #include "mongo/db/repl/read_concern_args.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/str.h" @@ -426,10 +427,10 @@ StatusWith<unique_ptr<QueryRequest>> QueryRequest::makeFromFindCommand(Namespace BSONElement first = cmdObj.firstElement(); if (first.type() == BinData && first.binDataType() == BinDataType::newUUID) { auto uuid = uassertStatusOK(UUID::parse(first)); - auto qr = stdx::make_unique<QueryRequest>(NamespaceStringOrUUID(nss.db().toString(), uuid)); + auto qr = std::make_unique<QueryRequest>(NamespaceStringOrUUID(nss.db().toString(), uuid)); return parseFromFindCommand(std::move(qr), cmdObj, isExplain); } else { - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); return parseFromFindCommand(std::move(qr), cmdObj, isExplain); } } @@ -765,7 +766,7 @@ bool QueryRequest::isValidSortOrder(const BSONObj& sortObj) { // static StatusWith<unique_ptr<QueryRequest>> QueryRequest::fromLegacyQueryMessage(const QueryMessage& qm) { - auto qr = stdx::make_unique<QueryRequest>(NamespaceString(qm.ns)); + auto qr = std::make_unique<QueryRequest>(NamespaceString(qm.ns)); Status status = qr->init(qm.ntoskip, qm.ntoreturn, qm.queryOptions, qm.query, qm.fields, true); if (!status.isOK()) { @@ -781,7 +782,7 @@ StatusWith<unique_ptr<QueryRequest>> QueryRequest::fromLegacyQuery(NamespaceStri int ntoskip, int ntoreturn, int queryOptions) { - auto qr = stdx::make_unique<QueryRequest>(nsOrUuid); + auto qr = std::make_unique<QueryRequest>(nsOrUuid); Status status = qr->init(ntoskip, ntoreturn, queryOptions, queryObj, proj, true); if (!status.isOK()) { diff --git a/src/mongo/db/query/query_solution_test.cpp b/src/mongo/db/query/query_solution_test.cpp index 7ac47cb2aad..5a143a5a5c5 100644 --- a/src/mongo/db/query/query_solution_test.cpp +++ b/src/mongo/db/query/query_solution_test.cpp @@ -31,6 +31,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/bson/bsontypes.h" #include "mongo/bson/json.h" #include "mongo/db/query/collation/collator_interface_mock.h" @@ -38,7 +40,6 @@ #include "mongo/db/query/index_entry.h" #include "mongo/db/query/query_solution.h" #include "mongo/db/query/query_test_service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace { @@ -737,7 +738,7 @@ auto createMatchExprAndParsedProjection(const BSONObj& query, const BSONObj& pro TEST(QuerySolutionTest, InclusionProjectionPreservesSort) { auto index = buildSimpleIndexEntry(BSON("a" << 1)); - auto node = stdx::make_unique<IndexScanNode>(index); + auto node = std::make_unique<IndexScanNode>(index); BSONObj projection = BSON("a" << 1); BSONObj match; @@ -756,7 +757,7 @@ TEST(QuerySolutionTest, InclusionProjectionPreservesSort) { TEST(QuerySolutionTest, ExclusionProjectionDoesNotPreserveSort) { auto index = buildSimpleIndexEntry(BSON("a" << 1)); - auto node = stdx::make_unique<IndexScanNode>(index); + auto node = std::make_unique<IndexScanNode>(index); BSONObj projection = BSON("a" << 0); BSONObj match; @@ -773,7 +774,7 @@ TEST(QuerySolutionTest, ExclusionProjectionDoesNotPreserveSort) { } TEST(QuerySolutionTest, InclusionProjectionTruncatesSort) { - auto node = stdx::make_unique<IndexScanNode>(buildSimpleIndexEntry(BSON("a" << 1 << "b" << 1))); + auto node = std::make_unique<IndexScanNode>(buildSimpleIndexEntry(BSON("a" << 1 << "b" << 1))); BSONObj projection = BSON("a" << 1); BSONObj match; @@ -791,7 +792,7 @@ TEST(QuerySolutionTest, InclusionProjectionTruncatesSort) { } TEST(QuerySolutionTest, ExclusionProjectionTruncatesSort) { - auto node = stdx::make_unique<IndexScanNode>(buildSimpleIndexEntry(BSON("a" << 1 << "b" << 1))); + auto node = std::make_unique<IndexScanNode>(buildSimpleIndexEntry(BSON("a" << 1 << "b" << 1))); BSONObj projection = BSON("b" << 0); BSONObj match; @@ -810,7 +811,7 @@ TEST(QuerySolutionTest, ExclusionProjectionTruncatesSort) { TEST(QuerySolutionTest, NonMultikeyIndexWithoutPathLevelInfoCanCoverItsFields) { auto node = - stdx::make_unique<IndexScanNode>(buildSimpleIndexEntry(BSON("a" << 1 << "b.c.d" << 1))); + std::make_unique<IndexScanNode>(buildSimpleIndexEntry(BSON("a" << 1 << "b.c.d" << 1))); node->index.multikey = false; node->index.multikeyPaths = MultikeyPaths{}; ASSERT_TRUE(node->hasField("a")); @@ -822,7 +823,7 @@ TEST(QuerySolutionTest, NonMultikeyIndexWithoutPathLevelInfoCanCoverItsFields) { TEST(QuerySolutionTest, NonMultikeyIndexWithPathLevelInfoCanCoverItsFields) { auto node = - stdx::make_unique<IndexScanNode>(buildSimpleIndexEntry(BSON("a" << 1 << "b.c.d" << 1))); + std::make_unique<IndexScanNode>(buildSimpleIndexEntry(BSON("a" << 1 << "b.c.d" << 1))); node->index.multikey = false; node->index.multikeyPaths = MultikeyPaths{{}, {}}; ASSERT_TRUE(node->hasField("a")); @@ -834,7 +835,7 @@ TEST(QuerySolutionTest, NonMultikeyIndexWithPathLevelInfoCanCoverItsFields) { TEST(QuerySolutionTest, MultikeyIndexWithoutPathLevelInfoCannotCoverAnyFields) { auto node = - stdx::make_unique<IndexScanNode>(buildSimpleIndexEntry(BSON("a" << 1 << "b.c.d" << 1))); + std::make_unique<IndexScanNode>(buildSimpleIndexEntry(BSON("a" << 1 << "b.c.d" << 1))); node->index.multikey = true; node->index.multikeyPaths = MultikeyPaths{}; ASSERT_FALSE(node->hasField("a")); @@ -845,7 +846,7 @@ TEST(QuerySolutionTest, MultikeyIndexWithoutPathLevelInfoCannotCoverAnyFields) { } TEST(QuerySolutionTest, MultikeyIndexWithPathLevelInfoCanCoverNonMultikeyFields) { - auto node = stdx::make_unique<IndexScanNode>( + auto node = std::make_unique<IndexScanNode>( buildSimpleIndexEntry(BSON("a" << 1 << "b" << 1 << "c" << 1))); // Add metadata indicating that "b" is multikey. @@ -859,7 +860,7 @@ TEST(QuerySolutionTest, MultikeyIndexWithPathLevelInfoCanCoverNonMultikeyFields) } TEST(QuerySolutionTest, MultikeyIndexCannotCoverFieldWithAnyMultikeyPathComponent) { - auto node = stdx::make_unique<IndexScanNode>( + auto node = std::make_unique<IndexScanNode>( buildSimpleIndexEntry(BSON("a" << 1 << "b.c.d" << 1 << "e" << 1))); // Add metadata indicating that "b.c" is multikey. diff --git a/src/mongo/db/query/query_test_service_context.cpp b/src/mongo/db/query/query_test_service_context.cpp index a6088793f8e..c44836fa6be 100644 --- a/src/mongo/db/query/query_test_service_context.cpp +++ b/src/mongo/db/query/query_test_service_context.cpp @@ -31,15 +31,16 @@ #include "mongo/db/query/query_test_service_context.h" +#include <memory> + #include "mongo/db/operation_context.h" #include "mongo/db/query/collation/collator_factory_mock.h" -#include "mongo/stdx/memory.h" namespace mongo { QueryTestServiceContext::QueryTestServiceContext() : _service(ServiceContext::make()), _client(_service->makeClient("query_test")) { - CollatorFactoryInterface::set(getServiceContext(), stdx::make_unique<CollatorFactoryMock>()); + CollatorFactoryInterface::set(getServiceContext(), std::make_unique<CollatorFactoryMock>()); } QueryTestServiceContext::~QueryTestServiceContext() = default; diff --git a/src/mongo/db/query/stage_builder.cpp b/src/mongo/db/query/stage_builder.cpp index 012efb8a262..ac2295c4985 100644 --- a/src/mongo/db/query/stage_builder.cpp +++ b/src/mongo/db/query/stage_builder.cpp @@ -33,6 +33,8 @@ #include "mongo/db/query/stage_builder.h" +#include <memory> + #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" #include "mongo/db/catalog/index_catalog.h" @@ -58,13 +60,11 @@ #include "mongo/db/index/fts_access_method.h" #include "mongo/db/matcher/extensions_callback_real.h" #include "mongo/db/s/collection_sharding_state.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" namespace mongo { using std::unique_ptr; -using stdx::make_unique; PlanStage* buildStages(OperationContext* opCtx, const Collection* collection, @@ -192,7 +192,7 @@ PlanStage* buildStages(OperationContext* opCtx, } case STAGE_AND_HASH: { const AndHashNode* ahn = static_cast<const AndHashNode*>(root); - auto ret = make_unique<AndHashStage>(opCtx, ws); + auto ret = std::make_unique<AndHashStage>(opCtx, ws); for (size_t i = 0; i < ahn->children.size(); ++i) { PlanStage* childStage = buildStages(opCtx, collection, cq, qsol, ahn->children[i], ws); @@ -205,7 +205,7 @@ PlanStage* buildStages(OperationContext* opCtx, } case STAGE_OR: { const OrNode* orn = static_cast<const OrNode*>(root); - auto ret = make_unique<OrStage>(opCtx, ws, orn->dedup, orn->filter.get()); + auto ret = std::make_unique<OrStage>(opCtx, ws, orn->dedup, orn->filter.get()); for (size_t i = 0; i < orn->children.size(); ++i) { PlanStage* childStage = buildStages(opCtx, collection, cq, qsol, orn->children[i], ws); @@ -218,7 +218,7 @@ PlanStage* buildStages(OperationContext* opCtx, } case STAGE_AND_SORTED: { const AndSortedNode* asn = static_cast<const AndSortedNode*>(root); - auto ret = make_unique<AndSortedStage>(opCtx, ws); + auto ret = std::make_unique<AndSortedStage>(opCtx, ws); for (size_t i = 0; i < asn->children.size(); ++i) { PlanStage* childStage = buildStages(opCtx, collection, cq, qsol, asn->children[i], ws); @@ -235,7 +235,7 @@ PlanStage* buildStages(OperationContext* opCtx, params.dedup = msn->dedup; params.pattern = msn->sort; params.collator = cq.getCollator(); - auto ret = make_unique<MergeSortStage>(opCtx, params, ws); + auto ret = std::make_unique<MergeSortStage>(opCtx, params, ws); for (size_t i = 0; i < msn->children.size(); ++i) { PlanStage* childStage = buildStages(opCtx, collection, cq, qsol, msn->children[i], ws); diff --git a/src/mongo/db/repl/abstract_async_component_test.cpp b/src/mongo/db/repl/abstract_async_component_test.cpp index 4fdc4128cb7..c6f3703b960 100644 --- a/src/mongo/db/repl/abstract_async_component_test.cpp +++ b/src/mongo/db/repl/abstract_async_component_test.cpp @@ -29,11 +29,12 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/base/status.h" #include "mongo/db/repl/abstract_async_component.h" #include "mongo/db/repl/task_executor_mock.h" #include "mongo/executor/thread_pool_task_executor_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/unittest/unittest.h" @@ -462,7 +463,7 @@ TEST_F(AbstractAsyncComponentTest, ASSERT_EQUALS(AbstractAsyncComponent::State::kRunning, component.getState_forTest()); // Create a child component to pass to _startupComponent_inlock(). - auto childComponent = stdx::make_unique<MockAsyncComponent>(&getExecutor()); + auto childComponent = std::make_unique<MockAsyncComponent>(&getExecutor()); ASSERT_OK(component.startupComponent_forTest(childComponent)); ASSERT_EQUALS(AbstractAsyncComponent::State::kRunning, childComponent->getState_forTest()); } @@ -479,7 +480,7 @@ TEST_F(AbstractAsyncComponentTest, // Create a child component to pass to _startupComponent_inlock(). // _startupComponent_inlock() should return early because 'component' is shutting down and // reset the unique_ptr for the child component. - auto childComponent = stdx::make_unique<MockAsyncComponent>(&getExecutor()); + auto childComponent = std::make_unique<MockAsyncComponent>(&getExecutor()); ASSERT_EQUALS(ErrorCodes::CallbackCanceled, component.startupComponent_forTest(childComponent)); ASSERT_FALSE(childComponent); } @@ -492,7 +493,7 @@ TEST_F(AbstractAsyncComponentTest, // Create a child component to pass to _startupComponent_inlock(). Transition child component's // state to Complete so that calling startup() will fail. - auto childComponent = stdx::make_unique<MockAsyncComponent>(&getExecutor()); + auto childComponent = std::make_unique<MockAsyncComponent>(&getExecutor()); ASSERT_OK(childComponent->startup()); childComponent->shutdown(); ASSERT_EQUALS(ErrorCodes::ShutdownInProgress, childComponent->startup()); @@ -517,7 +518,7 @@ TEST_F(AbstractAsyncComponentTest, ASSERT_EQUALS(AbstractAsyncComponent::State::kRunning, component.getState_forTest()); // Create a child component to pass to _startupComponent_inlock(). - auto childComponent = stdx::make_unique<MockAsyncComponent>(&getExecutor()); + auto childComponent = std::make_unique<MockAsyncComponent>(&getExecutor()); ASSERT_OK(childComponent->startup()); ASSERT_EQUALS(AbstractAsyncComponent::State::kRunning, childComponent->getState_forTest()); diff --git a/src/mongo/db/repl/abstract_oplog_fetcher.cpp b/src/mongo/db/repl/abstract_oplog_fetcher.cpp index a3f27e65e94..4bb2762219a 100644 --- a/src/mongo/db/repl/abstract_oplog_fetcher.cpp +++ b/src/mongo/db/repl/abstract_oplog_fetcher.cpp @@ -33,12 +33,13 @@ #include "mongo/db/repl/abstract_oplog_fetcher.h" +#include <memory> + #include "mongo/base/counter.h" #include "mongo/bson/util/bson_extract.h" #include "mongo/db/commands/server_status_metric.h" #include "mongo/db/jsobj.h" #include "mongo/db/repl/repl_server_parameters_gen.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" @@ -308,7 +309,7 @@ void AbstractOplogFetcher::_finishCallback(Status status) { std::unique_ptr<Fetcher> AbstractOplogFetcher::_makeFetcher(const BSONObj& findCommandObj, const BSONObj& metadataObj, Milliseconds findMaxTime) { - return stdx::make_unique<Fetcher>( + return std::make_unique<Fetcher>( _getExecutor(), _source, _nss.db().toString(), diff --git a/src/mongo/db/repl/abstract_oplog_fetcher_test.cpp b/src/mongo/db/repl/abstract_oplog_fetcher_test.cpp index 6fe6ed75665..7c35e08ab76 100644 --- a/src/mongo/db/repl/abstract_oplog_fetcher_test.cpp +++ b/src/mongo/db/repl/abstract_oplog_fetcher_test.cpp @@ -29,11 +29,12 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/repl/abstract_oplog_fetcher.h" #include "mongo/db/repl/abstract_oplog_fetcher_test_fixture.h" #include "mongo/db/repl/oplog_entry.h" #include "mongo/db/repl/task_executor_mock.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/task_executor_proxy.h" #include "mongo/unittest/unittest.h" #include "mongo/util/scopeguard.h" @@ -255,7 +256,7 @@ TEST_F(AbstractOplogFetcherTest, OplogFetcherCreatesNewFetcherOnCallbackErrorDuringGetMoreNumberOne) { auto ops = _generateOplogEntries(5U); std::size_t maxFetcherRestarts = 1U; - auto shutdownState = stdx::make_unique<ShutdownState>(); + auto shutdownState = std::make_unique<ShutdownState>(); MockOplogFetcher oplogFetcher(&getExecutor(), _getOpTime(ops[0]), source, @@ -287,7 +288,7 @@ TEST_F(AbstractOplogFetcherTest, TEST_F(AbstractOplogFetcherTest, OplogFetcherStopsRestartingFetcherIfRestartLimitIsReached) { auto ops = _generateOplogEntries(3U); std::size_t maxFetcherRestarts = 2U; - auto shutdownState = stdx::make_unique<ShutdownState>(); + auto shutdownState = std::make_unique<ShutdownState>(); MockOplogFetcher oplogFetcher(&getExecutor(), _getOpTime(ops[0]), source, @@ -323,7 +324,7 @@ TEST_F(AbstractOplogFetcherTest, OplogFetcherStopsRestartingFetcherIfRestartLimi TEST_F(AbstractOplogFetcherTest, OplogFetcherResetsRestartCounterOnSuccessfulFetcherResponse) { auto ops = _generateOplogEntries(5U); std::size_t maxFetcherRestarts = 2U; - auto shutdownState = stdx::make_unique<ShutdownState>(); + auto shutdownState = std::make_unique<ShutdownState>(); MockOplogFetcher oplogFetcher(&getExecutor(), _getOpTime(ops[0]), source, @@ -388,7 +389,7 @@ TEST_F(AbstractOplogFetcherTest, OplogFetcherAbortsWithOriginalResponseErrorOnFailureToScheduleNewFetcher) { auto ops = _generateOplogEntries(3U); std::size_t maxFetcherRestarts = 2U; - auto shutdownState = stdx::make_unique<ShutdownState>(); + auto shutdownState = std::make_unique<ShutdownState>(); bool shouldFailSchedule = false; TaskExecutorWithFailureInScheduleRemoteCommand _executorProxy( &getExecutor(), [&shouldFailSchedule](const executor::RemoteCommandRequest& request) { @@ -424,7 +425,7 @@ TEST_F(AbstractOplogFetcherTest, TEST_F(AbstractOplogFetcherTest, OplogFetcherTimesOutCorrectlyOnInitialFindRequests) { auto ops = _generateOplogEntries(2U); std::size_t maxFetcherRestarts = 0U; - auto shutdownState = stdx::make_unique<ShutdownState>(); + auto shutdownState = std::make_unique<ShutdownState>(); MockOplogFetcher oplogFetcher(&getExecutor(), _getOpTime(ops[0]), source, @@ -462,7 +463,7 @@ TEST_F(AbstractOplogFetcherTest, OplogFetcherTimesOutCorrectlyOnInitialFindReque TEST_F(AbstractOplogFetcherTest, OplogFetcherTimesOutCorrectlyOnRetriedFindRequests) { auto ops = _generateOplogEntries(2U); std::size_t maxFetcherRestarts = 1U; - auto shutdownState = stdx::make_unique<ShutdownState>(); + auto shutdownState = std::make_unique<ShutdownState>(); MockOplogFetcher oplogFetcher(&getExecutor(), _getOpTime(ops[0]), source, diff --git a/src/mongo/db/repl/apply_ops.cpp b/src/mongo/db/repl/apply_ops.cpp index c1e4c184952..179110c0e70 100644 --- a/src/mongo/db/repl/apply_ops.cpp +++ b/src/mongo/db/repl/apply_ops.cpp @@ -422,7 +422,7 @@ Status applyOps(OperationContext* opCtx, BSONObjBuilder intermediateResult; std::unique_ptr<BSONArrayBuilder> opsBuilder; if (opCtx->writesAreReplicated()) { - opsBuilder = stdx::make_unique<BSONArrayBuilder>(); + opsBuilder = std::make_unique<BSONArrayBuilder>(); } WriteUnitOfWork wunit(opCtx); numApplied = 0; diff --git a/src/mongo/db/repl/apply_ops_test.cpp b/src/mongo/db/repl/apply_ops_test.cpp index 13575d81fb0..6416f751a2f 100644 --- a/src/mongo/db/repl/apply_ops_test.cpp +++ b/src/mongo/db/repl/apply_ops_test.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/catalog/collection_options.h" #include "mongo/db/catalog/database_holder.h" #include "mongo/db/client.h" @@ -40,7 +42,6 @@ #include "mongo/db/service_context_d_test_fixture.h" #include "mongo/logger/logger.h" #include "mongo/rpc/get_status_from_command_result.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace repl { @@ -91,7 +92,7 @@ void ApplyOpsTest::setUp() { auto opCtx = cc().makeOperationContext(); // Set up ReplicationCoordinator and create oplog. - ReplicationCoordinator::set(service, stdx::make_unique<ReplicationCoordinatorMock>(service)); + ReplicationCoordinator::set(service, std::make_unique<ReplicationCoordinatorMock>(service)); setOplogCollectionName(service); createOplog(opCtx.get()); @@ -100,13 +101,13 @@ void ApplyOpsTest::setUp() { ASSERT_OK(replCoord->setFollowerMode(MemberState::RS_PRIMARY)); // Use OpObserverMock to track notifications for applyOps(). - auto opObserver = stdx::make_unique<OpObserverMock>(); + auto opObserver = std::make_unique<OpObserverMock>(); _opObserver = opObserver.get(); service->setOpObserver(std::move(opObserver)); // This test uses StorageInterface to create collections and inspect documents inside // collections. - _storage = stdx::make_unique<StorageInterfaceImpl>(); + _storage = std::make_unique<StorageInterfaceImpl>(); } void ApplyOpsTest::tearDown() { diff --git a/src/mongo/db/repl/base_cloner_test_fixture.cpp b/src/mongo/db/repl/base_cloner_test_fixture.cpp index 359f6a2c4a2..7d0dad39e6f 100644 --- a/src/mongo/db/repl/base_cloner_test_fixture.cpp +++ b/src/mongo/db/repl/base_cloner_test_fixture.cpp @@ -129,7 +129,7 @@ void BaseClonerTest::setUp() { options.minThreads = 1U; options.maxThreads = 1U; options.onCreateThread = [](StringData threadName) { Client::initThread(threadName); }; - dbWorkThreadPool = stdx::make_unique<ThreadPool>(options); + dbWorkThreadPool = std::make_unique<ThreadPool>(options); dbWorkThreadPool->startup(); storageInterface.reset(new StorageInterfaceMock()); diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp index 5b5b85c6af5..5191f18f3c9 100644 --- a/src/mongo/db/repl/bgsync.cpp +++ b/src/mongo/db/repl/bgsync.cpp @@ -33,6 +33,8 @@ #include "mongo/db/repl/bgsync.h" +#include <memory> + #include "mongo/base/counter.h" #include "mongo/base/string_data.h" #include "mongo/bson/util/bson_extract.h" @@ -57,7 +59,6 @@ #include "mongo/db/s/shard_identity_rollback_notifier.h" #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/rpc/metadata/repl_set_metadata.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/str.h" #include "mongo/util/time_support.h" @@ -269,7 +270,7 @@ void BackgroundSync::_produce() { log() << "Clearing sync source " << _syncSourceHost << " to choose a new one."; } _syncSourceHost = HostAndPort(); - _syncSourceResolver = stdx::make_unique<SyncSourceResolver>( + _syncSourceResolver = std::make_unique<SyncSourceResolver>( _replicationCoordinatorExternalState->getTaskExecutor(), _replCoord, lastOpTimeFetched, @@ -409,7 +410,7 @@ void BackgroundSync::_produce() { }; // The construction of OplogFetcher has to be outside bgsync mutex, because it calls // replication coordinator. - auto oplogFetcherPtr = stdx::make_unique<OplogFetcher>( + auto oplogFetcherPtr = std::make_unique<OplogFetcher>( _replicationCoordinatorExternalState->getTaskExecutor(), lastOpTimeFetched, source, @@ -631,7 +632,7 @@ void BackgroundSync::_runRollbackViaRecoverToCheckpoint( } } - _rollback = stdx::make_unique<RollbackImpl>( + _rollback = std::make_unique<RollbackImpl>( localOplog, &remoteOplog, storageInterface, _replicationProcess, _replCoord); log() << "Scheduling rollback (sync source: " << source << ")"; diff --git a/src/mongo/db/repl/check_quorum_for_config_change_test.cpp b/src/mongo/db/repl/check_quorum_for_config_change_test.cpp index fceb6919e6b..003e1155a51 100644 --- a/src/mongo/db/repl/check_quorum_for_config_change_test.cpp +++ b/src/mongo/db/repl/check_quorum_for_config_change_test.cpp @@ -32,6 +32,7 @@ #include "mongo/platform/basic.h" #include <functional> +#include <memory> #include "mongo/base/status.h" #include "mongo/db/jsobj.h" @@ -42,7 +43,6 @@ #include "mongo/executor/network_interface_mock.h" #include "mongo/executor/thread_pool_task_executor_test_fixture.h" #include "mongo/rpc/metadata/repl_set_metadata.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/stdx/unordered_set.h" #include "mongo/unittest/unittest.h" diff --git a/src/mongo/db/repl/collection_cloner.cpp b/src/mongo/db/repl/collection_cloner.cpp index e86e8ce022c..facbf764d95 100644 --- a/src/mongo/db/repl/collection_cloner.cpp +++ b/src/mongo/db/repl/collection_cloner.cpp @@ -160,7 +160,7 @@ CollectionCloner::CollectionCloner(executor::TaskExecutor* executor, _dbWorkTaskRunner.schedule(std::move(task)); return executor::TaskExecutor::CallbackHandle(); }), - _createClientFn([] { return stdx::make_unique<DBClientConnection>(); }), + _createClientFn([] { return std::make_unique<DBClientConnection>(); }), _progressMeter(1U, // total will be replaced with count command result. kProgressMeterSecondsBetween, kProgressMeterCheckInterval, @@ -644,7 +644,7 @@ void CollectionCloner::_verifyCollectionWasDropped( BSONObjBuilder cmdObj; _options.uuid->appendToBuilder(&cmdObj, "find"); cmdObj.append("batchSize", 0); - _verifyCollectionDroppedScheduler = stdx::make_unique<RemoteCommandRetryScheduler>( + _verifyCollectionDroppedScheduler = std::make_unique<RemoteCommandRetryScheduler>( _executor, RemoteCommandRequest(_source, _sourceNss.db().toString(), diff --git a/src/mongo/db/repl/collection_cloner_test.cpp b/src/mongo/db/repl/collection_cloner_test.cpp index 71c2aca517c..420457bd703 100644 --- a/src/mongo/db/repl/collection_cloner_test.cpp +++ b/src/mongo/db/repl/collection_cloner_test.cpp @@ -39,7 +39,6 @@ #include "mongo/db/repl/storage_interface.h" #include "mongo/db/repl/storage_interface_mock.h" #include "mongo/dbtests/mock/mock_dbclient_connection.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/task_executor_proxy.h" #include "mongo/unittest/unittest.h" #include "mongo/util/str.h" @@ -528,14 +527,14 @@ TEST_F(CollectionClonerTest, return request.cmdObj.firstElementFieldNameStringData() == "listIndexes"; }); - collectionCloner = stdx::make_unique<CollectionCloner>(&_executorProxy, - dbWorkThreadPool.get(), - target, - nss, - options, - setStatusCallback(), - storageInterface.get(), - defaultBatchSize); + collectionCloner = std::make_unique<CollectionCloner>(&_executorProxy, + dbWorkThreadPool.get(), + target, + nss, + options, + setStatusCallback(), + storageInterface.get(), + defaultBatchSize); ASSERT_OK(collectionCloner->startup()); @@ -1135,17 +1134,17 @@ TEST_F(CollectionClonerTest, CollectionClonerResetsOnCompletionCallbackFunctionA Status result = getDetectableErrorStatus(); collectionCloner = - stdx::make_unique<CollectionCloner>(&getExecutor(), - dbWorkThreadPool.get(), - target, - nss, - options, - [&result, sharedCallbackData](const Status& status) { - log() << "setting result to " << status; - result = status; - }, - storageInterface.get(), - defaultBatchSize); + std::make_unique<CollectionCloner>(&getExecutor(), + dbWorkThreadPool.get(), + target, + nss, + options, + [&result, sharedCallbackData](const Status& status) { + log() << "setting result to " << status; + result = status; + }, + storageInterface.get(), + defaultBatchSize); ASSERT_OK(collectionCloner->startup()); ASSERT_TRUE(collectionCloner->isActive()); diff --git a/src/mongo/db/repl/data_replicator_external_state_impl.cpp b/src/mongo/db/repl/data_replicator_external_state_impl.cpp index cba04681a31..33ea1ea0d16 100644 --- a/src/mongo/db/repl/data_replicator_external_state_impl.cpp +++ b/src/mongo/db/repl/data_replicator_external_state_impl.cpp @@ -123,10 +123,10 @@ std::unique_ptr<OplogBuffer> DataReplicatorExternalStateImpl::makeInitialSyncOpl invariant(initialSyncOplogBufferPeekCacheSize >= 0); OplogBufferCollection::Options options; options.peekCacheSize = std::size_t(initialSyncOplogBufferPeekCacheSize); - return stdx::make_unique<OplogBufferProxy>( - stdx::make_unique<OplogBufferCollection>(StorageInterface::get(opCtx), options)); + return std::make_unique<OplogBufferProxy>( + std::make_unique<OplogBufferCollection>(StorageInterface::get(opCtx), options)); } else { - return stdx::make_unique<OplogBufferBlockingQueue>(); + return std::make_unique<OplogBufferBlockingQueue>(); } } diff --git a/src/mongo/db/repl/data_replicator_external_state_mock.cpp b/src/mongo/db/repl/data_replicator_external_state_mock.cpp index 67e42a17204..322f91a29dc 100644 --- a/src/mongo/db/repl/data_replicator_external_state_mock.cpp +++ b/src/mongo/db/repl/data_replicator_external_state_mock.cpp @@ -31,8 +31,9 @@ #include "mongo/db/repl/data_replicator_external_state_mock.h" +#include <memory> + #include "mongo/db/repl/oplog_buffer_blocking_queue.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace repl { @@ -105,7 +106,7 @@ bool DataReplicatorExternalStateMock::shouldStopFetching( std::unique_ptr<OplogBuffer> DataReplicatorExternalStateMock::makeInitialSyncOplogBuffer( OperationContext* opCtx) const { - return stdx::make_unique<OplogBufferBlockingQueue>(); + return std::make_unique<OplogBufferBlockingQueue>(); } std::unique_ptr<OplogApplier> DataReplicatorExternalStateMock::makeOplogApplier( diff --git a/src/mongo/db/repl/database_cloner_test.cpp b/src/mongo/db/repl/database_cloner_test.cpp index ba651b672d3..e294c1fae64 100644 --- a/src/mongo/db/repl/database_cloner_test.cpp +++ b/src/mongo/db/repl/database_cloner_test.cpp @@ -93,21 +93,20 @@ protected: void DatabaseClonerTest::setUp() { BaseClonerTest::setUp(); - _databaseCloner = - stdx::make_unique<DatabaseCloner>(&getExecutor(), - dbWorkThreadPool.get(), - target, - dbname, - BSONObj(), - DatabaseCloner::ListCollectionsPredicateFn(), - storageInterface.get(), - makeCollectionWorkClosure(), - makeSetStatusClosure()); + _databaseCloner = std::make_unique<DatabaseCloner>(&getExecutor(), + dbWorkThreadPool.get(), + target, + dbname, + BSONObj(), + DatabaseCloner::ListCollectionsPredicateFn(), + storageInterface.get(), + makeCollectionWorkClosure(), + makeSetStatusClosure()); _databaseCloner->setScheduleDbWorkFn_forTest([this](executor::TaskExecutor::CallbackFn work) { return getExecutor().scheduleWork(std::move(work)); }); - _mockServer = stdx::make_unique<MockRemoteDBServer>(target.toString()); + _mockServer = std::make_unique<MockRemoteDBServer>(target.toString()); _mockServer->assignCollectionUuid("db.a", *_options1.uuid); _mockServer->assignCollectionUuid("db.b", *_options2.uuid); _mockServer->assignCollectionUuid("db.c", *_options3.uuid); @@ -293,16 +292,15 @@ TEST_F(DatabaseClonerTest, FirstRemoteCommandWithoutFilter) { TEST_F(DatabaseClonerTest, FirstRemoteCommandWithFilter) { const BSONObj listCollectionsFilter = BSON("name" << "coll"); - _databaseCloner = - stdx::make_unique<DatabaseCloner>(&getExecutor(), - dbWorkThreadPool.get(), - target, - dbname, - listCollectionsFilter, - DatabaseCloner::ListCollectionsPredicateFn(), - storageInterface.get(), - makeCollectionWorkClosure(), - makeSetStatusClosure()); + _databaseCloner = std::make_unique<DatabaseCloner>(&getExecutor(), + dbWorkThreadPool.get(), + target, + dbname, + listCollectionsFilter, + DatabaseCloner::ListCollectionsPredicateFn(), + storageInterface.get(), + makeCollectionWorkClosure(), + makeSetStatusClosure()); ASSERT_EQUALS(DatabaseCloner::State::kPreStart, _databaseCloner->getState_forTest()); ASSERT_OK(_databaseCloner->startup()); @@ -375,15 +373,15 @@ TEST_F(DatabaseClonerTest, ListCollectionsPredicate) { DatabaseCloner::ListCollectionsPredicateFn pred = [](const BSONObj& info) { return info["name"].String() != "b"; }; - _databaseCloner = stdx::make_unique<DatabaseCloner>(&getExecutor(), - dbWorkThreadPool.get(), - target, - dbname, - BSONObj(), - pred, - storageInterface.get(), - makeCollectionWorkClosure(), - makeSetStatusClosure()); + _databaseCloner = std::make_unique<DatabaseCloner>(&getExecutor(), + dbWorkThreadPool.get(), + target, + dbname, + BSONObj(), + pred, + storageInterface.get(), + makeCollectionWorkClosure(), + makeSetStatusClosure()); ASSERT_EQUALS(DatabaseCloner::State::kPreStart, _databaseCloner->getState_forTest()); ASSERT_OK(_databaseCloner->startup()); diff --git a/src/mongo/db/repl/databases_cloner.cpp b/src/mongo/db/repl/databases_cloner.cpp index 2823cebcc69..4ff67c27ac2 100644 --- a/src/mongo/db/repl/databases_cloner.cpp +++ b/src/mongo/db/repl/databases_cloner.cpp @@ -205,7 +205,7 @@ Status DatabasesCloner::startup() noexcept { BSON("listDatabases" << true << "nameOnly" << true), ReadPreferenceSetting::secondaryPreferredMetadata(), nullptr); - _listDBsScheduler = stdx::make_unique<RemoteCommandRetryScheduler>( + _listDBsScheduler = std::make_unique<RemoteCommandRetryScheduler>( _exec, listDBsReq, [this](const auto& x) { this->_onListDatabaseFinish(x); }, diff --git a/src/mongo/db/repl/databases_cloner_test.cpp b/src/mongo/db/repl/databases_cloner_test.cpp index 46cb0a649c3..dea8b12cbab 100644 --- a/src/mongo/db/repl/databases_cloner_test.cpp +++ b/src/mongo/db/repl/databases_cloner_test.cpp @@ -193,7 +193,7 @@ protected: _dbWorkThreadPool.startup(); _target = HostAndPort{"local:1234"}; - _mockServer = stdx::make_unique<MockRemoteDBServer>(_target.toString()); + _mockServer = std::make_unique<MockRemoteDBServer>(_target.toString()); } void tearDown() override { @@ -327,12 +327,12 @@ protected: }; std::unique_ptr<DatabasesCloner> makeDummyDatabasesCloner() { - return stdx::make_unique<DatabasesCloner>(&getStorage(), - &getExecutor(), - &getDbWorkThreadPool(), - HostAndPort{"local:1234"}, - [](const BSONObj&) { return true; }, - [](const Status&) {}); + return std::make_unique<DatabasesCloner>(&getStorage(), + &getExecutor(), + &getDbWorkThreadPool(), + HostAndPort{"local:1234"}, + [](const BSONObj&) { return true; }, + [](const Status&) {}); } private: diff --git a/src/mongo/db/repl/dbcheck.cpp b/src/mongo/db/repl/dbcheck.cpp index b2130ae9e2c..714bbc4e335 100644 --- a/src/mongo/db/repl/dbcheck.cpp +++ b/src/mongo/db/repl/dbcheck.cpp @@ -122,7 +122,7 @@ std::unique_ptr<HealthLogEntry> dbCheckHealthLogEntry(const NamespaceString& nss const std::string& msg, OplogEntriesEnum operation, const BSONObj& data) { - auto entry = stdx::make_unique<HealthLogEntry>(); + auto entry = std::make_unique<HealthLogEntry>(); entry->setNss(nss); entry->setTimestamp(Date_t::now()); entry->setSeverity(severity); @@ -384,7 +384,7 @@ std::vector<BSONObj> collectionIndexInfo(OperationContext* opCtx, Collection* co result.push_back(cce->getIndexSpec(opCtx, name)); } - auto comp = stdx::make_unique<SimpleBSONObjComparator>(); + auto comp = std::make_unique<SimpleBSONObjComparator>(); std::sort(result.begin(), result.end(), SimpleBSONObjComparator::LessThan()); diff --git a/src/mongo/db/repl/do_txn_test.cpp b/src/mongo/db/repl/do_txn_test.cpp index 810e7401da3..07547e3515f 100644 --- a/src/mongo/db/repl/do_txn_test.cpp +++ b/src/mongo/db/repl/do_txn_test.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/catalog/collection_options.h" #include "mongo/db/catalog/database_holder.h" #include "mongo/db/client.h" @@ -46,7 +48,6 @@ #include "mongo/db/transaction_participant.h" #include "mongo/logger/logger.h" #include "mongo/rpc/get_status_from_command_result.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace repl { @@ -147,7 +148,7 @@ void DoTxnTest::setUp() { _opCtx = cc().makeOperationContext(); // Set up ReplicationCoordinator and create oplog. - ReplicationCoordinator::set(service, stdx::make_unique<ReplicationCoordinatorMock>(service)); + ReplicationCoordinator::set(service, std::make_unique<ReplicationCoordinatorMock>(service)); setOplogCollectionName(service); createOplog(_opCtx.get()); @@ -161,21 +162,21 @@ void DoTxnTest::setUp() { // Need the OpObserverImpl in the registry in order for doTxn to work. OpObserverRegistry* opObserverRegistry = dynamic_cast<OpObserverRegistry*>(service->getOpObserver()); - opObserverRegistry->addObserver(stdx::make_unique<OpObserverShardingImpl>()); + opObserverRegistry->addObserver(std::make_unique<OpObserverShardingImpl>()); // Use OpObserverMock to track applyOps calls generated by doTxn(). - auto opObserver = stdx::make_unique<OpObserverMock>(); + auto opObserver = std::make_unique<OpObserverMock>(); _opObserver = opObserver.get(); opObserverRegistry->addObserver(std::move(opObserver)); // This test uses StorageInterface to create collections and inspect documents inside // collections. - _storage = stdx::make_unique<StorageInterfaceImpl>(); + _storage = std::make_unique<StorageInterfaceImpl>(); // We also need to give replication a StorageInterface for checking out the transaction. // The test storage engine doesn't support the necessary call (getPointInTimeReadTimestamp()), // so we use a mock. - repl::StorageInterface::set(service, stdx::make_unique<StorageInterfaceMock>()); + repl::StorageInterface::set(service, std::make_unique<StorageInterfaceMock>()); // Set up the transaction and session. _opCtx->setLogicalSessionId(makeLogicalSessionIdForTest()); diff --git a/src/mongo/db/repl/drop_pending_collection_reaper_test.cpp b/src/mongo/db/repl/drop_pending_collection_reaper_test.cpp index 281b864d0d1..bf2df1aa0cf 100644 --- a/src/mongo/db/repl/drop_pending_collection_reaper_test.cpp +++ b/src/mongo/db/repl/drop_pending_collection_reaper_test.cpp @@ -43,7 +43,6 @@ #include "mongo/db/repl/storage_interface_mock.h" #include "mongo/db/service_context.h" #include "mongo/db/service_context_d_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/death_test.h" #include "mongo/util/str.h" @@ -75,9 +74,9 @@ protected: void DropPendingCollectionReaperTest::setUp() { ServiceContextMongoDTest::setUp(); - _storageInterface = stdx::make_unique<StorageInterfaceImpl>(); + _storageInterface = std::make_unique<StorageInterfaceImpl>(); auto service = getServiceContext(); - ReplicationCoordinator::set(service, stdx::make_unique<ReplicationCoordinatorMock>(service)); + ReplicationCoordinator::set(service, std::make_unique<ReplicationCoordinatorMock>(service)); } void DropPendingCollectionReaperTest::tearDown() { diff --git a/src/mongo/db/repl/idempotency_test_fixture.cpp b/src/mongo/db/repl/idempotency_test_fixture.cpp index 08fd12b274b..63c769e58be 100644 --- a/src/mongo/db/repl/idempotency_test_fixture.cpp +++ b/src/mongo/db/repl/idempotency_test_fixture.cpp @@ -613,7 +613,7 @@ CollectionState IdempotencyTest::validate(const NamespaceString& nss) { BSONObjBuilder bob; Lock::DBLock lk(_opCtx.get(), nss.db(), MODE_IX); - auto lock = stdx::make_unique<Lock::CollectionLock>(_opCtx.get(), nss, MODE_X); + auto lock = std::make_unique<Lock::CollectionLock>(_opCtx.get(), nss, MODE_X); ASSERT_OK(collection->validate(_opCtx.get(), kValidateFull, false, &validateResults, &bob)); ASSERT_TRUE(validateResults.valid); diff --git a/src/mongo/db/repl/idempotency_update_sequence_test.cpp b/src/mongo/db/repl/idempotency_update_sequence_test.cpp index ad6dfa1c0df..cace6b830b0 100644 --- a/src/mongo/db/repl/idempotency_update_sequence_test.cpp +++ b/src/mongo/db/repl/idempotency_update_sequence_test.cpp @@ -31,12 +31,12 @@ #include <algorithm> #include <cctype> +#include <memory> #include "mongo/db/field_ref.h" #include "mongo/db/field_ref_set.h" #include "mongo/db/repl/idempotency_document_structure.h" #include "mongo/db/repl/idempotency_update_sequence.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -170,7 +170,7 @@ TEST(UpdateGenTest, UpdatesAreNotAmbiguous) { std::vector<std::unique_ptr<FieldRef>> argPathsRefVec; FieldRefSet pathRefSet; for (auto path : argPathsSet) { - argPathsRefVec.push_back(stdx::make_unique<FieldRef>(path)); + argPathsRefVec.push_back(std::make_unique<FieldRef>(path)); const FieldRef* conflict; if (!pathRefSet.insert(argPathsRefVec.back().get(), &conflict)) { StringBuilder sb; diff --git a/src/mongo/db/repl/initial_syncer.cpp b/src/mongo/db/repl/initial_syncer.cpp index 93f478d7235..a5d0580f37a 100644 --- a/src/mongo/db/repl/initial_syncer.cpp +++ b/src/mongo/db/repl/initial_syncer.cpp @@ -34,6 +34,7 @@ #include "initial_syncer.h" #include <algorithm> +#include <memory> #include <utility> #include "mongo/base/counter.h" @@ -63,7 +64,6 @@ #include "mongo/executor/task_executor.h" #include "mongo/executor/thread_pool_task_executor.h" #include "mongo/rpc/metadata/repl_set_metadata.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/destructor_guard.h" #include "mongo/util/fail_point_service.h" @@ -607,7 +607,7 @@ void InitialSyncer::_chooseSyncSourceCallback( _syncSource = syncSource.getValue(); // Schedule rollback ID checker. - _rollbackChecker = stdx::make_unique<RollbackChecker>(_exec, _syncSource); + _rollbackChecker = std::make_unique<RollbackChecker>(_exec, _syncSource); auto scheduleResult = _rollbackChecker->reset([=](const RollbackChecker::Result& result) { return _rollbackCheckerResetCallback(result, onCompletionGuard); }); @@ -666,7 +666,7 @@ Status InitialSyncer::_scheduleGetBeginFetchingOpTime_inlock( << "local")); cmd.append("limit", 1); - _beginFetchingOpTimeFetcher = stdx::make_unique<Fetcher>( + _beginFetchingOpTimeFetcher = std::make_unique<Fetcher>( _exec, _syncSource, NamespaceString::kSessionTransactionsTableNamespace.db().toString(), @@ -793,7 +793,7 @@ void InitialSyncer::_lastOplogEntryFetcherCallbackForBeginApplyingTimestamp( readConcernBob.append("afterClusterTime", lastOpTime.getTimestamp()); readConcernBob.done(); - _fCVFetcher = stdx::make_unique<Fetcher>( + _fCVFetcher = std::make_unique<Fetcher>( _exec, _syncSource, NamespaceString::kServerConfigurationNamespace.db().toString(), @@ -885,7 +885,7 @@ void InitialSyncer::_fcvFetcherCallback(const StatusWith<Fetcher::QueryResponse> } return (name != "local"); }; - _initialSyncState = stdx::make_unique<InitialSyncState>(stdx::make_unique<DatabasesCloner>( + _initialSyncState = std::make_unique<InitialSyncState>(std::make_unique<DatabasesCloner>( _storage, _exec, _writerPool, _syncSource, listDatabasesFilter, [=](const Status& status) { _databasesClonerCallback(status, onCompletionGuard); })); @@ -936,7 +936,7 @@ void InitialSyncer::_fcvFetcherCallback(const StatusWith<Fetcher::QueryResponse> } const auto& config = configResult.getValue(); - _oplogFetcher = stdx::make_unique<OplogFetcher>( + _oplogFetcher = std::make_unique<OplogFetcher>( _exec, beginFetchingOpTime, _syncSource, @@ -1189,7 +1189,7 @@ void InitialSyncer::_getNextApplierBatchCallback( s, {lastApplied, lastAppliedWall}, numApplied, onCompletionGuard); }; - _applier = stdx::make_unique<MultiApplier>( + _applier = std::make_unique<MultiApplier>( _exec, ops, std::move(applyBatchOfOperationsFn), std::move(onCompletionFn)); status = _startupComponent_inlock(_applier); if (!status.isOK()) { @@ -1485,18 +1485,18 @@ Status InitialSyncer::_scheduleLastOplogEntryFetcher_inlock(Fetcher::CallbackFn "find" << _opts.remoteOplogNS.coll() << "sort" << BSON("$natural" << -1) << "limit" << 1); _lastOplogEntryFetcher = - stdx::make_unique<Fetcher>(_exec, - _syncSource, - _opts.remoteOplogNS.db().toString(), - query, - callback, - ReadPreferenceSetting::secondaryPreferredMetadata(), - RemoteCommandRequest::kNoTimeout /* find network timeout */, - RemoteCommandRequest::kNoTimeout /* getMore network timeout */, - RemoteCommandRetryScheduler::makeRetryPolicy( - numInitialSyncOplogFindAttempts.load(), - executor::RemoteCommandRequest::kNoTimeout, - RemoteCommandRetryScheduler::kAllRetriableErrors)); + std::make_unique<Fetcher>(_exec, + _syncSource, + _opts.remoteOplogNS.db().toString(), + query, + callback, + ReadPreferenceSetting::secondaryPreferredMetadata(), + RemoteCommandRequest::kNoTimeout /* find network timeout */, + RemoteCommandRequest::kNoTimeout /* getMore network timeout */, + RemoteCommandRetryScheduler::makeRetryPolicy( + numInitialSyncOplogFindAttempts.load(), + executor::RemoteCommandRequest::kNoTimeout, + RemoteCommandRetryScheduler::kAllRetriableErrors)); Status scheduleStatus = _lastOplogEntryFetcher->schedule(); if (!scheduleStatus.isOK()) { _lastOplogEntryFetcher.reset(); diff --git a/src/mongo/db/repl/initial_syncer_test.cpp b/src/mongo/db/repl/initial_syncer_test.cpp index 27eff74563a..71ceb7b435d 100644 --- a/src/mongo/db/repl/initial_syncer_test.cpp +++ b/src/mongo/db/repl/initial_syncer_test.cpp @@ -133,7 +133,7 @@ public: }; _myLastOpTime = OpTime(); _myLastWallTime = Date_t::min(); - _syncSourceSelector = stdx::make_unique<SyncSourceSelectorMock>(); + _syncSourceSelector = std::make_unique<SyncSourceSelectorMock>(); } // SyncSourceSelector @@ -251,7 +251,7 @@ protected: void setUp() override { executor::ThreadPoolExecutorTest::setUp(); - _storageInterface = stdx::make_unique<StorageInterfaceMock>(); + _storageInterface = std::make_unique<StorageInterfaceMock>(); _storageInterface->createOplogFn = [this](OperationContext* opCtx, const NamespaceString& nss) { LockGuard lock(_storageInterfaceWorkDoneMutex); @@ -326,23 +326,23 @@ protected: } }; - _dbWorkThreadPool = stdx::make_unique<ThreadPool>(ThreadPool::Options()); + _dbWorkThreadPool = std::make_unique<ThreadPool>(ThreadPool::Options()); _dbWorkThreadPool->startup(); _target = HostAndPort{"localhost:12346"}; - _mockServer = stdx::make_unique<MockRemoteDBServer>(_target.toString()); + _mockServer = std::make_unique<MockRemoteDBServer>(_target.toString()); _options1.uuid = UUID::gen(); reset(); launchExecutorThread(); - _replicationProcess = stdx::make_unique<ReplicationProcess>( + _replicationProcess = std::make_unique<ReplicationProcess>( _storageInterface.get(), - stdx::make_unique<ReplicationConsistencyMarkersMock>(), - stdx::make_unique<ReplicationRecoveryMock>()); + std::make_unique<ReplicationConsistencyMarkersMock>(), + std::make_unique<ReplicationRecoveryMock>()); - _executorProxy = stdx::make_unique<TaskExecutorMock>(&getExecutor()); + _executorProxy = std::make_unique<TaskExecutorMock>(&getExecutor()); _myLastOpTime = OpTime({3, 0}, 1); @@ -366,7 +366,7 @@ protected: Client::initThread(threadName.c_str()); }; - auto dataReplicatorExternalState = stdx::make_unique<DataReplicatorExternalStateMock>(); + auto dataReplicatorExternalState = std::make_unique<DataReplicatorExternalStateMock>(); dataReplicatorExternalState->taskExecutor = _executorProxy.get(); dataReplicatorExternalState->currentTerm = 1LL; dataReplicatorExternalState->lastCommittedOpTime = _myLastOpTime; @@ -396,7 +396,7 @@ protected: // When creating InitialSyncer, we wrap _onCompletion so that we can override the // InitialSyncer's callback behavior post-construction. // See InitialSyncerTransitionsToCompleteWhenFinishCallbackThrowsException. - _initialSyncer = stdx::make_unique<InitialSyncer>( + _initialSyncer = std::make_unique<InitialSyncer>( options, std::move(dataReplicatorExternalState), _dbWorkThreadPool.get(), @@ -639,7 +639,7 @@ TEST_F(InitialSyncerTest, InvalidConstruction) { // Null task executor in external state. { - auto dataReplicatorExternalState = stdx::make_unique<DataReplicatorExternalStateMock>(); + auto dataReplicatorExternalState = std::make_unique<DataReplicatorExternalStateMock>(); ASSERT_THROWS_CODE_AND_WHAT(InitialSyncer(options, std::move(dataReplicatorExternalState), _dbWorkThreadPool.get(), @@ -653,7 +653,7 @@ TEST_F(InitialSyncerTest, InvalidConstruction) { // Null callback function. { - auto dataReplicatorExternalState = stdx::make_unique<DataReplicatorExternalStateMock>(); + auto dataReplicatorExternalState = std::make_unique<DataReplicatorExternalStateMock>(); dataReplicatorExternalState->taskExecutor = &getExecutor(); ASSERT_THROWS_CODE_AND_WHAT(InitialSyncer(options, std::move(dataReplicatorExternalState), @@ -993,9 +993,9 @@ TEST_F(InitialSyncerTest, InitialSyncerResetsOnCompletionCallbackFunctionPointer auto sharedCallbackData = std::make_shared<SharedCallbackState>(&sharedCallbackStateDestroyed); decltype(_lastApplied) lastApplied = getDetectableErrorStatus(); - auto dataReplicatorExternalState = stdx::make_unique<DataReplicatorExternalStateMock>(); + auto dataReplicatorExternalState = std::make_unique<DataReplicatorExternalStateMock>(); dataReplicatorExternalState->taskExecutor = &getExecutor(); - auto initialSyncer = stdx::make_unique<InitialSyncer>( + auto initialSyncer = std::make_unique<InitialSyncer>( _options, std::move(dataReplicatorExternalState), _dbWorkThreadPool.get(), diff --git a/src/mongo/db/repl/mock_repl_coord_server_fixture.cpp b/src/mongo/db/repl/mock_repl_coord_server_fixture.cpp index 72311bd0ff4..dec18f8e014 100644 --- a/src/mongo/db/repl/mock_repl_coord_server_fixture.cpp +++ b/src/mongo/db/repl/mock_repl_coord_server_fixture.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/client.h" #include "mongo/db/curop.h" #include "mongo/db/db_raii.h" @@ -45,7 +47,6 @@ #include "mongo/db/repl/storage_interface_mock.h" #include "mongo/db/service_context.h" #include "mongo/db/service_context_d_test_fixture.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -62,10 +63,10 @@ void MockReplCoordServerFixture::setUp() { ASSERT_TRUE(_storageInterface == repl::StorageInterface::get(service)); repl::ReplicationProcess::set(service, - stdx::make_unique<repl::ReplicationProcess>( + std::make_unique<repl::ReplicationProcess>( _storageInterface, - stdx::make_unique<repl::ReplicationConsistencyMarkersMock>(), - stdx::make_unique<repl::ReplicationRecoveryMock>())); + std::make_unique<repl::ReplicationConsistencyMarkersMock>(), + std::make_unique<repl::ReplicationRecoveryMock>())); ASSERT_OK(repl::ReplicationProcess::get(service)->initializeRollbackID(opCtx())); @@ -75,7 +76,7 @@ void MockReplCoordServerFixture::setUp() { ConnectionString::forReplicaSet("sessionTxnStateTest", {HostAndPort("a:1")}).toString()); repl::ReplicationCoordinator::set( - service, stdx::make_unique<repl::ReplicationCoordinatorMock>(service, replSettings)); + service, std::make_unique<repl::ReplicationCoordinatorMock>(service, replSettings)); ASSERT_OK( repl::ReplicationCoordinator::get(service)->setFollowerMode(repl::MemberState::RS_PRIMARY)); @@ -89,7 +90,7 @@ void MockReplCoordServerFixture::setUp() { repl::DropPendingCollectionReaper::set( service, - stdx::make_unique<repl::DropPendingCollectionReaper>(repl::StorageInterface::get(service))); + std::make_unique<repl::DropPendingCollectionReaper>(repl::StorageInterface::get(service))); } void MockReplCoordServerFixture::insertOplogEntry(const repl::OplogEntry& entry) { diff --git a/src/mongo/db/repl/noop_writer.cpp b/src/mongo/db/repl/noop_writer.cpp index f8495278ce1..d1bc540ab2c 100644 --- a/src/mongo/db/repl/noop_writer.cpp +++ b/src/mongo/db/repl/noop_writer.cpp @@ -132,7 +132,7 @@ Status NoopWriter::startWritingPeriodicNoops(OpTime lastKnownOpTime) { invariant(!_noopRunner); _noopRunner = - stdx::make_unique<PeriodicNoopRunner>(_writeInterval, [this](OperationContext* opCtx) { + std::make_unique<PeriodicNoopRunner>(_writeInterval, [this](OperationContext* opCtx) { opCtx->setShouldParticipateInFlowControl(false); _writeNoop(opCtx); }); diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp index f56af4a7b57..e628976f83c 100644 --- a/src/mongo/db/repl/oplog.cpp +++ b/src/mongo/db/repl/oplog.cpp @@ -34,6 +34,7 @@ #include "mongo/db/repl/oplog.h" #include <deque> +#include <memory> #include <set> #include <vector> @@ -88,7 +89,6 @@ #include "mongo/db/views/view_catalog.h" #include "mongo/platform/random.h" #include "mongo/scripting/engine.h" -#include "mongo/stdx/memory.h" #include "mongo/util/concurrency/idle_thread_block.h" #include "mongo/util/elapsed_tracker.h" #include "mongo/util/fail_point_service.h" @@ -594,7 +594,7 @@ std::vector<OpTime> logInsertOps(OperationContext* opCtx, oplogLink.prevOpTime = txnParticipant.getLastWriteOpTime(); } - auto timestamps = stdx::make_unique<Timestamp[]>(count); + auto timestamps = std::make_unique<Timestamp[]>(count); std::vector<OpTime> opTimes; for (size_t i = 0; i < count; i++) { // Make a mutable copy. diff --git a/src/mongo/db/repl/oplog_applier.cpp b/src/mongo/db/repl/oplog_applier.cpp index 48b8cda9cb9..f6d249d1182 100644 --- a/src/mongo/db/repl/oplog_applier.cpp +++ b/src/mongo/db/repl/oplog_applier.cpp @@ -61,7 +61,7 @@ std::unique_ptr<ThreadPool> OplogApplier::makeWriterPool(int threadCount) { Client::initThread(getThreadName()); AuthorizationSession::get(cc())->grantInternalAuthorization(&cc()); }; - auto pool = stdx::make_unique<ThreadPool>(options); + auto pool = std::make_unique<ThreadPool>(options); pool->startup(); return pool; } diff --git a/src/mongo/db/repl/oplog_buffer_collection_test.cpp b/src/mongo/db/repl/oplog_buffer_collection_test.cpp index b27c713f471..5da1ef35dc1 100644 --- a/src/mongo/db/repl/oplog_buffer_collection_test.cpp +++ b/src/mongo/db/repl/oplog_buffer_collection_test.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/catalog/database.h" #include "mongo/db/client.h" #include "mongo/db/concurrency/write_conflict_exception.h" @@ -43,7 +45,6 @@ #include "mongo/db/repl/storage_interface_impl.h" #include "mongo/db/repl/sync_tail_test_fixture.h" #include "mongo/db/service_context_d_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/barrier.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" @@ -74,9 +75,9 @@ void OplogBufferCollectionTest::setUp() { // AutoGetCollectionForReadCommand requires a valid replication coordinator in order to check // the shard version. - ReplicationCoordinator::set(service, stdx::make_unique<ReplicationCoordinatorMock>(service)); + ReplicationCoordinator::set(service, std::make_unique<ReplicationCoordinatorMock>(service)); - auto storageInterface = stdx::make_unique<StorageInterfaceImpl>(); + auto storageInterface = std::make_unique<StorageInterfaceImpl>(); _storageInterface = storageInterface.get(); StorageInterface::set(service, std::move(storageInterface)); diff --git a/src/mongo/db/repl/oplog_buffer_proxy_test.cpp b/src/mongo/db/repl/oplog_buffer_proxy_test.cpp index 269071bbc54..37297789f53 100644 --- a/src/mongo/db/repl/oplog_buffer_proxy_test.cpp +++ b/src/mongo/db/repl/oplog_buffer_proxy_test.cpp @@ -32,10 +32,10 @@ #include <boost/optional/optional_io.hpp> #include <deque> #include <functional> +#include <memory> #include "mongo/db/jsobj.h" #include "mongo/db/repl/oplog_buffer_proxy.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" @@ -145,9 +145,9 @@ protected: }; void OplogBufferProxyTest::setUp() { - auto mock = stdx::make_unique<OplogBufferMock>(); + auto mock = std::make_unique<OplogBufferMock>(); _mock = mock.get(); - _proxy = stdx::make_unique<OplogBufferProxy>(std::move(mock)); + _proxy = std::make_unique<OplogBufferProxy>(std::move(mock)); } void OplogBufferProxyTest::tearDown() { diff --git a/src/mongo/db/repl/oplog_fetcher_test.cpp b/src/mongo/db/repl/oplog_fetcher_test.cpp index ed79d6a7a27..fd8f50fe20b 100644 --- a/src/mongo/db/repl/oplog_fetcher_test.cpp +++ b/src/mongo/db/repl/oplog_fetcher_test.cpp @@ -37,7 +37,6 @@ #include "mongo/rpc/metadata.h" #include "mongo/rpc/metadata/oplog_query_metadata.h" #include "mongo/rpc/metadata/repl_set_metadata.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/ensure_fcv.h" #include "mongo/unittest/task_executor_proxy.h" @@ -114,7 +113,7 @@ void OplogFetcherTest::setUp() { staleWallTime = Date_t::min() + Seconds(staleOpTime.getSecs()); rbid = 2; - dataReplicatorExternalState = stdx::make_unique<DataReplicatorExternalStateMock>(); + dataReplicatorExternalState = std::make_unique<DataReplicatorExternalStateMock>(); dataReplicatorExternalState->currentTerm = lastFetched.getTerm(); dataReplicatorExternalState->lastCommittedOpTime = {{9999, 0}, lastFetched.getTerm()}; @@ -164,7 +163,7 @@ ReplSetConfig _createConfig() { std::unique_ptr<ShutdownState> OplogFetcherTest::processSingleBatch(RemoteCommandResponse response, bool requireFresherSyncSource) { - auto shutdownState = stdx::make_unique<ShutdownState>(); + auto shutdownState = std::make_unique<ShutdownState>(); OplogFetcher oplogFetcher(&getExecutor(), lastFetched, @@ -208,18 +207,18 @@ void _checkDefaultCommandObjectFields(BSONObj cmdObj) { } std::unique_ptr<OplogFetcher> OplogFetcherTest::makeOplogFetcher(ReplSetConfig config) { - return stdx::make_unique<OplogFetcher>(&getExecutor(), - lastFetched, - source, - nss, - config, - 0, - -1, - true, - dataReplicatorExternalState.get(), - enqueueDocumentsFn, - [](Status) {}, - defaultBatchSize); + return std::make_unique<OplogFetcher>(&getExecutor(), + lastFetched, + source, + nss, + config, + 0, + -1, + true, + dataReplicatorExternalState.get(), + enqueueDocumentsFn, + [](Status) {}, + defaultBatchSize); } BSONObj concatenate(BSONObj a, const BSONObj& b) { @@ -579,7 +578,7 @@ TEST_F(OplogFetcherTest, return Status::OK(); }; - auto shutdownState = stdx::make_unique<ShutdownState>(); + auto shutdownState = std::make_unique<ShutdownState>(); OplogFetcher oplogFetcher(&getExecutor(), lastFetched, source, @@ -655,7 +654,7 @@ TEST_F(OplogFetcherTest, return Status::OK(); }; - auto shutdownState = stdx::make_unique<ShutdownState>(); + auto shutdownState = std::make_unique<ShutdownState>(); OplogFetcher oplogFetcher(&getExecutor(), lastFetched, source, diff --git a/src/mongo/db/repl/oplog_test.cpp b/src/mongo/db/repl/oplog_test.cpp index c8506d55fbd..dafae7e8784 100644 --- a/src/mongo/db/repl/oplog_test.cpp +++ b/src/mongo/db/repl/oplog_test.cpp @@ -67,7 +67,7 @@ void OplogTest::setUp() { auto opCtx = cc().makeOperationContext(); // Set up ReplicationCoordinator and create oplog. - ReplicationCoordinator::set(service, stdx::make_unique<ReplicationCoordinatorMock>(service)); + ReplicationCoordinator::set(service, std::make_unique<ReplicationCoordinatorMock>(service)); setOplogCollectionName(service); createOplog(opCtx.get()); diff --git a/src/mongo/db/repl/replication_consistency_markers_impl_test.cpp b/src/mongo/db/repl/replication_consistency_markers_impl_test.cpp index d6f103a4113..fc7922c10ce 100644 --- a/src/mongo/db/repl/replication_consistency_markers_impl_test.cpp +++ b/src/mongo/db/repl/replication_consistency_markers_impl_test.cpp @@ -27,9 +27,11 @@ * it in the license file. */ +#include "mongo/platform/basic.h" + #include "mongo/db/repl/replication_consistency_markers_impl.h" -#include "mongo/platform/basic.h" +#include <memory> #include "mongo/db/client.h" #include "mongo/db/concurrency/d_concurrency.h" @@ -43,7 +45,6 @@ #include "mongo/db/repl/storage_interface_impl.h" #include "mongo/db/service_context_d_test_fixture.h" #include "mongo/db/storage/recovery_unit_noop.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/assert_util.h" #include "mongo/util/str.h" @@ -112,9 +113,9 @@ private: void setUp() override { ServiceContextMongoDTest::setUp(); _createOpCtx(); - auto replCoord = stdx::make_unique<ReplicationCoordinatorMock>(getServiceContext()); + auto replCoord = std::make_unique<ReplicationCoordinatorMock>(getServiceContext()); ReplicationCoordinator::set(getServiceContext(), std::move(replCoord)); - _storageInterface = stdx::make_unique<StorageInterfaceImpl>(); + _storageInterface = std::make_unique<StorageInterfaceImpl>(); } void tearDown() override { diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp index 5736969f762..b22465ab7c0 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp @@ -34,6 +34,7 @@ #include "mongo/db/repl/replication_coordinator_external_state_impl.h" #include <functional> +#include <memory> #include <string> #include "mongo/base/status_with.h" @@ -94,7 +95,6 @@ #include "mongo/s/client/shard_registry.h" #include "mongo/s/cluster_identity_loader.h" #include "mongo/s/grid.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/transport/service_entry_point.h" #include "mongo/util/assert_util.h" @@ -152,16 +152,16 @@ auto makeThreadPool(const std::string& poolName) { Client::initThread(threadName.c_str()); AuthorizationSession::get(cc())->grantInternalAuthorization(&cc()); }; - return stdx::make_unique<ThreadPool>(threadPoolOptions); + return std::make_unique<ThreadPool>(threadPoolOptions); } /** * Returns a new thread pool task executor. */ auto makeTaskExecutor(ServiceContext* service, const std::string& poolName) { - auto hookList = stdx::make_unique<rpc::EgressMetadataHookList>(); - hookList->addHook(stdx::make_unique<rpc::LogicalTimeMetadataHook>(service)); - return stdx::make_unique<executor::ThreadPoolTaskExecutor>( + auto hookList = std::make_unique<rpc::EgressMetadataHookList>(); + hookList->addHook(std::make_unique<rpc::LogicalTimeMetadataHook>(service)); + return std::make_unique<executor::ThreadPoolTaskExecutor>( makeThreadPool(poolName), executor::makeNetworkInterface("RS", nullptr, std::move(hookList))); } @@ -229,15 +229,14 @@ void ReplicationCoordinatorExternalStateImpl::startSteadyStateReplication( // interface. During steady state replication, there is no need to log details on every batch // we apply (recovery); or track missing documents that are fetched from the sync source // (initial sync). - _oplogApplier = - stdx::make_unique<OplogApplierImpl>(_oplogApplierTaskExecutor.get(), - _oplogBuffer.get(), - &noopOplogApplierObserver, - replCoord, - _replicationProcess->getConsistencyMarkers(), - _storageInterface, - OplogApplier::Options(), - _writerPool.get()); + _oplogApplier = std::make_unique<OplogApplierImpl>(_oplogApplierTaskExecutor.get(), + _oplogBuffer.get(), + &noopOplogApplierObserver, + replCoord, + _replicationProcess->getConsistencyMarkers(), + _storageInterface, + OplogApplier::Options(), + _writerPool.get()); invariant(!_bgSync); _bgSync = @@ -255,7 +254,7 @@ void ReplicationCoordinatorExternalStateImpl::startSteadyStateReplication( // leave the unique pointer empty if the _syncSourceFeedbackThread's function starts // after _stopDataReplication_inlock's move. auto bgSyncPtr = _bgSync.get(); - _syncSourceFeedbackThread = stdx::make_unique<stdx::thread>([this, bgSyncPtr, replCoord] { + _syncSourceFeedbackThread = std::make_unique<stdx::thread>([this, bgSyncPtr, replCoord] { _syncSourceFeedback.run(_taskExecutor.get(), bgSyncPtr, replCoord); }); } @@ -946,7 +945,7 @@ void ReplicationCoordinatorExternalStateImpl::stopNoopWriter() { void ReplicationCoordinatorExternalStateImpl::setupNoopWriter(Seconds waitTime) { invariant(!_noopWriter); - _noopWriter = stdx::make_unique<NoopWriter>(waitTime); + _noopWriter = std::make_unique<NoopWriter>(waitTime); } } // namespace repl } // namespace mongo diff --git a/src/mongo/db/repl/replication_coordinator_external_state_mock.cpp b/src/mongo/db/repl/replication_coordinator_external_state_mock.cpp index b73312fcd06..d5b57692df0 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state_mock.cpp +++ b/src/mongo/db/repl/replication_coordinator_external_state_mock.cpp @@ -33,12 +33,13 @@ #include "mongo/db/repl/replication_coordinator_external_state_mock.h" +#include <memory> + #include "mongo/base/status_with.h" #include "mongo/bson/oid.h" #include "mongo/db/client.h" #include "mongo/db/jsobj.h" #include "mongo/db/repl/oplog_buffer_blocking_queue.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/net/hostandport.h" #include "mongo/util/sequence_util.h" diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index 31c3bd56fe0..273e1c36d24 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -344,7 +344,7 @@ ReplicationCoordinatorImpl::ReplicationCoordinatorImpl( _rsConfigState(kConfigPreStart), _selfIndex(-1), _sleptLastElection(false), - _readWriteAbility(stdx::make_unique<ReadWriteAbility>(!settings.usingReplSets())), + _readWriteAbility(std::make_unique<ReadWriteAbility>(!settings.usingReplSets())), _replicationProcess(replicationProcess), _storage(storage), _random(prngSeed) { @@ -754,8 +754,8 @@ void ReplicationCoordinatorImpl::_startDataReplication(OperationContext* opCtx, stdx::lock_guard<stdx::mutex> lock(_mutex); initialSyncerCopy = std::make_shared<InitialSyncer>( createInitialSyncerOptions(this, _externalState.get()), - stdx::make_unique<DataReplicatorExternalStateInitialSync>(this, - _externalState.get()), + std::make_unique<DataReplicatorExternalStateInitialSync>(this, + _externalState.get()), _externalState->getDbWorkThreadPool(), _storage, _replicationProcess, @@ -1867,7 +1867,7 @@ ReplicationCoordinatorImpl::AutoGetRstlForStepUpStepDown::AutoGetRstlForStepUpSt void ReplicationCoordinatorImpl::AutoGetRstlForStepUpStepDown::_startKillOpThread() { invariant(!_killOpThread); - _killOpThread = stdx::make_unique<stdx::thread>([this] { _killOpThreadFn(); }); + _killOpThread = std::make_unique<stdx::thread>([this] { _killOpThreadFn(); }); } void ReplicationCoordinatorImpl::AutoGetRstlForStepUpStepDown::_killOpThreadFn() { @@ -2965,7 +2965,7 @@ void ReplicationCoordinatorImpl::_postWonElectionUpdateMemberState(WithLock lk) // Notify all secondaries of the election win. _restartHeartbeats_inlock(); invariant(!_catchupState); - _catchupState = stdx::make_unique<CatchupState>(this); + _catchupState = std::make_unique<CatchupState>(this); _catchupState->start_inlock(); } @@ -3080,7 +3080,7 @@ void ReplicationCoordinatorImpl::CatchupState::signalHeartbeatUpdate_inlock() { abort_inlock(); } }; - _waiter = stdx::make_unique<CallbackWaiter>(*targetOpTime, targetOpTimeCB); + _waiter = std::make_unique<CallbackWaiter>(*targetOpTime, targetOpTimeCB); _repl->_opTimeWaiterList.add_inlock(_waiter.get()); } diff --git a/src/mongo/db/repl/replication_coordinator_impl_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_test.cpp index 790a6c81704..59e657ab4ef 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_test.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_test.cpp @@ -2049,7 +2049,7 @@ TEST_F(StepDownTest, // locker to test this, or otherwise stepDown will be granted the lock automatically. ReplicationStateTransitionLockGuard transitionGuard(opCtx.get(), MODE_X); ASSERT_TRUE(opCtx->lockState()->isRSTLExclusive()); - auto locker = opCtx.get()->swapLockState(stdx::make_unique<LockerImpl>()); + auto locker = opCtx.get()->swapLockState(std::make_unique<LockerImpl>()); ASSERT_THROWS_CODE( getReplCoord()->stepDown(opCtx.get(), false, Milliseconds(0), Milliseconds(1000)), diff --git a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp index 197be4e4d0b..b4b02eefb00 100644 --- a/src/mongo/db/repl/replication_coordinator_test_fixture.cpp +++ b/src/mongo/db/repl/replication_coordinator_test_fixture.cpp @@ -34,6 +34,7 @@ #include "mongo/db/repl/replication_coordinator_test_fixture.h" #include <functional> +#include <memory> #include "mongo/db/logical_clock.h" #include "mongo/db/operation_context_noop.h" @@ -51,7 +52,6 @@ #include "mongo/executor/network_interface_mock.h" #include "mongo/executor/thread_pool_mock.h" #include "mongo/executor/thread_pool_task_executor.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/log.h" @@ -122,43 +122,43 @@ void ReplCoordTest::init() { StorageInterface::set(service, std::unique_ptr<StorageInterface>(_storageInterface)); ASSERT_TRUE(_storageInterface == StorageInterface::get(service)); - ReplicationProcess::set(service, - stdx::make_unique<ReplicationProcess>( - _storageInterface, - stdx::make_unique<ReplicationConsistencyMarkersMock>(), - stdx::make_unique<ReplicationRecoveryMock>())); + ReplicationProcess::set( + service, + std::make_unique<ReplicationProcess>(_storageInterface, + std::make_unique<ReplicationConsistencyMarkersMock>(), + std::make_unique<ReplicationRecoveryMock>())); auto replicationProcess = ReplicationProcess::get(service); // PRNG seed for tests. const int64_t seed = 0; - auto logicalClock = stdx::make_unique<LogicalClock>(service); + auto logicalClock = std::make_unique<LogicalClock>(service); LogicalClock::set(service, std::move(logicalClock)); TopologyCoordinator::Options settings; - auto topo = stdx::make_unique<TopologyCoordinator>(settings); + auto topo = std::make_unique<TopologyCoordinator>(settings); _topo = topo.get(); - auto net = stdx::make_unique<NetworkInterfaceMock>(); + auto net = std::make_unique<NetworkInterfaceMock>(); _net = net.get(); - auto externalState = stdx::make_unique<ReplicationCoordinatorExternalStateMock>(); + auto externalState = std::make_unique<ReplicationCoordinatorExternalStateMock>(); _externalState = externalState.get(); executor::ThreadPoolMock::Options tpOptions; tpOptions.onCreateThread = []() { Client::initThread("replexec"); }; - auto pool = stdx::make_unique<executor::ThreadPoolMock>(_net, seed, tpOptions); + auto pool = std::make_unique<executor::ThreadPoolMock>(_net, seed, tpOptions); auto replExec = - stdx::make_unique<executor::ThreadPoolTaskExecutor>(std::move(pool), std::move(net)); + std::make_unique<executor::ThreadPoolTaskExecutor>(std::move(pool), std::move(net)); _replExec = replExec.get(); - _repl = stdx::make_unique<ReplicationCoordinatorImpl>(service, - _settings, - std::move(externalState), - std::move(replExec), - std::move(topo), - replicationProcess, - _storageInterface, - seed); - service->setFastClockSource(stdx::make_unique<executor::NetworkInterfaceMockClockSource>(_net)); + _repl = std::make_unique<ReplicationCoordinatorImpl>(service, + _settings, + std::move(externalState), + std::move(replExec), + std::move(topo), + replicationProcess, + _storageInterface, + seed); + service->setFastClockSource(std::make_unique<executor::NetworkInterfaceMockClockSource>(_net)); service->setPreciseClockSource( - stdx::make_unique<executor::NetworkInterfaceMockClockSource>(_net)); + std::make_unique<executor::NetworkInterfaceMockClockSource>(_net)); } void ReplCoordTest::init(const ReplSettings& settings) { diff --git a/src/mongo/db/repl/replication_process_test.cpp b/src/mongo/db/repl/replication_process_test.cpp index 389d6a813fb..d0592001a20 100644 --- a/src/mongo/db/repl/replication_process_test.cpp +++ b/src/mongo/db/repl/replication_process_test.cpp @@ -43,7 +43,6 @@ #include "mongo/db/repl/storage_interface_mock.h" #include "mongo/db/service_context.h" #include "mongo/db/service_context_d_test_fixture.h" -#include "mongo/stdx/memory.h" namespace { @@ -61,9 +60,9 @@ protected: void ReplicationProcessTest::setUp() { ServiceContextMongoDTest::setUp(); - _storageInterface = stdx::make_unique<StorageInterfaceImpl>(); + _storageInterface = std::make_unique<StorageInterfaceImpl>(); auto service = getServiceContext(); - ReplicationCoordinator::set(service, stdx::make_unique<ReplicationCoordinatorMock>(service)); + ReplicationCoordinator::set(service, std::make_unique<ReplicationCoordinatorMock>(service)); } void ReplicationProcessTest::tearDown() { @@ -80,8 +79,8 @@ TEST_F(ReplicationProcessTest, ServiceContextDecorator) { ASSERT_FALSE(ReplicationProcess::get(serviceContext)); ReplicationProcess* replicationProcess = new ReplicationProcess( _storageInterface.get(), - stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get()), - stdx::make_unique<ReplicationRecoveryMock>()); + std::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get()), + std::make_unique<ReplicationRecoveryMock>()); ReplicationProcess::set(serviceContext, std::unique_ptr<ReplicationProcess>(replicationProcess)); ASSERT_TRUE(replicationProcess == ReplicationProcess::get(serviceContext)); @@ -93,8 +92,8 @@ TEST_F(ReplicationProcessTest, RollbackIDIncrementsBy1) { auto opCtx = makeOpCtx(); ReplicationProcess replicationProcess( _storageInterface.get(), - stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get()), - stdx::make_unique<ReplicationRecoveryMock>()); + std::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get()), + std::make_unique<ReplicationRecoveryMock>()); // We make no assumptions about the initial value of the rollback ID. ASSERT_OK(replicationProcess.initializeRollbackID(opCtx.get())); @@ -110,8 +109,8 @@ TEST_F(ReplicationProcessTest, RefreshRollbackIDResetsCachedValueFromStorage) { auto opCtx = makeOpCtx(); ReplicationProcess replicationProcess( _storageInterface.get(), - stdx::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get()), - stdx::make_unique<ReplicationRecoveryMock>()); + std::make_unique<ReplicationConsistencyMarkersImpl>(_storageInterface.get()), + std::make_unique<ReplicationRecoveryMock>()); // RefreshRollbackID returns NamespaceNotFound if there is no rollback.id collection. ASSERT_EQUALS(ErrorCodes::NamespaceNotFound, replicationProcess.refreshRollbackID(opCtx.get())); diff --git a/src/mongo/db/repl/replication_recovery_test.cpp b/src/mongo/db/repl/replication_recovery_test.cpp index f85d0de2252..029a3841b92 100644 --- a/src/mongo/db/repl/replication_recovery_test.cpp +++ b/src/mongo/db/repl/replication_recovery_test.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/client.h" #include "mongo/db/db_raii.h" #include "mongo/db/namespace_string.h" @@ -46,7 +48,6 @@ #include "mongo/db/service_context_d_test_fixture.h" #include "mongo/db/session_catalog_mongod.h" #include "mongo/db/session_txn_record_gen.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" #include "mongo/util/assert_util.h" @@ -168,15 +169,15 @@ private: ServiceContextMongoDTest::setUp(); auto service = getServiceContext(); - StorageInterface::set(service, stdx::make_unique<StorageInterfaceRecovery>()); + StorageInterface::set(service, std::make_unique<StorageInterfaceRecovery>()); _storageInterface = static_cast<StorageInterfaceRecovery*>(StorageInterface::get(service)); _createOpCtx(); - _consistencyMarkers = stdx::make_unique<ReplicationConsistencyMarkersMock>(); + _consistencyMarkers = std::make_unique<ReplicationConsistencyMarkersMock>(); ReplicationCoordinator::set( - service, stdx::make_unique<ReplicationCoordinatorMock>(service, getStorageInterface())); + service, std::make_unique<ReplicationCoordinatorMock>(service, getStorageInterface())); ASSERT_OK( ReplicationCoordinator::get(_opCtx.get())->setFollowerMode(MemberState::RS_PRIMARY)); @@ -190,7 +191,7 @@ private: observerRegistry->addObserver(std::make_unique<ReplicationRecoveryTestObObserver>()); repl::DropPendingCollectionReaper::set( - service, stdx::make_unique<repl::DropPendingCollectionReaper>(_storageInterface)); + service, std::make_unique<repl::DropPendingCollectionReaper>(_storageInterface)); } void tearDown() override { diff --git a/src/mongo/db/repl/reporter_test.cpp b/src/mongo/db/repl/reporter_test.cpp index 439f849e18f..b778e8748aa 100644 --- a/src/mongo/db/repl/reporter_test.cpp +++ b/src/mongo/db/repl/reporter_test.cpp @@ -29,11 +29,12 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/repl/reporter.h" #include "mongo/db/repl/update_position_args.h" #include "mongo/executor/network_interface_mock.h" #include "mongo/executor/thread_pool_task_executor_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/task_executor_proxy.h" #include "mongo/unittest/unittest.h" @@ -146,9 +147,9 @@ ReporterTest::ReporterTest() {} void ReporterTest::setUp() { executor::ThreadPoolExecutorTest::setUp(); - _executorProxy = stdx::make_unique<unittest::TaskExecutorProxy>(&getExecutor()); + _executorProxy = std::make_unique<unittest::TaskExecutorProxy>(&getExecutor()); - posUpdater = stdx::make_unique<MockProgressManager>(); + posUpdater = std::make_unique<MockProgressManager>(); posUpdater->updateMap(0, OpTime({3, 0}, 1), OpTime({3, 0}, 1)); prepareReplSetUpdatePositionCommandFn = [updater = posUpdater.get()] { @@ -156,11 +157,11 @@ void ReporterTest::setUp() { }; reporter = - stdx::make_unique<Reporter>(_executorProxy.get(), - [this]() { return prepareReplSetUpdatePositionCommandFn(); }, - HostAndPort("h1"), - Milliseconds(1000), - Milliseconds(5000)); + std::make_unique<Reporter>(_executorProxy.get(), + [this]() { return prepareReplSetUpdatePositionCommandFn(); }, + HostAndPort("h1"), + Milliseconds(1000), + Milliseconds(5000)); launchExecutorThread(); if (triggerAtSetUp()) { diff --git a/src/mongo/db/repl/rollback_checker_test.cpp b/src/mongo/db/repl/rollback_checker_test.cpp index 21ff4dbd149..46d366645cb 100644 --- a/src/mongo/db/repl/rollback_checker_test.cpp +++ b/src/mongo/db/repl/rollback_checker_test.cpp @@ -30,11 +30,12 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/client.h" #include "mongo/db/repl/rollback_checker.h" #include "mongo/executor/network_interface_mock.h" #include "mongo/executor/thread_pool_task_executor_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/log.h" @@ -64,7 +65,7 @@ void RollbackCheckerTest::setUp() { executor::ThreadPoolExecutorTest::setUp(); launchExecutorThread(); getNet()->enterNetwork(); - _rollbackChecker = stdx::make_unique<RollbackChecker>(&getExecutor(), HostAndPort()); + _rollbackChecker = std::make_unique<RollbackChecker>(&getExecutor(), HostAndPort()); stdx::lock_guard<stdx::mutex> lk(_mutex); _hasRolledBackResult = {ErrorCodes::NotYetInitialized, ""}; _hasCalledCallback = false; diff --git a/src/mongo/db/repl/rollback_impl_test.cpp b/src/mongo/db/repl/rollback_impl_test.cpp index 78327f0d2a3..836eecd1076 100644 --- a/src/mongo/db/repl/rollback_impl_test.cpp +++ b/src/mongo/db/repl/rollback_impl_test.cpp @@ -305,15 +305,15 @@ private: void RollbackImplTest::setUp() { RollbackTest::setUp(); - _localOplog = stdx::make_unique<OplogInterfaceLocal>(_opCtx.get()); - _remoteOplog = stdx::make_unique<OplogInterfaceMock>(); - _listener = stdx::make_unique<Listener>(this); - _rollback = stdx::make_unique<RollbackImplForTest>(_localOplog.get(), - _remoteOplog.get(), - _storageInterface, - _replicationProcess.get(), - _coordinator, - _listener.get()); + _localOplog = std::make_unique<OplogInterfaceLocal>(_opCtx.get()); + _remoteOplog = std::make_unique<OplogInterfaceMock>(); + _listener = std::make_unique<Listener>(this); + _rollback = std::make_unique<RollbackImplForTest>(_localOplog.get(), + _remoteOplog.get(), + _storageInterface, + _replicationProcess.get(), + _coordinator, + _listener.get()); createOplog(_opCtx.get()); serverGlobalParams.clusterRole = ClusterRole::None; diff --git a/src/mongo/db/repl/rollback_source_impl.cpp b/src/mongo/db/repl/rollback_source_impl.cpp index 2170ee1663d..26a9240bbc8 100644 --- a/src/mongo/db/repl/rollback_source_impl.cpp +++ b/src/mongo/db/repl/rollback_source_impl.cpp @@ -83,7 +83,7 @@ std::pair<BSONObj, NamespaceString> RollbackSourceImpl::findOneByUUID(const std: void RollbackSourceImpl::copyCollectionFromRemote(OperationContext* opCtx, const NamespaceString& nss) const { std::string errmsg; - auto tmpConn = stdx::make_unique<DBClientConnection>(); + auto tmpConn = std::make_unique<DBClientConnection>(); uassert(15908, errmsg, tmpConn->connect(_source, StringData(), errmsg) && replAuthenticate(tmpConn.get())); diff --git a/src/mongo/db/repl/rollback_test_fixture.cpp b/src/mongo/db/repl/rollback_test_fixture.cpp index a2de3b5b0b6..d7ac0b18c27 100644 --- a/src/mongo/db/repl/rollback_test_fixture.cpp +++ b/src/mongo/db/repl/rollback_test_fixture.cpp @@ -31,6 +31,7 @@ #include "mongo/db/repl/rollback_test_fixture.h" +#include <memory> #include <string> #include "mongo/db/catalog/collection_catalog_entry.h" @@ -48,7 +49,6 @@ #include "mongo/db/repl/rs_rollback.h" #include "mongo/logger/log_component.h" #include "mongo/logger/logger.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { @@ -89,10 +89,10 @@ public: void RollbackTest::setUp() { _storageInterface = new StorageInterfaceRollback(); auto serviceContext = getServiceContext(); - auto consistencyMarkers = stdx::make_unique<ReplicationConsistencyMarkersMock>(); + auto consistencyMarkers = std::make_unique<ReplicationConsistencyMarkersMock>(); auto recovery = - stdx::make_unique<ReplicationRecoveryImpl>(_storageInterface, consistencyMarkers.get()); - _replicationProcess = stdx::make_unique<ReplicationProcess>( + std::make_unique<ReplicationRecoveryImpl>(_storageInterface, consistencyMarkers.get()); + _replicationProcess = std::make_unique<ReplicationProcess>( _storageInterface, std::move(consistencyMarkers), std::move(recovery)); _dropPendingCollectionReaper = new DropPendingCollectionReaper(_storageInterface); DropPendingCollectionReaper::set( diff --git a/src/mongo/db/repl/rs_rollback_test.cpp b/src/mongo/db/repl/rs_rollback_test.cpp index f9f122309d4..b669cb65536 100644 --- a/src/mongo/db/repl/rs_rollback_test.cpp +++ b/src/mongo/db/repl/rs_rollback_test.cpp @@ -32,6 +32,7 @@ #include "mongo/platform/basic.h" #include <initializer_list> +#include <memory> #include <utility> #include "mongo/db/catalog/collection_catalog.h" @@ -56,7 +57,6 @@ #include "mongo/db/repl/rollback_test_fixture.h" #include "mongo/db/repl/rs_rollback.h" #include "mongo/db/s/shard_identity_rollback_notifier.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" #include "mongo/util/net/hostandport.h" @@ -187,7 +187,7 @@ TEST_F(RSRollbackTest, InconsistentMinValid) { OpTime(Timestamp(Seconds(1), 0), 0)); auto status = syncRollback(_opCtx.get(), OplogInterfaceMock(), - RollbackSourceMock(stdx::make_unique<OplogInterfaceMock>()), + RollbackSourceMock(std::make_unique<OplogInterfaceMock>()), {}, _coordinator, _replicationProcess.get()); @@ -199,7 +199,7 @@ TEST_F(RSRollbackTest, OplogStartMissing) { OpTime ts(Timestamp(Seconds(1), 0), 0); auto operation = std::make_pair(BSON("ts" << ts.getTimestamp()), RecordId()); OplogInterfaceMock::Operations remoteOperations({operation}); - auto remoteOplog = stdx::make_unique<OplogInterfaceMock>(remoteOperations); + auto remoteOplog = std::make_unique<OplogInterfaceMock>(remoteOperations); ASSERT_EQUALS(ErrorCodes::OplogStartMissing, syncRollback(_opCtx.get(), OplogInterfaceMock(), @@ -215,7 +215,7 @@ TEST_F(RSRollbackTest, NoRemoteOpLog) { auto operation = std::make_pair(BSON("ts" << ts.getTimestamp()), RecordId()); auto status = syncRollback(_opCtx.get(), OplogInterfaceMock({operation}), - RollbackSourceMock(stdx::make_unique<OplogInterfaceMock>()), + RollbackSourceMock(std::make_unique<OplogInterfaceMock>()), {}, _coordinator, _replicationProcess.get()); @@ -236,7 +236,7 @@ TEST_F(RSRollbackTest, RemoteGetRollbackIdThrows) { }; ASSERT_THROWS_CODE(syncRollback(_opCtx.get(), OplogInterfaceMock({operation}), - RollbackSourceLocal(stdx::make_unique<OplogInterfaceMock>()), + RollbackSourceLocal(std::make_unique<OplogInterfaceMock>()), {}, _coordinator, _replicationProcess.get()), @@ -258,7 +258,7 @@ TEST_F(RSRollbackTest, RemoteGetRollbackIdDiffersFromRequiredRBID) { ASSERT_THROWS_CODE(syncRollback(_opCtx.get(), OplogInterfaceMock({operation}), - RollbackSourceLocal(stdx::make_unique<OplogInterfaceMock>()), + RollbackSourceLocal(std::make_unique<OplogInterfaceMock>()), 1, _coordinator, _replicationProcess.get()), @@ -865,7 +865,7 @@ TEST_F(RSRollbackTest, RollbackDropIndexOnCollectionWithTwoExistingIndexes) { auto localOplog = {dropIndex0Op, createIndex1Op, createIndex0Op, commonOp}; // Set up the mock rollback source and then run rollback. - RollbackSourceMock rollbackSource(stdx::make_unique<OplogInterfaceMock>(remoteOplog)); + RollbackSourceMock rollbackSource(std::make_unique<OplogInterfaceMock>(remoteOplog)); ASSERT_OK(syncRollback(_opCtx.get(), OplogInterfaceMock(localOplog), rollbackSource, @@ -896,7 +896,7 @@ TEST_F(RSRollbackTest, RollbackTwoIndexDropsPrecededByTwoIndexCreationsOnSameCol auto localOplog = {dropIndex1Op, dropIndex0Op, createIndex1Op, createIndex0Op, commonOp}; // Set up the mock rollback source and then run rollback. - RollbackSourceMock rollbackSource(stdx::make_unique<OplogInterfaceMock>(remoteOplog)); + RollbackSourceMock rollbackSource(std::make_unique<OplogInterfaceMock>(remoteOplog)); ASSERT_OK(syncRollback(_opCtx.get(), OplogInterfaceMock(localOplog), rollbackSource, @@ -932,7 +932,7 @@ TEST_F(RSRollbackTest, RollbackMultipleCreateIndexesOnSameCollection) { auto localOplog = {createIndex2Op, createIndex1Op, createIndex0Op, commonOp}; // Set up the mock rollback source and then run rollback. - RollbackSourceMock rollbackSource(stdx::make_unique<OplogInterfaceMock>(remoteOplog)); + RollbackSourceMock rollbackSource(std::make_unique<OplogInterfaceMock>(remoteOplog)); ASSERT_OK(syncRollback(_opCtx.get(), OplogInterfaceMock(localOplog), rollbackSource, @@ -973,7 +973,7 @@ TEST_F(RSRollbackTest, RollbackCreateDropRecreateIndexOnCollection) { auto localOplog = {createIndex0AgainOp, dropIndex0Op, createIndex0Op, commonOp}; // Set up the mock rollback source and then run rollback. - RollbackSourceMock rollbackSource(stdx::make_unique<OplogInterfaceMock>(remoteOplog)); + RollbackSourceMock rollbackSource(std::make_unique<OplogInterfaceMock>(remoteOplog)); ASSERT_OK(syncRollback(_opCtx.get(), OplogInterfaceMock(localOplog), rollbackSource, @@ -2735,7 +2735,7 @@ TEST_F(RSRollbackTest, RollbackReturnsImmediatelyOnFailureToTransitionToRollback // syncRollback(). We provide an empty oplog so that if syncRollback() is called erroneously, // we would go fatal. OplogInterfaceMock localOplogWithSingleOplogEntry({makeNoopOplogEntryAndRecordId(Seconds(1))}); - RollbackSourceMock rollbackSourceWithInvalidOplog(stdx::make_unique<OplogInterfaceMock>()); + RollbackSourceMock rollbackSourceWithInvalidOplog(std::make_unique<OplogInterfaceMock>()); // Inject ReplicationCoordinator::setFollowerMode() error. We set the current member state // because it will be logged by rollback() on failing to transition to ROLLBACK. @@ -2764,7 +2764,7 @@ DEATH_TEST_F( // rollback() should abort on getting UnrecoverableRollbackError from syncRollback(). An empty // local oplog will make syncRollback() return the intended error. OplogInterfaceMock localOplogWithSingleOplogEntry({makeNoopOplogEntryAndRecordId(Seconds(1))}); - RollbackSourceMock rollbackSourceWithInvalidOplog(stdx::make_unique<OplogInterfaceMock>()); + RollbackSourceMock rollbackSourceWithInvalidOplog(std::make_unique<OplogInterfaceMock>()); rollback(_opCtx.get(), localOplogWithSingleOplogEntry, @@ -2780,7 +2780,7 @@ TEST_F(RSRollbackTest, RollbackLogsRetryMessageAndReturnsOnNonUnrecoverableRollb // about retrying rollback later before returning. OplogInterfaceMock localOplogWithNoEntries; OplogInterfaceMock::Operations remoteOperations({makeNoopOplogEntryAndRecordId(Seconds(1))}); - auto remoteOplog = stdx::make_unique<OplogInterfaceMock>(remoteOperations); + auto remoteOplog = std::make_unique<OplogInterfaceMock>(remoteOperations); RollbackSourceMock rollbackSourceWithValidOplog(std::move(remoteOplog)); auto noopSleepSecsFn = [](int) {}; diff --git a/src/mongo/db/repl/scatter_gather_test.cpp b/src/mongo/db/repl/scatter_gather_test.cpp index 94c5e13d55e..ef8fd02aeb1 100644 --- a/src/mongo/db/repl/scatter_gather_test.cpp +++ b/src/mongo/db/repl/scatter_gather_test.cpp @@ -30,11 +30,11 @@ #include "mongo/platform/basic.h" #include <functional> +#include <memory> #include "mongo/db/repl/scatter_gather_algorithm.h" #include "mongo/db/repl/scatter_gather_runner.h" #include "mongo/executor/thread_pool_task_executor_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/unittest/unittest.h" @@ -121,7 +121,7 @@ public: } void run() { - _thread = stdx::make_unique<stdx::thread>([this] { _run(_executor); }); + _thread = std::make_unique<stdx::thread>([this] { _run(_executor); }); } private: diff --git a/src/mongo/db/repl/storage_interface_impl.cpp b/src/mongo/db/repl/storage_interface_impl.cpp index f9bc85de6dc..5675b38179a 100644 --- a/src/mongo/db/repl/storage_interface_impl.cpp +++ b/src/mongo/db/repl/storage_interface_impl.cpp @@ -235,7 +235,7 @@ StorageInterfaceImpl::createCollectionForBulkLoading( wunit.commit(); } - autoColl = stdx::make_unique<AutoGetCollection>( + autoColl = std::make_unique<AutoGetCollection>( opCtx.get(), nss, fixLockModeForSystemDotViewsChanges(nss, MODE_IX)); // Build empty capped indexes. Capped indexes cannot be built by the MultiIndexBlock @@ -271,10 +271,10 @@ StorageInterfaceImpl::createCollectionForBulkLoading( // Move locks into loader, so it now controls their lifetime. auto loader = - stdx::make_unique<CollectionBulkLoaderImpl>(Client::releaseCurrent(), - std::move(opCtx), - std::move(autoColl), - options.capped ? BSONObj() : idIndexSpec); + std::make_unique<CollectionBulkLoaderImpl>(Client::releaseCurrent(), + std::move(opCtx), + std::move(autoColl), + options.capped ? BSONObj() : idIndexSpec); status = loader->init(options.capped ? std::vector<BSONObj>() : secondaryIndexSpecs); if (!status.isOK()) { diff --git a/src/mongo/db/repl/storage_interface_impl_test.cpp b/src/mongo/db/repl/storage_interface_impl_test.cpp index 6a2c23ad6fb..cd4240a234c 100644 --- a/src/mongo/db/repl/storage_interface_impl_test.cpp +++ b/src/mongo/db/repl/storage_interface_impl_test.cpp @@ -52,7 +52,6 @@ #include "mongo/db/repl/storage_interface_impl.h" #include "mongo/db/repl/sync_tail_test_fixture.h" #include "mongo/db/service_context_d_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/unittest/unittest.h" #include "mongo/util/assert_util.h" @@ -202,7 +201,7 @@ private: ServiceContextMongoDTest::setUp(); _createOpCtx(); auto service = getServiceContext(); - auto replCoord = stdx::make_unique<ReplicationCoordinatorMock>(service); + auto replCoord = std::make_unique<ReplicationCoordinatorMock>(service); _replicationCoordinatorMock = replCoord.get(); ReplicationCoordinator::set(service, std::move(replCoord)); } @@ -217,8 +216,8 @@ private: void _createOpCtx() { _opCtx = cc().makeOperationContext(); // We are not replicating nor validating these writes. - _uwb = stdx::make_unique<UnreplicatedWritesBlock>(_opCtx.get()); - _ddv = stdx::make_unique<DisableDocumentValidation>(_opCtx.get()); + _uwb = std::make_unique<UnreplicatedWritesBlock>(_opCtx.get()); + _ddv = std::make_unique<DisableDocumentValidation>(_opCtx.get()); } ServiceContext::UniqueOperationContext _opCtx; diff --git a/src/mongo/db/repl/sync_source_resolver.cpp b/src/mongo/db/repl/sync_source_resolver.cpp index adfcc7b2f31..865654622e9 100644 --- a/src/mongo/db/repl/sync_source_resolver.cpp +++ b/src/mongo/db/repl/sync_source_resolver.cpp @@ -33,12 +33,13 @@ #include "mongo/db/repl/sync_source_resolver.h" +#include <memory> + #include "mongo/db/jsobj.h" #include "mongo/db/repl/oplog_entry.h" #include "mongo/db/repl/replication_process.h" #include "mongo/db/repl/sync_source_selector.h" #include "mongo/rpc/get_status_from_command_result.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/destructor_guard.h" #include "mongo/util/log.h" @@ -165,7 +166,7 @@ StatusWith<HostAndPort> SyncSourceResolver::_chooseNewSyncSource() { std::unique_ptr<Fetcher> SyncSourceResolver::_makeFirstOplogEntryFetcher( HostAndPort candidate, OpTime earliestOpTimeSeen) { - return stdx::make_unique<Fetcher>( + return std::make_unique<Fetcher>( _taskExecutor, candidate, kLocalOplogNss.db().toString(), @@ -189,7 +190,7 @@ std::unique_ptr<Fetcher> SyncSourceResolver::_makeRequiredOpTimeFetcher(HostAndP int rbid) { // This query is structured so that it is executed on the sync source using the oplog // start hack (oplogReplay=true and $gt/$gte predicate over "ts"). - return stdx::make_unique<Fetcher>( + return std::make_unique<Fetcher>( _taskExecutor, candidate, kLocalOplogNss.db().toString(), diff --git a/src/mongo/db/repl/sync_source_resolver_test.cpp b/src/mongo/db/repl/sync_source_resolver_test.cpp index 91e60979070..4337f834c25 100644 --- a/src/mongo/db/repl/sync_source_resolver_test.cpp +++ b/src/mongo/db/repl/sync_source_resolver_test.cpp @@ -40,7 +40,6 @@ #include "mongo/db/repl/sync_source_selector_mock.h" #include "mongo/executor/network_interface_mock.h" #include "mongo/executor/thread_pool_task_executor_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/task_executor_proxy.h" #include "mongo/unittest/unittest.h" #include "mongo/util/assert_util.h" @@ -95,7 +94,7 @@ void SyncSourceResolverTest::setUp() { executor::ThreadPoolExecutorTest::setUp(); _shouldFailRequest = [](const executor::RemoteCommandRequest&) { return false; }; - _executorProxy = stdx::make_unique<TaskExecutorWithFailureInScheduleRemoteCommand>( + _executorProxy = std::make_unique<TaskExecutorWithFailureInScheduleRemoteCommand>( &getExecutor(), [this](const executor::RemoteCommandRequest& request) { return _shouldFailRequest(request); }); @@ -103,7 +102,7 @@ void SyncSourceResolverTest::setUp() { _response.syncSourceStatus = getDetectableErrorStatus(); _onCompletion = [this](const SyncSourceResolverResponse& response) { _response = response; }; - _selector = stdx::make_unique<SyncSourceSelectorMock>(); + _selector = std::make_unique<SyncSourceSelectorMock>(); _resolver = _makeResolver(lastOpTimeFetched, OpTime()); launchExecutorThread(); @@ -120,7 +119,7 @@ void SyncSourceResolverTest::tearDown() { std::unique_ptr<SyncSourceResolver> SyncSourceResolverTest::_makeResolver( const OpTime& lastOpTimeFetched, const OpTime& requiredOpTime) { - return stdx::make_unique<SyncSourceResolver>( + return std::make_unique<SyncSourceResolver>( _executorProxy.get(), _selector.get(), lastOpTimeFetched, diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp index ac6331d02f7..c913ca2a6f7 100644 --- a/src/mongo/db/repl/sync_tail.cpp +++ b/src/mongo/db/repl/sync_tail.cpp @@ -75,7 +75,6 @@ #include "mongo/db/stats/timer_stats.h" #include "mongo/db/transaction_participant.h" #include "mongo/db/transaction_participant_gen.h" -#include "mongo/stdx/memory.h" #include "mongo/util/exit.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/log.h" diff --git a/src/mongo/db/repl/sync_tail_test.cpp b/src/mongo/db/repl/sync_tail_test.cpp index 403b3d4d268..f63d49d4c31 100644 --- a/src/mongo/db/repl/sync_tail_test.cpp +++ b/src/mongo/db/repl/sync_tail_test.cpp @@ -2372,7 +2372,7 @@ TEST_F(SyncTailTest, LogSlowOpApplicationWhenSuccessful) { // This duration is greater than "slowMS", so the op would be considered slow. auto applyDuration = serverGlobalParams.slowMS * 10; getServiceContext()->setFastClockSource( - stdx::make_unique<AutoAdvancingClockSourceMock>(Milliseconds(applyDuration))); + std::make_unique<AutoAdvancingClockSourceMock>(Milliseconds(applyDuration))); // We are inserting into an existing collection. const NamespaceString nss("test.t"); @@ -2395,7 +2395,7 @@ TEST_F(SyncTailTest, DoNotLogSlowOpApplicationWhenFailed) { // This duration is greater than "slowMS", so the op would be considered slow. auto applyDuration = serverGlobalParams.slowMS * 10; getServiceContext()->setFastClockSource( - stdx::make_unique<AutoAdvancingClockSourceMock>(Milliseconds(applyDuration))); + std::make_unique<AutoAdvancingClockSourceMock>(Milliseconds(applyDuration))); // We are trying to insert into a non-existing database. NamespaceString nss("test.t"); @@ -2420,7 +2420,7 @@ TEST_F(SyncTailTest, DoNotLogNonSlowOpApplicationWhenSuccessful) { // This duration is below "slowMS", so the op would *not* be considered slow. auto applyDuration = serverGlobalParams.slowMS / 10; getServiceContext()->setFastClockSource( - stdx::make_unique<AutoAdvancingClockSourceMock>(Milliseconds(applyDuration))); + std::make_unique<AutoAdvancingClockSourceMock>(Milliseconds(applyDuration))); // We are inserting into an existing collection. const NamespaceString nss("test.t"); diff --git a/src/mongo/db/repl/sync_tail_test_fixture.cpp b/src/mongo/db/repl/sync_tail_test_fixture.cpp index 045b1b00bc8..eca42666f91 100644 --- a/src/mongo/db/repl/sync_tail_test_fixture.cpp +++ b/src/mongo/db/repl/sync_tail_test_fixture.cpp @@ -111,17 +111,17 @@ void SyncTailTest::setUp() { _opCtx = cc().makeOperationContext(); ReplicationCoordinator::set(serviceContext, - stdx::make_unique<ReplicationCoordinatorMock>(serviceContext)); + std::make_unique<ReplicationCoordinatorMock>(serviceContext)); ASSERT_OK(ReplicationCoordinator::get(_opCtx.get())->setFollowerMode(MemberState::RS_PRIMARY)); - StorageInterface::set(serviceContext, stdx::make_unique<StorageInterfaceImpl>()); + StorageInterface::set(serviceContext, std::make_unique<StorageInterfaceImpl>()); DropPendingCollectionReaper::set( - serviceContext, stdx::make_unique<DropPendingCollectionReaper>(getStorageInterface())); + serviceContext, std::make_unique<DropPendingCollectionReaper>(getStorageInterface())); repl::setOplogCollectionName(serviceContext); repl::createOplog(_opCtx.get()); - _consistencyMarkers = stdx::make_unique<ReplicationConsistencyMarkersMock>(); + _consistencyMarkers = std::make_unique<ReplicationConsistencyMarkersMock>(); // Set up an OpObserver to track the documents SyncTail inserts. auto opObserver = std::make_unique<SyncTailOpObserver>(); diff --git a/src/mongo/db/repl/task_runner_test_fixture.cpp b/src/mongo/db/repl/task_runner_test_fixture.cpp index ade615489b1..760033adaee 100644 --- a/src/mongo/db/repl/task_runner_test_fixture.cpp +++ b/src/mongo/db/repl/task_runner_test_fixture.cpp @@ -32,9 +32,9 @@ #include "mongo/db/repl/task_runner_test_fixture.h" #include <functional> +#include <memory> #include "mongo/db/repl/task_runner.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace repl { @@ -64,10 +64,10 @@ void TaskRunnerTest::setUp() { ThreadPool::Options options; options.poolName = "TaskRunnerTest"; options.onCreateThread = [](const std::string& name) { Client::initThread(name); }; - _threadPool = stdx::make_unique<ThreadPool>(options); + _threadPool = std::make_unique<ThreadPool>(options); _threadPool->startup(); - _taskRunner = stdx::make_unique<TaskRunner>(_threadPool.get()); + _taskRunner = std::make_unique<TaskRunner>(_threadPool.get()); } void TaskRunnerTest::tearDown() { diff --git a/src/mongo/db/repl/vote_requester.cpp b/src/mongo/db/repl/vote_requester.cpp index 5c18076d810..ad29d5f5725 100644 --- a/src/mongo/db/repl/vote_requester.cpp +++ b/src/mongo/db/repl/vote_requester.cpp @@ -33,11 +33,12 @@ #include "mongo/db/repl/vote_requester.h" +#include <memory> + #include "mongo/base/status.h" #include "mongo/db/repl/repl_set_request_votes_args.h" #include "mongo/db/repl/scatter_gather_runner.h" #include "mongo/rpc/get_status_from_command_result.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" namespace mongo { @@ -189,7 +190,7 @@ StatusWith<executor::TaskExecutor::EventHandle> VoteRequester::start( int primaryIndex) { _algorithm = std::make_shared<Algorithm>( rsConfig, candidateIndex, term, dryRun, lastDurableOpTime, primaryIndex); - _runner = stdx::make_unique<ScatterGatherRunner>(_algorithm, executor, "vote request"); + _runner = std::make_unique<ScatterGatherRunner>(_algorithm, executor, "vote request"); return _runner->start(); } diff --git a/src/mongo/db/repl/vote_requester.h b/src/mongo/db/repl/vote_requester.h index 158e442124e..6eed65bc1e3 100644 --- a/src/mongo/db/repl/vote_requester.h +++ b/src/mongo/db/repl/vote_requester.h @@ -38,7 +38,6 @@ #include "mongo/db/repl/repl_set_config.h" #include "mongo/db/repl/scatter_gather_algorithm.h" #include "mongo/db/repl/scatter_gather_runner.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/unordered_set.h" namespace mongo { diff --git a/src/mongo/db/s/active_migrations_registry.h b/src/mongo/db/s/active_migrations_registry.h index d2e3f4b2ad0..2f5dc3b56ae 100644 --- a/src/mongo/db/s/active_migrations_registry.h +++ b/src/mongo/db/s/active_migrations_registry.h @@ -30,10 +30,10 @@ #pragma once #include <boost/optional.hpp> +#include <memory> #include "mongo/db/s/migration_session_id.h" #include "mongo/s/request_types/move_chunk_request.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/util/concurrency/notification.h" diff --git a/src/mongo/db/s/active_shard_collection_registry.h b/src/mongo/db/s/active_shard_collection_registry.h index cab710b5ee5..06f7f69d906 100644 --- a/src/mongo/db/s/active_shard_collection_registry.h +++ b/src/mongo/db/s/active_shard_collection_registry.h @@ -30,9 +30,9 @@ #pragma once #include <boost/optional.hpp> +#include <memory> #include "mongo/s/request_types/shard_collection_gen.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/util/concurrency/notification.h" diff --git a/src/mongo/db/s/balancer/balancer.cpp b/src/mongo/db/s/balancer/balancer.cpp index 43f924132aa..b8e0a57f5b8 100644 --- a/src/mongo/db/s/balancer/balancer.cpp +++ b/src/mongo/db/s/balancer/balancer.cpp @@ -34,6 +34,7 @@ #include "mongo/db/s/balancer/balancer.h" #include <algorithm> +#include <memory> #include <string> #include "mongo/base/status_with.h" @@ -51,7 +52,6 @@ #include "mongo/s/client/shard_registry.h" #include "mongo/s/grid.h" #include "mongo/s/shard_util.h" -#include "mongo/stdx/memory.h" #include "mongo/util/concurrency/idle_thread_block.h" #include "mongo/util/exit.h" #include "mongo/util/log.h" @@ -154,9 +154,9 @@ void warnOnMultiVersion(const vector<ClusterStatistics::ShardStatistics>& cluste Balancer::Balancer(ServiceContext* serviceContext) : _balancedLastTime(0), _random(std::random_device{}()), - _clusterStats(stdx::make_unique<ClusterStatisticsImpl>(_random)), + _clusterStats(std::make_unique<ClusterStatisticsImpl>(_random)), _chunkSelectionPolicy( - stdx::make_unique<BalancerChunkSelectionPolicyImpl>(_clusterStats.get(), _random)), + std::make_unique<BalancerChunkSelectionPolicyImpl>(_clusterStats.get(), _random)), _migrationManager(serviceContext) {} Balancer::~Balancer() { @@ -167,7 +167,7 @@ Balancer::~Balancer() { void Balancer::create(ServiceContext* serviceContext) { invariant(!getBalancer(serviceContext)); - getBalancer(serviceContext) = stdx::make_unique<Balancer>(serviceContext); + getBalancer(serviceContext) = std::make_unique<Balancer>(serviceContext); } Balancer* Balancer::get(ServiceContext* serviceContext) { diff --git a/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp b/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp index 3162ca40daf..e6d358e982b 100644 --- a/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp +++ b/src/mongo/db/s/balancer/balancer_chunk_selection_policy_impl.cpp @@ -34,6 +34,7 @@ #include "mongo/db/s/balancer/balancer_chunk_selection_policy_impl.h" #include <algorithm> +#include <memory> #include <vector> #include "mongo/base/status_with.h" @@ -43,7 +44,6 @@ #include "mongo/s/catalog/type_tags.h" #include "mongo/s/catalog_cache.h" #include "mongo/s/grid.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/str.h" diff --git a/src/mongo/db/s/balancer/migration_manager_test.cpp b/src/mongo/db/s/balancer/migration_manager_test.cpp index ec2bdc8b12d..3e25160c065 100644 --- a/src/mongo/db/s/balancer/migration_manager_test.cpp +++ b/src/mongo/db/s/balancer/migration_manager_test.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/client/remote_command_targeter_mock.h" #include "mongo/db/commands.h" #include "mongo/db/s/balancer/migration_manager.h" @@ -42,7 +44,6 @@ #include "mongo/s/config_server_test_fixture.h" #include "mongo/s/database_version_helpers.h" #include "mongo/s/request_types/move_chunk_request.h" -#include "mongo/stdx/memory.h" #include "mongo/util/scopeguard.h" namespace mongo { @@ -160,7 +161,7 @@ private: void MigrationManagerTest::setUp() { ConfigServerTestFixture::setUp(); - _migrationManager = stdx::make_unique<MigrationManager>(getServiceContext()); + _migrationManager = std::make_unique<MigrationManager>(getServiceContext()); _migrationManager->startRecoveryAndAcquireDistLocks(operationContext()); _migrationManager->finishRecovery(operationContext(), 0, kDefaultSecondaryThrottle); } diff --git a/src/mongo/db/s/collection_metadata.cpp b/src/mongo/db/s/collection_metadata.cpp index 112499944af..bb9063b8395 100644 --- a/src/mongo/db/s/collection_metadata.cpp +++ b/src/mongo/db/s/collection_metadata.cpp @@ -33,11 +33,12 @@ #include "mongo/db/s/collection_metadata.h" +#include <memory> + #include "mongo/bson/simple_bsonobj_comparator.h" #include "mongo/bson/util/builder.h" #include "mongo/db/bson/dotted_path_support.h" #include "mongo/s/catalog/type_chunk.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/str.h" diff --git a/src/mongo/db/s/collection_metadata_test.cpp b/src/mongo/db/s/collection_metadata_test.cpp index 33f81707841..ac36558a234 100644 --- a/src/mongo/db/s/collection_metadata_test.cpp +++ b/src/mongo/db/s/collection_metadata_test.cpp @@ -29,12 +29,13 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/base/status.h" #include "mongo/db/range_arithmetic.h" #include "mongo/db/s/collection_metadata.h" #include "mongo/s/catalog/type_chunk.h" #include "mongo/s/chunk_version.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -82,7 +83,7 @@ std::unique_ptr<CollectionMetadata> makeCollectionMetadataImpl( auto rt = RoutingTableHistory::makeNew(kNss, uuid, shardKeyPattern, nullptr, false, epoch, allChunks); std::shared_ptr<ChunkManager> cm = std::make_shared<ChunkManager>(rt, kChunkManager); - return stdx::make_unique<CollectionMetadata>(cm, kThisShard); + return std::make_unique<CollectionMetadata>(cm, kThisShard); } struct ConstructedRangeMap : public RangeMap { diff --git a/src/mongo/db/s/collection_range_deleter_test.cpp b/src/mongo/db/s/collection_range_deleter_test.cpp index 0ca096c8307..320b6b3796b 100644 --- a/src/mongo/db/s/collection_range_deleter_test.cpp +++ b/src/mongo/db/s/collection_range_deleter_test.cpp @@ -113,7 +113,7 @@ protected: } std::unique_ptr<BalancerConfiguration> makeBalancerConfiguration() override { - return stdx::make_unique<BalancerConfiguration>(); + return std::make_unique<BalancerConfiguration>(); } private: diff --git a/src/mongo/db/s/collection_sharding_state_factory_shard.cpp b/src/mongo/db/s/collection_sharding_state_factory_shard.cpp index a7f0f5f8dc5..49a4f118ce5 100644 --- a/src/mongo/db/s/collection_sharding_state_factory_shard.cpp +++ b/src/mongo/db/s/collection_sharding_state_factory_shard.cpp @@ -63,9 +63,9 @@ private: const std::string kExecName("CollectionRangeDeleter-TaskExecutor"); auto net = executor::makeNetworkInterface(kExecName); - auto pool = stdx::make_unique<executor::NetworkInterfaceThreadPool>(net.get()); - auto taskExecutor = stdx::make_unique<executor::ThreadPoolTaskExecutor>(std::move(pool), - std::move(net)); + auto pool = std::make_unique<executor::NetworkInterfaceThreadPool>(net.get()); + auto taskExecutor = + std::make_unique<executor::ThreadPoolTaskExecutor>(std::move(pool), std::move(net)); taskExecutor->startup(); _taskExecutor = std::move(taskExecutor); diff --git a/src/mongo/db/s/config/sharding_catalog_manager_add_shard_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_add_shard_test.cpp index 23a107a43b5..2afb325d565 100644 --- a/src/mongo/db/s/config/sharding_catalog_manager_add_shard_test.cpp +++ b/src/mongo/db/s/config/sharding_catalog_manager_add_shard_test.cpp @@ -383,7 +383,7 @@ TEST_F(AddShardTest, CreateShardIdentityUpsertForAddShard) { TEST_F(AddShardTest, StandaloneBasicSuccess) { std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); HostAndPort shardTarget("StandaloneHost:12345"); targeter->setConnectionStringReturnValue(ConnectionString(shardTarget)); targeter->setFindHostReturnValue(shardTarget); @@ -456,7 +456,7 @@ TEST_F(AddShardTest, StandaloneBasicSuccess) { TEST_F(AddShardTest, StandaloneGenerateName) { std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); HostAndPort shardTarget("StandaloneHost:12345"); targeter->setConnectionStringReturnValue(ConnectionString(shardTarget)); targeter->setFindHostReturnValue(shardTarget); @@ -537,7 +537,7 @@ TEST_F(AddShardTest, StandaloneGenerateName) { TEST_F(AddShardTest, AddSCCCConnectionStringAsShard) { std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); auto invalidConn = ConnectionString("host1:12345,host2:12345,host3:12345", ConnectionString::INVALID); targeter->setConnectionStringReturnValue(invalidConn); @@ -555,7 +555,7 @@ TEST_F(AddShardTest, AddSCCCConnectionStringAsShard) { TEST_F(AddShardTest, EmptyShardName) { std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); std::string expectedShardName = ""; auto future = launchAsync([this, expectedShardName] { @@ -574,7 +574,7 @@ TEST_F(AddShardTest, EmptyShardName) { // Host is unreachable, cannot verify host. TEST_F(AddShardTest, UnreachableHost) { std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); HostAndPort shardTarget("StandaloneHost:12345"); targeter->setConnectionStringReturnValue(ConnectionString(shardTarget)); targeter->setFindHostReturnValue(shardTarget); @@ -601,7 +601,7 @@ TEST_F(AddShardTest, UnreachableHost) { // Cannot add mongos as a shard. TEST_F(AddShardTest, AddMongosAsShard) { std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); HostAndPort shardTarget("StandaloneHost:12345"); targeter->setConnectionStringReturnValue(ConnectionString(shardTarget)); targeter->setFindHostReturnValue(shardTarget); @@ -628,7 +628,7 @@ TEST_F(AddShardTest, AddMongosAsShard) { // A replica set name was found for the host but no name was provided with the host. TEST_F(AddShardTest, AddReplicaSetShardAsStandalone) { std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); HostAndPort shardTarget = HostAndPort("host1:12345"); targeter->setConnectionStringReturnValue(ConnectionString(shardTarget)); targeter->setFindHostReturnValue(shardTarget); @@ -658,7 +658,7 @@ TEST_F(AddShardTest, AddReplicaSetShardAsStandalone) { // A replica set name was provided with the host but no name was found for the host. TEST_F(AddShardTest, AddStandaloneHostShardAsReplicaSet) { std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); ConnectionString connString = assertGet(ConnectionString::parse("mySet/host1:12345,host2:12345")); HostAndPort shardTarget = connString.getServers().front(); @@ -686,7 +686,7 @@ TEST_F(AddShardTest, AddStandaloneHostShardAsReplicaSet) { // Provided replica set name does not match found replica set name. TEST_F(AddShardTest, ReplicaSetMistmatchedReplicaSetName) { std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); ConnectionString connString = assertGet(ConnectionString::parse("mySet/host1:12345,host2:12345")); targeter->setConnectionStringReturnValue(connString); @@ -716,7 +716,7 @@ TEST_F(AddShardTest, ReplicaSetMistmatchedReplicaSetName) { // Cannot add config server as a shard. TEST_F(AddShardTest, ShardIsCSRSConfigServer) { std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); ConnectionString connString = assertGet(ConnectionString::parse("config/host1:12345,host2:12345")); targeter->setConnectionStringReturnValue(connString); @@ -749,7 +749,7 @@ TEST_F(AddShardTest, ShardIsCSRSConfigServer) { // One of the hosts is not part of the found replica set. TEST_F(AddShardTest, ReplicaSetMissingHostsProvidedInSeedList) { std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); ConnectionString connString = assertGet(ConnectionString::parse("mySet/host1:12345,host2:12345")); targeter->setConnectionStringReturnValue(connString); @@ -784,7 +784,7 @@ TEST_F(AddShardTest, ReplicaSetMissingHostsProvidedInSeedList) { // Cannot add a shard with the shard name "config". TEST_F(AddShardTest, AddShardWithNameConfigFails) { std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); ConnectionString connString = assertGet(ConnectionString::parse("mySet/host1:12345,host2:12345")); targeter->setConnectionStringReturnValue(connString); @@ -819,7 +819,7 @@ TEST_F(AddShardTest, AddShardWithNameConfigFails) { TEST_F(AddShardTest, ShardContainsExistingDatabase) { std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); ConnectionString connString = assertGet(ConnectionString::parse("mySet/host1:12345,host2:12345")); targeter->setConnectionStringReturnValue(connString); @@ -868,7 +868,7 @@ TEST_F(AddShardTest, ShardContainsExistingDatabase) { TEST_F(AddShardTest, SuccessfullyAddReplicaSet) { std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); ConnectionString connString = assertGet(ConnectionString::parse("mySet/host1:12345,host2:12345")); targeter->setConnectionStringReturnValue(connString); @@ -932,7 +932,7 @@ TEST_F(AddShardTest, SuccessfullyAddReplicaSet) { TEST_F(AddShardTest, ReplicaSetExtraHostsDiscovered) { std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); ConnectionString seedString = assertGet(ConnectionString::parse("mySet/host1:12345,host2:12345")); ConnectionString fullConnString = @@ -1001,7 +1001,7 @@ TEST_F(AddShardTest, ReplicaSetExtraHostsDiscovered) { TEST_F(AddShardTest, AddShardSucceedsEvenIfAddingDBsFromNewShardFails) { std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); HostAndPort shardTarget("StandaloneHost:12345"); targeter->setConnectionStringReturnValue(ConnectionString(shardTarget)); targeter->setFindHostReturnValue(shardTarget); @@ -1092,14 +1092,14 @@ TEST_F(AddShardTest, AddShardSucceedsEvenIfAddingDBsFromNewShardFails) { TEST_F(AddShardTest, AddExistingShardStandalone) { HostAndPort shardTarget("StandaloneHost:12345"); std::unique_ptr<RemoteCommandTargeterMock> standaloneTargeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); standaloneTargeter->setConnectionStringReturnValue(ConnectionString(shardTarget)); standaloneTargeter->setFindHostReturnValue(shardTarget); targeterFactory()->addTargeterToReturn(ConnectionString(shardTarget), std::move(standaloneTargeter)); std::unique_ptr<RemoteCommandTargeterMock> replsetTargeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); replsetTargeter->setConnectionStringReturnValue( ConnectionString::forReplicaSet("mySet", {shardTarget})); replsetTargeter->setFindHostReturnValue(shardTarget); @@ -1203,7 +1203,7 @@ TEST_F(AddShardTest, AddExistingShardStandalone) { // with the *same* options succeeds. TEST_F(AddShardTest, AddExistingShardReplicaSet) { std::unique_ptr<RemoteCommandTargeterMock> replsetTargeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); ConnectionString connString = assertGet(ConnectionString::parse("mySet/host1:12345")); replsetTargeter->setConnectionStringReturnValue(connString); HostAndPort shardTarget = connString.getServers().front(); @@ -1324,7 +1324,7 @@ TEST_F(AddShardTest, AddExistingShardReplicaSet) { { // Add a targeter for the different seed string this addShard request will use. std::unique_ptr<RemoteCommandTargeterMock> otherHostTargeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); otherHostTargeter->setConnectionStringReturnValue(otherHostConnString); otherHostTargeter->setFindHostReturnValue(otherHost); targeterFactory()->addTargeterToReturn(otherHostConnString, std::move(otherHostTargeter)); diff --git a/src/mongo/db/s/config/sharding_catalog_manager_shard_collection_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_shard_collection_test.cpp index 264a4f4cc42..18419863c2f 100644 --- a/src/mongo/db/s/config/sharding_catalog_manager_shard_collection_test.cpp +++ b/src/mongo/db/s/config/sharding_catalog_manager_shard_collection_test.cpp @@ -173,7 +173,7 @@ TEST_F(ConfigServerShardCollectionTest, RangeSharding_ForMapReduce_NoInitialSpli shard.setHost(shardHost.toString()); std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); targeter->setConnectionStringReturnValue(ConnectionString(shardHost)); targeter->setFindHostReturnValue(shardHost); targeterFactory()->addTargeterToReturn(ConnectionString(shardHost), std::move(targeter)); @@ -231,11 +231,11 @@ TEST_F(ConfigServerShardCollectionTest, RangeSharding_ForMapReduce_WithInitialSp shard2.setHost(shard2Host.toString()); std::unique_ptr<RemoteCommandTargeterMock> targeter0( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); std::unique_ptr<RemoteCommandTargeterMock> targeter1( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); std::unique_ptr<RemoteCommandTargeterMock> targeter2( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); targeter0->setConnectionStringReturnValue(ConnectionString(shard0Host)); targeter0->setFindHostReturnValue(shard0Host); targeterFactory()->addTargeterToReturn(ConnectionString(shard0Host), std::move(targeter0)); @@ -308,7 +308,7 @@ TEST_F(ConfigServerShardCollectionTest, RangeSharding_NoInitialSplitPoints_NoSpl shard.setHost(shardHost.toString()); std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); targeter->setConnectionStringReturnValue(ConnectionString(shardHost)); targeter->setFindHostReturnValue(shardHost); targeterFactory()->addTargeterToReturn(ConnectionString(shardHost), std::move(targeter)); @@ -358,7 +358,7 @@ TEST_F(ConfigServerShardCollectionTest, RangeSharding_NoInitialSplitPoints_WithS shard.setHost(shardHost.toString()); std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); targeter->setConnectionStringReturnValue(ConnectionString(shardHost)); targeter->setFindHostReturnValue(shardHost); targeterFactory()->addTargeterToReturn(ConnectionString(shardHost), std::move(targeter)); @@ -430,7 +430,7 @@ TEST_F(ConfigServerShardCollectionTest, RangeSharding_WithInitialSplitPoints_NoS shard.setHost(shardHost.toString()); std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); targeter->setConnectionStringReturnValue(ConnectionString(shardHost)); targeter->setFindHostReturnValue(shardHost); targeterFactory()->addTargeterToReturn(ConnectionString(shardHost), std::move(targeter)); @@ -538,7 +538,7 @@ TEST_F(CreateFirstChunksTest, NonEmptyCollection_SplitPoints_FromSplitVector_Man const auto connStr = assertGet(ConnectionString::parse(kShards[1].getHost())); std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); targeter->setConnectionStringReturnValue(connStr); targeter->setFindHostReturnValue(connStr.getServers()[0]); targeterFactory()->addTargeterToReturn(connStr, std::move(targeter)); @@ -576,7 +576,7 @@ TEST_F(CreateFirstChunksTest, NonEmptyCollection_SplitPoints_FromClient_ManyChun const auto connStr = assertGet(ConnectionString::parse(kShards[1].getHost())); std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); targeter->setConnectionStringReturnValue(connStr); targeter->setFindHostReturnValue(connStr.getServers()[0]); targeterFactory()->addTargeterToReturn(connStr, std::move(targeter)); @@ -652,7 +652,7 @@ TEST_F(CreateFirstChunksTest, EmptyCollection_SplitPoints_FromClient_ManyChunksD const auto connStr = assertGet(ConnectionString::parse(kShards[1].getHost())); std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); targeter->setConnectionStringReturnValue(connStr); targeter->setFindHostReturnValue(connStr.getServers()[0]); targeterFactory()->addTargeterToReturn(connStr, std::move(targeter)); @@ -697,7 +697,7 @@ TEST_F(CreateFirstChunksTest, EmptyCollection_NoSplitPoints_OneChunkToPrimary) { const auto connStr = assertGet(ConnectionString::parse(kShards[1].getHost())); std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); targeter->setConnectionStringReturnValue(connStr); targeter->setFindHostReturnValue(connStr.getServers()[0]); targeterFactory()->addTargeterToReturn(connStr, std::move(targeter)); diff --git a/src/mongo/db/s/metadata_manager.cpp b/src/mongo/db/s/metadata_manager.cpp index b111875db39..7394d7dae15 100644 --- a/src/mongo/db/s/metadata_manager.cpp +++ b/src/mongo/db/s/metadata_manager.cpp @@ -33,6 +33,8 @@ #include "mongo/db/s/metadata_manager.h" +#include <memory> + #include "mongo/base/string_data.h" #include "mongo/bson/simple_bsonobj_comparator.h" #include "mongo/bson/util/builder.h" @@ -40,7 +42,6 @@ #include "mongo/db/range_arithmetic.h" #include "mongo/db/s/collection_sharding_state.h" #include "mongo/s/grid.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/log.h" diff --git a/src/mongo/db/s/metadata_manager.h b/src/mongo/db/s/metadata_manager.h index 26cb452ac28..0eb43d529c2 100644 --- a/src/mongo/db/s/metadata_manager.h +++ b/src/mongo/db/s/metadata_manager.h @@ -30,6 +30,7 @@ #pragma once #include <list> +#include <memory> #include "mongo/bson/simple_bsonobj_comparator.h" #include "mongo/db/logical_time.h" @@ -40,7 +41,6 @@ #include "mongo/db/service_context.h" #include "mongo/executor/task_executor.h" #include "mongo/s/catalog/type_chunk.h" -#include "mongo/stdx/memory.h" #include "mongo/util/concurrency/notification.h" #include "mongo/util/concurrency/with_lock.h" diff --git a/src/mongo/db/s/metadata_manager_test.cpp b/src/mongo/db/s/metadata_manager_test.cpp index db701ec0a60..99c6ca25c5f 100644 --- a/src/mongo/db/s/metadata_manager_test.cpp +++ b/src/mongo/db/s/metadata_manager_test.cpp @@ -30,6 +30,7 @@ #include "mongo/platform/basic.h" #include <boost/optional.hpp> +#include <memory> #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/catalog_raii.h" @@ -45,7 +46,6 @@ #include "mongo/s/client/shard_registry.h" #include "mongo/s/shard_server_test_fixture.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/assert_util.h" diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp index bcb5cd266e6..a78553c804e 100644 --- a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp +++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp @@ -173,7 +173,7 @@ Status MigrationChunkClonerSourceLegacy::startClone(OperationContext* opCtx) { auto const replCoord = repl::ReplicationCoordinator::get(opCtx); if (replCoord->getReplicationMode() == repl::ReplicationCoordinator::modeReplSet) { - _sessionCatalogSource = stdx::make_unique<SessionCatalogMigrationSource>( + _sessionCatalogSource = std::make_unique<SessionCatalogMigrationSource>( opCtx, _args.getNss(), ChunkRange(_args.getMinKey(), _args.getMaxKey()), diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy.h b/src/mongo/db/s/migration_chunk_cloner_source_legacy.h index 4bea1703306..c737716b93f 100644 --- a/src/mongo/db/s/migration_chunk_cloner_source_legacy.h +++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy.h @@ -30,6 +30,7 @@ #pragma once #include <list> +#include <memory> #include <set> #include "mongo/bson/bsonobj.h" @@ -42,7 +43,6 @@ #include "mongo/s/request_types/move_chunk_request.h" #include "mongo/s/shard_key_pattern.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/util/net/hostandport.h" diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp b/src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp index 3e4f509d6a8..678557c5a1e 100644 --- a/src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp +++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy_test.cpp @@ -94,7 +94,7 @@ protected: ->setFindHostReturnValue(kRecipientConnStr.getServers()[0]); } - auto clockSource = stdx::make_unique<ClockSourceMock>(); + auto clockSource = std::make_unique<ClockSourceMock>(); // Timestamps of "0 seconds" are not allowed, so we must advance our clock mock to the first // real second. @@ -188,7 +188,7 @@ private: } }; - return stdx::make_unique<StaticCatalogClient>(); + return std::make_unique<StaticCatalogClient>(); } boost::optional<DBDirectClient> _client; diff --git a/src/mongo/db/s/migration_destination_manager.cpp b/src/mongo/db/s/migration_destination_manager.cpp index 03fdc521c80..7df4fdeef0b 100644 --- a/src/mongo/db/s/migration_destination_manager.cpp +++ b/src/mongo/db/s/migration_destination_manager.cpp @@ -368,7 +368,7 @@ Status MigrationDestinationManager::start(OperationContext* opCtx, } _sessionMigration = - stdx::make_unique<SessionCatalogMigrationDestination>(_fromShard, *_sessionId); + std::make_unique<SessionCatalogMigrationDestination>(_fromShard, *_sessionId); ShardingStatistics::get(opCtx).countRecipientMoveChunkStarted.addAndFetch(1); _migrateThreadHandle = stdx::thread([this]() { _migrateThread(); }); diff --git a/src/mongo/db/s/migration_source_manager.cpp b/src/mongo/db/s/migration_source_manager.cpp index 42e5a35a2d0..8935b676e45 100644 --- a/src/mongo/db/s/migration_source_manager.cpp +++ b/src/mongo/db/s/migration_source_manager.cpp @@ -33,6 +33,8 @@ #include "mongo/db/s/migration_source_manager.h" +#include <memory> + #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/catalog_raii.h" #include "mongo/db/concurrency/write_conflict_exception.h" @@ -58,7 +60,6 @@ #include "mongo/s/request_types/commit_chunk_migration_request_type.h" #include "mongo/s/request_types/set_shard_version_request.h" #include "mongo/s/shard_key_pattern.h" -#include "mongo/stdx/memory.h" #include "mongo/util/duration.h" #include "mongo/util/elapsed_tracker.h" #include "mongo/util/exit.h" @@ -246,7 +247,7 @@ Status MigrationSourceManager::startClone(OperationContext* opCtx) { // that a chunk on that collection is being migrated. With an active migration, write // operations require the cloner to be present in order to track changes to the chunk which // needs to be transmitted to the recipient. - _cloneDriver = stdx::make_unique<MigrationChunkClonerSourceLegacy>( + _cloneDriver = std::make_unique<MigrationChunkClonerSourceLegacy>( _args, metadata->getKeyPattern(), _donorConnStr, _recipientHost); boost::optional<AutoGetCollection> autoColl; diff --git a/src/mongo/db/s/namespace_metadata_change_notifications_test.cpp b/src/mongo/db/s/namespace_metadata_change_notifications_test.cpp index 052f8a6d352..e6c922d0ed5 100644 --- a/src/mongo/db/s/namespace_metadata_change_notifications_test.cpp +++ b/src/mongo/db/s/namespace_metadata_change_notifications_test.cpp @@ -29,11 +29,12 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/operation_context_noop.h" #include "mongo/db/s/namespace_metadata_change_notifications.h" #include "mongo/db/service_context.h" #include "mongo/db/service_context_d_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/unittest/unittest.h" #include "mongo/util/tick_source_mock.h" @@ -46,7 +47,7 @@ const NamespaceString kNss("foo.bar"); class NamespaceMetadataChangeNotificationsTest : public ServiceContextMongoDTest { protected: NamespaceMetadataChangeNotificationsTest() { - getServiceContext()->setTickSource(stdx::make_unique<TickSourceMock<>>()); + getServiceContext()->setTickSource(std::make_unique<TickSourceMock<>>()); } }; diff --git a/src/mongo/db/s/session_catalog_migration_destination_test.cpp b/src/mongo/db/s/session_catalog_migration_destination_test.cpp index 2bdd5d3b62a..483a8285a0f 100644 --- a/src/mongo/db/s/session_catalog_migration_destination_test.cpp +++ b/src/mongo/db/s/session_catalog_migration_destination_test.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/client/connection_string.h" #include "mongo/client/remote_command_targeter_mock.h" #include "mongo/db/concurrency/d_concurrency.h" @@ -52,7 +54,6 @@ #include "mongo/s/catalog/type_shard.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/shard_server_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/unittest/unittest.h" @@ -132,7 +133,7 @@ public: } MongoDSessionCatalog::onStepUp(operationContext()); - LogicalSessionCache::set(getServiceContext(), stdx::make_unique<LogicalSessionCacheNoop>()); + LogicalSessionCache::set(getServiceContext(), std::make_unique<LogicalSessionCacheNoop>()); } void returnOplog(const std::vector<OplogEntry>& oplogList) { @@ -283,7 +284,7 @@ private: } }; - return stdx::make_unique<StaticCatalogClient>(); + return std::make_unique<StaticCatalogClient>(); } void _checkOplogExceptO2(const repl::OplogEntry& originalOplog, diff --git a/src/mongo/db/s/session_catalog_migration_source.cpp b/src/mongo/db/s/session_catalog_migration_source.cpp index 11efb9ad1d3..94e052851ca 100644 --- a/src/mongo/db/s/session_catalog_migration_source.cpp +++ b/src/mongo/db/s/session_catalog_migration_source.cpp @@ -31,6 +31,8 @@ #include "mongo/db/s/session_catalog_migration_source.h" +#include <memory> + #include "mongo/db/catalog_raii.h" #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/dbdirectclient.h" @@ -44,7 +46,6 @@ #include "mongo/db/transaction_participant.h" #include "mongo/db/write_concern.h" #include "mongo/platform/random.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/str.h" @@ -148,7 +149,7 @@ SessionCatalogMigrationSource::SessionCatalogMigrationSource(OperationContext* o IDLParserErrorContext("Session migration cloning"), cursor->next()); if (!nextSession.getLastWriteOpTime().isNull()) { _sessionOplogIterators.push_back( - stdx::make_unique<SessionOplogIterator>(std::move(nextSession), _rollbackIdAtInit)); + std::make_unique<SessionOplogIterator>(std::move(nextSession), _rollbackIdAtInit)); } } @@ -390,7 +391,7 @@ SessionCatalogMigrationSource::SessionOplogIterator::SessionOplogIterator( SessionTxnRecord txnRecord, int expectedRollbackId) : _record(std::move(txnRecord)), _initialRollbackId(expectedRollbackId) { _writeHistoryIterator = - stdx::make_unique<TransactionHistoryIterator>(_record.getLastWriteOpTime()); + std::make_unique<TransactionHistoryIterator>(_record.getLastWriteOpTime()); } boost::optional<repl::OplogEntry> SessionCatalogMigrationSource::SessionOplogIterator::getNext( diff --git a/src/mongo/db/s/shard_metadata_util.cpp b/src/mongo/db/s/shard_metadata_util.cpp index 7e0cc51ccd4..59b6a5562f3 100644 --- a/src/mongo/db/s/shard_metadata_util.cpp +++ b/src/mongo/db/s/shard_metadata_util.cpp @@ -33,6 +33,8 @@ #include "mongo/db/s/shard_metadata_util.h" +#include <memory> + #include "mongo/db/dbdirectclient.h" #include "mongo/db/ops/write_ops.h" #include "mongo/db/write_concern_options.h" @@ -43,7 +45,6 @@ #include "mongo/s/catalog/type_shard_database.h" #include "mongo/s/chunk_version.h" #include "mongo/s/write_ops/batched_command_response.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" namespace mongo { diff --git a/src/mongo/db/s/shard_server_catalog_cache_loader.cpp b/src/mongo/db/s/shard_server_catalog_cache_loader.cpp index e6d312f6db4..7266adfc233 100644 --- a/src/mongo/db/s/shard_server_catalog_cache_loader.cpp +++ b/src/mongo/db/s/shard_server_catalog_cache_loader.cpp @@ -33,6 +33,8 @@ #include "mongo/db/s/shard_server_catalog_cache_loader.h" +#include <memory> + #include "mongo/db/client.h" #include "mongo/db/operation_context.h" #include "mongo/db/operation_context_group.h" @@ -44,7 +46,6 @@ #include "mongo/s/catalog/type_shard_database.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/grid.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" namespace mongo { diff --git a/src/mongo/db/s/shard_server_catalog_cache_loader_test.cpp b/src/mongo/db/s/shard_server_catalog_cache_loader_test.cpp index 20241ce52fc..368b4a52421 100644 --- a/src/mongo/db/s/shard_server_catalog_cache_loader_test.cpp +++ b/src/mongo/db/s/shard_server_catalog_cache_loader_test.cpp @@ -98,10 +98,9 @@ void ShardServerCatalogCacheLoaderTest::setUp() { // Create mock remote and real shard loader, retaining a pointer to the mock remote loader so // that unit tests can manipulate it to return certain responses. - std::unique_ptr<CatalogCacheLoaderMock> mockLoader = - stdx::make_unique<CatalogCacheLoaderMock>(); + std::unique_ptr<CatalogCacheLoaderMock> mockLoader = std::make_unique<CatalogCacheLoaderMock>(); _remoteLoaderMock = mockLoader.get(); - _shardLoader = stdx::make_unique<ShardServerCatalogCacheLoader>(std::move(mockLoader)); + _shardLoader = std::make_unique<ShardServerCatalogCacheLoader>(std::move(mockLoader)); // Set the shard loader to primary mode, and set it for testing. _shardLoader->initializeReplicaSetRole(true); diff --git a/src/mongo/db/s/sharding_initialization_mongod.cpp b/src/mongo/db/s/sharding_initialization_mongod.cpp index e95c954e10d..c3ca8877773 100644 --- a/src/mongo/db/s/sharding_initialization_mongod.cpp +++ b/src/mongo/db/s/sharding_initialization_mongod.cpp @@ -76,10 +76,9 @@ namespace { const auto getInstance = ServiceContext::declareDecoration<ShardingInitializationMongoD>(); auto makeEgressHooksList(ServiceContext* service) { - auto unshardedHookList = stdx::make_unique<rpc::EgressMetadataHookList>(); - unshardedHookList->addHook(stdx::make_unique<rpc::LogicalTimeMetadataHook>(service)); - unshardedHookList->addHook( - stdx::make_unique<rpc::ShardingEgressMetadataHookForMongod>(service)); + auto unshardedHookList = std::make_unique<rpc::EgressMetadataHookList>(); + unshardedHookList->addHook(std::make_unique<rpc::LogicalTimeMetadataHook>(service)); + unshardedHookList->addHook(std::make_unique<rpc::ShardingEgressMetadataHookForMongod>(service)); return unshardedHookList; } @@ -370,24 +369,22 @@ void ShardingInitializationMongoD::updateShardIdentityConfigString( void initializeGlobalShardingStateForMongoD(OperationContext* opCtx, const ConnectionString& configCS, StringData distLockProcessId) { - auto targeterFactory = stdx::make_unique<RemoteCommandTargeterFactoryImpl>(); + auto targeterFactory = std::make_unique<RemoteCommandTargeterFactoryImpl>(); auto targeterFactoryPtr = targeterFactory.get(); - ShardFactory::BuilderCallable setBuilder = - [targeterFactoryPtr](const ShardId& shardId, const ConnectionString& connStr) { - return stdx::make_unique<ShardRemote>( - shardId, connStr, targeterFactoryPtr->create(connStr)); - }; + ShardFactory::BuilderCallable setBuilder = [targeterFactoryPtr]( + const ShardId& shardId, const ConnectionString& connStr) { + return std::make_unique<ShardRemote>(shardId, connStr, targeterFactoryPtr->create(connStr)); + }; - ShardFactory::BuilderCallable masterBuilder = - [targeterFactoryPtr](const ShardId& shardId, const ConnectionString& connStr) { - return stdx::make_unique<ShardRemote>( - shardId, connStr, targeterFactoryPtr->create(connStr)); - }; + ShardFactory::BuilderCallable masterBuilder = [targeterFactoryPtr]( + const ShardId& shardId, const ConnectionString& connStr) { + return std::make_unique<ShardRemote>(shardId, connStr, targeterFactoryPtr->create(connStr)); + }; ShardFactory::BuilderCallable localBuilder = [](const ShardId& shardId, const ConnectionString& connStr) { - return stdx::make_unique<ShardLocal>(shardId); + return std::make_unique<ShardLocal>(shardId); }; ShardFactory::BuildersMap buildersMap{ @@ -397,20 +394,20 @@ void initializeGlobalShardingStateForMongoD(OperationContext* opCtx, }; auto shardFactory = - stdx::make_unique<ShardFactory>(std::move(buildersMap), std::move(targeterFactory)); + std::make_unique<ShardFactory>(std::move(buildersMap), std::move(targeterFactory)); auto const service = opCtx->getServiceContext(); if (serverGlobalParams.clusterRole == ClusterRole::ShardServer) { if (storageGlobalParams.readOnly) { - CatalogCacheLoader::set(service, stdx::make_unique<ReadOnlyCatalogCacheLoader>()); + CatalogCacheLoader::set(service, std::make_unique<ReadOnlyCatalogCacheLoader>()); } else { CatalogCacheLoader::set(service, - stdx::make_unique<ShardServerCatalogCacheLoader>( - stdx::make_unique<ConfigServerCatalogCacheLoader>())); + std::make_unique<ShardServerCatalogCacheLoader>( + std::make_unique<ConfigServerCatalogCacheLoader>())); } } else { - CatalogCacheLoader::set(service, stdx::make_unique<ConfigServerCatalogCacheLoader>()); + CatalogCacheLoader::set(service, std::make_unique<ConfigServerCatalogCacheLoader>()); } auto validator = LogicalTimeValidator::get(service); @@ -426,7 +423,7 @@ void initializeGlobalShardingStateForMongoD(OperationContext* opCtx, configCS, distLockProcessId, std::move(shardFactory), - stdx::make_unique<CatalogCache>(CatalogCacheLoader::get(opCtx)), + std::make_unique<CatalogCache>(CatalogCacheLoader::get(opCtx)), [service] { return makeEgressHooksList(service); }, // We only need one task executor here because sharding task executors aren't used for user // queries in mongod. diff --git a/src/mongo/db/s/sharding_initialization_mongod_test.cpp b/src/mongo/db/s/sharding_initialization_mongod_test.cpp index d124b98cc21..21bbe8553ff 100644 --- a/src/mongo/db/s/sharding_initialization_mongod_test.cpp +++ b/src/mongo/db/s/sharding_initialization_mongod_test.cpp @@ -70,8 +70,8 @@ protected: serverGlobalParams.clusterRole = ClusterRole::ShardServer; CatalogCacheLoader::set(getServiceContext(), - stdx::make_unique<ShardServerCatalogCacheLoader>( - stdx::make_unique<ConfigServerCatalogCacheLoader>())); + std::make_unique<ShardServerCatalogCacheLoader>( + std::make_unique<ConfigServerCatalogCacheLoader>())); ShardingInitializationMongoD::get(getServiceContext()) ->setGlobalInitMethodForTest([&](OperationContext* opCtx, @@ -92,7 +92,7 @@ protected: return Status::OK(); }); - _dbDirectClient = stdx::make_unique<DBDirectClient>(operationContext()); + _dbDirectClient = std::make_unique<DBDirectClient>(operationContext()); } void tearDown() override { @@ -110,13 +110,13 @@ protected: std::unique_ptr<DistLockManager> makeDistLockManager( std::unique_ptr<DistLockCatalog> distLockCatalog) override { - return stdx::make_unique<DistLockManagerMock>(nullptr); + return std::make_unique<DistLockManagerMock>(nullptr); } std::unique_ptr<ShardingCatalogClient> makeShardingCatalogClient( std::unique_ptr<DistLockManager> distLockManager) override { invariant(distLockManager); - return stdx::make_unique<ShardingCatalogClientImpl>(std::move(distLockManager)); + return std::make_unique<ShardingCatalogClientImpl>(std::move(distLockManager)); } auto* shardingInitialization() { @@ -136,16 +136,16 @@ class ScopedSetStandaloneMode { public: ScopedSetStandaloneMode(ServiceContext* serviceContext) : _serviceContext(serviceContext) { serverGlobalParams.clusterRole = ClusterRole::None; - _serviceContext->setOpObserver(stdx::make_unique<OpObserverRegistry>()); + _serviceContext->setOpObserver(std::make_unique<OpObserverRegistry>()); } ~ScopedSetStandaloneMode() { serverGlobalParams.clusterRole = ClusterRole::ShardServer; auto makeOpObserver = [&] { - auto opObserver = stdx::make_unique<OpObserverRegistry>(); - opObserver->addObserver(stdx::make_unique<OpObserverShardingImpl>()); - opObserver->addObserver(stdx::make_unique<ConfigServerOpObserver>()); - opObserver->addObserver(stdx::make_unique<ShardServerOpObserver>()); + auto opObserver = std::make_unique<OpObserverRegistry>(); + opObserver->addObserver(std::make_unique<OpObserverShardingImpl>()); + opObserver->addObserver(std::make_unique<ConfigServerOpObserver>()); + opObserver->addObserver(std::make_unique<ShardServerOpObserver>()); return opObserver; }; diff --git a/src/mongo/db/s/transaction_coordinator.cpp b/src/mongo/db/s/transaction_coordinator.cpp index 414bd3c058f..fb264cd2e3f 100644 --- a/src/mongo/db/s/transaction_coordinator.cpp +++ b/src/mongo/db/s/transaction_coordinator.cpp @@ -58,7 +58,7 @@ TransactionCoordinator::TransactionCoordinator(ServiceContext* serviceContext, _scheduler(std::move(scheduler)), _sendPrepareScheduler(_scheduler->makeChildScheduler()), _transactionCoordinatorMetricsObserver( - stdx::make_unique<TransactionCoordinatorMetricsObserver>()) { + std::make_unique<TransactionCoordinatorMetricsObserver>()) { auto kickOffCommitPF = makePromiseFuture<void>(); _kickOffCommitPromise = std::move(kickOffCommitPF.promise); diff --git a/src/mongo/db/s/transaction_coordinator_futures_util.cpp b/src/mongo/db/s/transaction_coordinator_futures_util.cpp index 0af8b465353..c27e4c21eee 100644 --- a/src/mongo/db/s/transaction_coordinator_futures_util.cpp +++ b/src/mongo/db/s/transaction_coordinator_futures_util.cpp @@ -175,7 +175,7 @@ Future<executor::TaskExecutor::ResponseStatus> AsyncWorkScheduler::scheduleRemot } std::unique_ptr<AsyncWorkScheduler> AsyncWorkScheduler::makeChildScheduler() { - auto child = stdx::make_unique<AsyncWorkScheduler>(_serviceContext); + auto child = std::make_unique<AsyncWorkScheduler>(_serviceContext); stdx::lock_guard<stdx::mutex> lg(_mutex); if (!_shutdownStatus.isOK()) diff --git a/src/mongo/db/s/transaction_coordinator_futures_util_test.cpp b/src/mongo/db/s/transaction_coordinator_futures_util_test.cpp index bed0927a650..f2054c59f62 100644 --- a/src/mongo/db/s/transaction_coordinator_futures_util_test.cpp +++ b/src/mongo/db/s/transaction_coordinator_futures_util_test.cpp @@ -315,7 +315,7 @@ protected: } }; - return stdx::make_unique<StaticCatalogClient>(); + return std::make_unique<StaticCatalogClient>(); } static std::vector<ShardId> makeThreeShardIdsList() { diff --git a/src/mongo/db/s/transaction_coordinator_test.cpp b/src/mongo/db/s/transaction_coordinator_test.cpp index 77bd01d1173..f87120f419d 100644 --- a/src/mongo/db/s/transaction_coordinator_test.cpp +++ b/src/mongo/db/s/transaction_coordinator_test.cpp @@ -826,9 +826,9 @@ public: void setUp() override { TransactionCoordinatorTestBase::setUp(); - getServiceContext()->setPreciseClockSource(stdx::make_unique<ClockSourceMock>()); + getServiceContext()->setPreciseClockSource(std::make_unique<ClockSourceMock>()); - auto tickSource = stdx::make_unique<TickSourceMock<Microseconds>>(); + auto tickSource = std::make_unique<TickSourceMock<Microseconds>>(); tickSource->reset(1); getServiceContext()->setTickSource(std::move(tickSource)); } diff --git a/src/mongo/db/s/transaction_coordinator_test_fixture.cpp b/src/mongo/db/s/transaction_coordinator_test_fixture.cpp index e33da68ab2b..bced1fcb575 100644 --- a/src/mongo/db/s/transaction_coordinator_test_fixture.cpp +++ b/src/mongo/db/s/transaction_coordinator_test_fixture.cpp @@ -92,7 +92,7 @@ std::unique_ptr<ShardingCatalogClient> TransactionCoordinatorTestFixture::makeSh const std::vector<ShardId> _shardIds; }; - return stdx::make_unique<StaticCatalogClient>(kThreeShardIdList); + return std::make_unique<StaticCatalogClient>(kThreeShardIdList); } void TransactionCoordinatorTestFixture::assertCommandSentAndRespondWith( diff --git a/src/mongo/db/service_context.cpp b/src/mongo/db/service_context.cpp index c7ed9d53083..d86176e0c03 100644 --- a/src/mongo/db/service_context.cpp +++ b/src/mongo/db/service_context.cpp @@ -33,6 +33,8 @@ #include "mongo/db/service_context.h" +#include <memory> + #include "mongo/base/init.h" #include "mongo/bson/bsonobj.h" #include "mongo/db/client.h" @@ -42,7 +44,6 @@ #include "mongo/db/operation_context.h" #include "mongo/db/storage/recovery_unit_noop.h" #include "mongo/stdx/list.h" -#include "mongo/stdx/memory.h" #include "mongo/transport/service_entry_point.h" #include "mongo/transport/session.h" #include "mongo/transport/transport_layer.h" @@ -90,9 +91,9 @@ bool supportsDocLocking() { } ServiceContext::ServiceContext() - : _tickSource(stdx::make_unique<SystemTickSource>()), - _fastClockSource(stdx::make_unique<SystemClockSource>()), - _preciseClockSource(stdx::make_unique<SystemClockSource>()) {} + : _tickSource(std::make_unique<SystemTickSource>()), + _fastClockSource(std::make_unique<SystemClockSource>()), + _preciseClockSource(std::make_unique<SystemClockSource>()) {} ServiceContext::~ServiceContext() { stdx::lock_guard<stdx::mutex> lk(_mutex); diff --git a/src/mongo/db/service_context.h b/src/mongo/db/service_context.h index 8a9741bcc42..d3af86ac8fc 100644 --- a/src/mongo/db/service_context.h +++ b/src/mongo/db/service_context.h @@ -31,6 +31,7 @@ #include <boost/optional.hpp> #include <functional> +#include <memory> #include <vector> #include "mongo/base/global_initializer_registerer.h" @@ -39,7 +40,6 @@ #include "mongo/platform/atomic_word.h" #include "mongo/stdx/condition_variable.h" #include "mongo/stdx/list.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/unordered_set.h" #include "mongo/transport/service_executor.h" diff --git a/src/mongo/db/service_liaison_mock.cpp b/src/mongo/db/service_liaison_mock.cpp index ef8f5d49e2e..fd95a7ebc6d 100644 --- a/src/mongo/db/service_liaison_mock.cpp +++ b/src/mongo/db/service_liaison_mock.cpp @@ -30,15 +30,15 @@ #include "mongo/platform/basic.h" #include <algorithm> +#include <memory> #include "mongo/db/service_liaison_mock.h" -#include "mongo/stdx/memory.h" #include "mongo/util/periodic_runner_factory.h" namespace mongo { MockServiceLiaisonImpl::MockServiceLiaisonImpl() { - _timerFactory = stdx::make_unique<executor::AsyncTimerFactoryMock>(); + _timerFactory = std::make_unique<executor::AsyncTimerFactoryMock>(); _runner = makePeriodicRunner(getGlobalServiceContext()); _runner->startup(); } diff --git a/src/mongo/db/session_catalog.cpp b/src/mongo/db/session_catalog.cpp index db574180f6f..d8ac79858a2 100644 --- a/src/mongo/db/session_catalog.cpp +++ b/src/mongo/db/session_catalog.cpp @@ -33,8 +33,9 @@ #include "mongo/db/session_catalog.h" +#include <memory> + #include "mongo/db/service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" namespace mongo { diff --git a/src/mongo/db/session_catalog_test.cpp b/src/mongo/db/session_catalog_test.cpp index da7712f89d4..ec99c76ffde 100644 --- a/src/mongo/db/session_catalog_test.cpp +++ b/src/mongo/db/session_catalog_test.cpp @@ -29,10 +29,11 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/service_context_test_fixture.h" #include "mongo/db/session_catalog.h" #include "mongo/stdx/future.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/barrier.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" diff --git a/src/mongo/db/sessions_collection.cpp b/src/mongo/db/sessions_collection.cpp index 73ffa21fb0b..6c0f73b82fc 100644 --- a/src/mongo/db/sessions_collection.cpp +++ b/src/mongo/db/sessions_collection.cpp @@ -42,7 +42,6 @@ #include "mongo/db/ops/write_ops.h" #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/s/write_ops/batched_command_response.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace { diff --git a/src/mongo/db/sessions_collection_rs.cpp b/src/mongo/db/sessions_collection_rs.cpp index 0069d3372f3..1902c7981e9 100644 --- a/src/mongo/db/sessions_collection_rs.cpp +++ b/src/mongo/db/sessions_collection_rs.cpp @@ -32,6 +32,7 @@ #include "mongo/db/sessions_collection_rs.h" #include <boost/optional.hpp> +#include <memory> #include <utility> #include "mongo/client/authenticate.h" @@ -45,7 +46,6 @@ #include "mongo/db/repl/repl_set_config.h" #include "mongo/db/repl/replication_coordinator.h" #include "mongo/rpc/get_status_from_command_result.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace { diff --git a/src/mongo/db/storage/backup_cursor_hooks.cpp b/src/mongo/db/storage/backup_cursor_hooks.cpp index f624762a914..fb6dfd202ff 100644 --- a/src/mongo/db/storage/backup_cursor_hooks.cpp +++ b/src/mongo/db/storage/backup_cursor_hooks.cpp @@ -38,7 +38,7 @@ namespace mongo { namespace { BackupCursorHooks::InitializerFunction initializer = [](StorageEngine* storageEngine) { - return stdx::make_unique<BackupCursorHooks>(); + return std::make_unique<BackupCursorHooks>(); }; struct BackupCursorHooksHolder { diff --git a/src/mongo/db/storage/biggie/biggie_kv_engine.cpp b/src/mongo/db/storage/biggie/biggie_kv_engine.cpp index 43e4b3672d0..d0c4a4b987a 100644 --- a/src/mongo/db/storage/biggie/biggie_kv_engine.cpp +++ b/src/mongo/db/storage/biggie/biggie_kv_engine.cpp @@ -31,14 +31,16 @@ #include "mongo/platform/basic.h" +#include "mongo/db/storage/biggie/biggie_kv_engine.h" + +#include <memory> + #include "mongo/db/index/index_descriptor.h" #include "mongo/db/snapshot_window_options.h" -#include "mongo/db/storage/biggie/biggie_kv_engine.h" #include "mongo/db/storage/biggie/biggie_recovery_unit.h" #include "mongo/db/storage/key_string.h" #include "mongo/db/storage/record_store.h" #include "mongo/db/storage/sorted_data_interface.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace biggie { diff --git a/src/mongo/db/storage/biggie/biggie_kv_engine_test.cpp b/src/mongo/db/storage/biggie/biggie_kv_engine_test.cpp index a2ebfaad618..dac1a579a2a 100644 --- a/src/mongo/db/storage/biggie/biggie_kv_engine_test.cpp +++ b/src/mongo/db/storage/biggie/biggie_kv_engine_test.cpp @@ -31,11 +31,12 @@ #include "mongo/db/storage/kv/kv_engine_test_harness.h" +#include <memory> + #include "mongo/base/init.h" #include "mongo/db/service_context.h" #include "mongo/db/service_context_test_fixture.h" #include "mongo/db/storage/biggie/biggie_kv_engine.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -61,7 +62,7 @@ private: }; std::unique_ptr<KVHarnessHelper> makeHelper() { - return stdx::make_unique<BiggieKVHarnessHelper>(); + return std::make_unique<BiggieKVHarnessHelper>(); } MONGO_INITIALIZER(RegisterKVHarnessFactory)(InitializerContext*) { diff --git a/src/mongo/db/storage/biggie/biggie_record_store.cpp b/src/mongo/db/storage/biggie/biggie_record_store.cpp index 8f69ee8d617..60a6dcdfd04 100644 --- a/src/mongo/db/storage/biggie/biggie_record_store.cpp +++ b/src/mongo/db/storage/biggie/biggie_record_store.cpp @@ -31,20 +31,20 @@ #include "mongo/platform/basic.h" +#include "mongo/db/storage/biggie/biggie_record_store.h" + #include <cstring> #include <memory> #include <utility> #include "mongo/bson/bsonobj.h" #include "mongo/db/operation_context.h" -#include "mongo/db/storage/biggie/biggie_record_store.h" #include "mongo/db/storage/biggie/biggie_recovery_unit.h" #include "mongo/db/storage/biggie/biggie_visibility_manager.h" #include "mongo/db/storage/biggie/store.h" #include "mongo/db/storage/key_string.h" #include "mongo/db/storage/oplog_hack.h" #include "mongo/db/storage/write_unit_of_work.h" -#include "mongo/stdx/memory.h" #include "mongo/util/hex.h" #include "mongo/util/log.h" diff --git a/src/mongo/db/storage/biggie/biggie_record_store_test.cpp b/src/mongo/db/storage/biggie/biggie_record_store_test.cpp index b703879a5df..7901db54100 100644 --- a/src/mongo/db/storage/biggie/biggie_record_store_test.cpp +++ b/src/mongo/db/storage/biggie/biggie_record_store_test.cpp @@ -29,13 +29,15 @@ #include "mongo/platform/basic.h" +#include "mongo/db/storage/biggie/biggie_record_store.h" + +#include <memory> + #include "mongo/base/init.h" #include "mongo/db/storage/biggie/biggie_kv_engine.h" -#include "mongo/db/storage/biggie/biggie_record_store.h" #include "mongo/db/storage/biggie/biggie_recovery_unit.h" #include "mongo/db/storage/biggie/store.h" #include "mongo/db/storage/record_store_test_harness.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { diff --git a/src/mongo/db/storage/biggie/biggie_sorted_impl.cpp b/src/mongo/db/storage/biggie/biggie_sorted_impl.cpp index c000336928d..fe4bb7e8124 100644 --- a/src/mongo/db/storage/biggie/biggie_sorted_impl.cpp +++ b/src/mongo/db/storage/biggie/biggie_sorted_impl.cpp @@ -44,7 +44,6 @@ #include "mongo/db/storage/biggie/store.h" #include "mongo/db/storage/index_entry_comparison.h" #include "mongo/db/storage/key_string.h" -#include "mongo/stdx/memory.h" #include "mongo/util/bufreader.h" #include "mongo/util/hex.h" #include "mongo/util/shared_buffer.h" diff --git a/src/mongo/db/storage/biggie/biggie_sorted_impl_test.cpp b/src/mongo/db/storage/biggie/biggie_sorted_impl_test.cpp index 52c858c694c..ac9a47abf1b 100644 --- a/src/mongo/db/storage/biggie/biggie_sorted_impl_test.cpp +++ b/src/mongo/db/storage/biggie/biggie_sorted_impl_test.cpp @@ -29,14 +29,16 @@ #include "mongo/platform/basic.h" +#include "mongo/db/storage/biggie/biggie_sorted_impl.h" + +#include <memory> + #include "mongo/base/init.h" #include "mongo/db/index/index_descriptor.h" #include "mongo/db/storage/biggie/biggie_kv_engine.h" #include "mongo/db/storage/biggie/biggie_recovery_unit.h" -#include "mongo/db/storage/biggie/biggie_sorted_impl.h" #include "mongo/db/storage/biggie/store.h" #include "mongo/db/storage/sorted_data_interface_test_harness.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -80,7 +82,7 @@ public: }; std::unique_ptr<HarnessHelper> makeHarnessHelper() { - return stdx::make_unique<SortedDataInterfaceTestHarnessHelper>(); + return std::make_unique<SortedDataInterfaceTestHarnessHelper>(); } MONGO_INITIALIZER(RegisterHarnessFactory)(InitializerContext* const) { diff --git a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp index e9437a18908..b53c345ceed 100644 --- a/src/mongo/db/storage/devnull/devnull_kv_engine.cpp +++ b/src/mongo/db/storage/devnull/devnull_kv_engine.cpp @@ -31,11 +31,12 @@ #include "mongo/db/storage/devnull/devnull_kv_engine.h" +#include <memory> + #include "mongo/db/snapshot_window_options.h" #include "mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.h" #include "mongo/db/storage/record_store.h" #include "mongo/db/storage/sorted_data_interface.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -143,7 +144,7 @@ public: std::unique_ptr<SeekableRecordCursor> getCursor(OperationContext* opCtx, bool forward) const final { - return stdx::make_unique<EmptyRecordCursor>(); + return std::make_unique<EmptyRecordCursor>(); } virtual Status truncate(OperationContext* opCtx) { @@ -245,14 +246,14 @@ std::unique_ptr<RecordStore> DevNullKVEngine::getRecordStore(OperationContext* o StringData ident, const CollectionOptions& options) { if (ident == "_mdb_catalog") { - return stdx::make_unique<EphemeralForTestRecordStore>(ns, &_catalogInfo); + return std::make_unique<EphemeralForTestRecordStore>(ns, &_catalogInfo); } - return stdx::make_unique<DevNullRecordStore>(ns, options); + return std::make_unique<DevNullRecordStore>(ns, options); } std::unique_ptr<RecordStore> DevNullKVEngine::makeTemporaryRecordStore(OperationContext* opCtx, StringData ident) { - return stdx::make_unique<DevNullRecordStore>("", CollectionOptions()); + return std::make_unique<DevNullRecordStore>("", CollectionOptions()); } SortedDataInterface* DevNullKVEngine::getSortedDataInterface(OperationContext* opCtx, diff --git a/src/mongo/db/storage/encryption_hooks.cpp b/src/mongo/db/storage/encryption_hooks.cpp index 3fc0aea17bc..eac49821a2c 100644 --- a/src/mongo/db/storage/encryption_hooks.cpp +++ b/src/mongo/db/storage/encryption_hooks.cpp @@ -32,11 +32,11 @@ #include "mongo/db/storage/encryption_hooks.h" #include <boost/filesystem/path.hpp> +#include <memory> #include "mongo/base/init.h" #include "mongo/db/service_context.h" #include "mongo/db/storage/data_protector.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp index fef05e67b96..d9fa673dba5 100644 --- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp +++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.cpp @@ -31,12 +31,12 @@ #include "mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.h" +#include <memory> #include <set> #include "mongo/db/catalog/index_catalog_entry.h" #include "mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.h" #include "mongo/db/storage/index_entry_comparison.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { @@ -481,7 +481,7 @@ public: virtual std::unique_ptr<SortedDataInterface::Cursor> newCursor(OperationContext* opCtx, bool isForward) const { - return stdx::make_unique<Cursor>(opCtx, *_data, isForward, _isUnique); + return std::make_unique<Cursor>(opCtx, *_data, isForward, _isUnique); } virtual Status initAsEmpty(OperationContext* opCtx) { diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl_test.cpp b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl_test.cpp index ad0b5b12d71..a2c4cfcd857 100644 --- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl_test.cpp +++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl_test.cpp @@ -29,11 +29,11 @@ #include "mongo/db/storage/ephemeral_for_test/ephemeral_for_test_btree_impl.h" +#include <memory> #include "mongo/base/init.h" #include "mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.h" #include "mongo/db/storage/sorted_data_interface_test_harness.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -55,7 +55,7 @@ public: } std::unique_ptr<RecoveryUnit> newRecoveryUnit() final { - return stdx::make_unique<EphemeralForTestRecoveryUnit>(); + return std::make_unique<EphemeralForTestRecoveryUnit>(); } private: @@ -64,7 +64,7 @@ private: }; std::unique_ptr<HarnessHelper> makeHarnessHelper() { - return stdx::make_unique<EphemeralForBtreeImplTestHarnessHelper>(); + return std::make_unique<EphemeralForBtreeImplTestHarnessHelper>(); } MONGO_INITIALIZER(RegisterHarnessFactory)(InitializerContext* const) { diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.cpp b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.cpp index 1c3d233d1cc..782c425ffd0 100644 --- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.cpp +++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.cpp @@ -38,7 +38,6 @@ #include "mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.h" #include "mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.h" #include "mongo/db/storage/journal_listener.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -65,14 +64,14 @@ std::unique_ptr<RecordStore> EphemeralForTestEngine::getRecordStore( OperationContext* opCtx, StringData ns, StringData ident, const CollectionOptions& options) { stdx::lock_guard<stdx::mutex> lk(_mutex); if (options.capped) { - return stdx::make_unique<EphemeralForTestRecordStore>( + return std::make_unique<EphemeralForTestRecordStore>( ns, &_dataMap[ident], true, options.cappedSize ? options.cappedSize : kDefaultCappedSizeBytes, options.cappedMaxDocs ? options.cappedMaxDocs : -1); } else { - return stdx::make_unique<EphemeralForTestRecordStore>(ns, &_dataMap[ident]); + return std::make_unique<EphemeralForTestRecordStore>(ns, &_dataMap[ident]); } } @@ -80,7 +79,7 @@ std::unique_ptr<RecordStore> EphemeralForTestEngine::makeTemporaryRecordStore( OperationContext* opCtx, StringData ident) { stdx::lock_guard<stdx::mutex> lk(_mutex); _dataMap[ident] = {}; - return stdx::make_unique<EphemeralForTestRecordStore>(ident, &_dataMap[ident]); + return std::make_unique<EphemeralForTestRecordStore>(ident, &_dataMap[ident]); } Status EphemeralForTestEngine::createSortedDataInterface(OperationContext* opCtx, diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine_test.cpp b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine_test.cpp index b017a2cf7bf..ffdc4adee09 100644 --- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine_test.cpp +++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine_test.cpp @@ -29,9 +29,10 @@ #include "mongo/db/storage/ephemeral_for_test/ephemeral_for_test_engine.h" +#include <memory> + #include "mongo/base/init.h" #include "mongo/db/storage/kv/kv_engine_test_harness.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace { @@ -55,7 +56,7 @@ private: }; std::unique_ptr<KVHarnessHelper> makeHelper() { - return stdx::make_unique<EphemeralForTestKVHarnessHelper>(); + return std::make_unique<EphemeralForTestKVHarnessHelper>(); } MONGO_INITIALIZER(RegisterKVHarnessFactory)(InitializerContext*) { diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp index 3ce3af87357..7002b7d23b8 100644 --- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp +++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.cpp @@ -31,12 +31,13 @@ #include "mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.h" +#include <memory> + #include "mongo/db/jsobj.h" #include "mongo/db/namespace_string.h" #include "mongo/db/operation_context.h" #include "mongo/db/storage/oplog_hack.h" #include "mongo/db/storage/recovery_unit.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/str.h" #include "mongo/util/unowned_ptr.h" @@ -545,8 +546,8 @@ StatusWith<RecordData> EphemeralForTestRecordStore::updateWithDamages( std::unique_ptr<SeekableRecordCursor> EphemeralForTestRecordStore::getCursor( OperationContext* opCtx, bool forward) const { if (forward) - return stdx::make_unique<Cursor>(opCtx, *this); - return stdx::make_unique<ReverseCursor>(opCtx, *this); + return std::make_unique<Cursor>(opCtx, *this); + return std::make_unique<ReverseCursor>(opCtx, *this); } Status EphemeralForTestRecordStore::truncate(OperationContext* opCtx) { diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store_test.cpp b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store_test.cpp index 1d09b16acdb..f677d4575c9 100644 --- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store_test.cpp +++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store_test.cpp @@ -31,10 +31,11 @@ #include "mongo/db/storage/ephemeral_for_test/ephemeral_for_test_record_store.h" +#include <memory> + #include "mongo/base/init.h" #include "mongo/db/storage/ephemeral_for_test/ephemeral_for_test_recovery_unit.h" #include "mongo/db/storage/record_store_test_harness.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -49,7 +50,7 @@ public: } virtual std::unique_ptr<RecordStore> newNonCappedRecordStore(const std::string& ns) { - return stdx::make_unique<EphemeralForTestRecordStore>(ns, &data); + return std::make_unique<EphemeralForTestRecordStore>(ns, &data); } virtual std::unique_ptr<RecordStore> newCappedRecordStore(int64_t cappedSizeBytes, @@ -60,12 +61,12 @@ public: virtual std::unique_ptr<RecordStore> newCappedRecordStore(const std::string& ns, int64_t cappedSizeBytes, int64_t cappedMaxDocs) final { - return stdx::make_unique<EphemeralForTestRecordStore>( + return std::make_unique<EphemeralForTestRecordStore>( ns, &data, true, cappedSizeBytes, cappedMaxDocs); } std::unique_ptr<RecoveryUnit> newRecoveryUnit() final { - return stdx::make_unique<EphemeralForTestRecoveryUnit>(); + return std::make_unique<EphemeralForTestRecoveryUnit>(); } bool supportsDocLocking() final { @@ -76,7 +77,7 @@ public: }; std::unique_ptr<HarnessHelper> makeHarnessHelper() { - return stdx::make_unique<EphemeralForTestHarnessHelper>(); + return std::make_unique<EphemeralForTestHarnessHelper>(); } MONGO_INITIALIZER(RegisterHarnessFactory)(InitializerContext* const) { diff --git a/src/mongo/db/storage/flow_control.cpp b/src/mongo/db/storage/flow_control.cpp index e4ba6ad4b03..3f1d2e0fec3 100644 --- a/src/mongo/db/storage/flow_control.cpp +++ b/src/mongo/db/storage/flow_control.cpp @@ -132,7 +132,7 @@ FlowControl::FlowControl(ServiceContext* service, repl::ReplicationCoordinator* _lastTimeSustainerAdvanced(Date_t::now()) { // Initialize _lastTargetTicketsPermitted to maximum tickets to make sure flow control doesn't // cause a slow start on start up. - FlowControlTicketholder::set(service, stdx::make_unique<FlowControlTicketholder>(_kMaxTickets)); + FlowControlTicketholder::set(service, std::make_unique<FlowControlTicketholder>(_kMaxTickets)); service->getPeriodicRunner()->scheduleJob( {"FlowControlRefresher", diff --git a/src/mongo/db/storage/key_string_test.cpp b/src/mongo/db/storage/key_string_test.cpp index bb231aada9f..e42a9801338 100644 --- a/src/mongo/db/storage/key_string_test.cpp +++ b/src/mongo/db/storage/key_string_test.cpp @@ -48,7 +48,6 @@ #include "mongo/db/storage/key_string.h" #include "mongo/platform/decimal128.h" #include "mongo/stdx/future.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" #include "mongo/util/hex.h" @@ -1191,7 +1190,7 @@ TEST_F(KeyStringTest, NumberOrderLots) { std::vector<std::unique_ptr<KeyString>> keyStrings; for (size_t i = 0; i < numbers.size(); i++) { - keyStrings.push_back(stdx::make_unique<KeyString>(version, numbers[i], ordering)); + keyStrings.push_back(std::make_unique<KeyString>(version, numbers[i], ordering)); } for (size_t i = 0; i < numbers.size(); i++) { diff --git a/src/mongo/db/storage/kv/kv_catalog.cpp b/src/mongo/db/storage/kv/kv_catalog.cpp index a102a8707d4..b9922cea3f9 100644 --- a/src/mongo/db/storage/kv/kv_catalog.cpp +++ b/src/mongo/db/storage/kv/kv_catalog.cpp @@ -31,6 +31,7 @@ #include "mongo/db/storage/kv/kv_catalog.h" +#include <memory> #include <stdlib.h> #include "mongo/bson/util/bson_extract.h" @@ -47,7 +48,6 @@ #include "mongo/db/storage/recovery_unit.h" #include "mongo/platform/bits.h" #include "mongo/platform/random.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/str.h" diff --git a/src/mongo/db/storage/kv/kv_catalog_feature_tracker_test.cpp b/src/mongo/db/storage/kv/kv_catalog_feature_tracker_test.cpp index c7106a14ab0..b9ad41eff8d 100644 --- a/src/mongo/db/storage/kv/kv_catalog_feature_tracker_test.cpp +++ b/src/mongo/db/storage/kv/kv_catalog_feature_tracker_test.cpp @@ -31,11 +31,12 @@ #include "mongo/db/storage/kv/kv_engine_test_harness.h" +#include <memory> + #include "mongo/db/operation_context_noop.h" #include "mongo/db/storage/kv/kv_catalog_feature_tracker.h" #include "mongo/db/storage/kv/kv_engine.h" #include "mongo/db/storage/record_store.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -66,7 +67,7 @@ public: KVCatalogFeatureTrackerTest() : _helper(KVHarnessHelper::create()) {} std::unique_ptr<OperationContext> newOperationContext() { - return stdx::make_unique<OperationContextNoop>(_helper->getEngine()->newRecoveryUnit()); + return std::make_unique<OperationContextNoop>(_helper->getEngine()->newRecoveryUnit()); } void setUp() final { @@ -80,7 +81,7 @@ public: wuow.commit(); } - _catalog = stdx::make_unique<KVCatalog>(_rs.get(), false, false, nullptr); + _catalog = std::make_unique<KVCatalog>(_rs.get(), false, false, nullptr); _catalog->init(opCtx.get()); { diff --git a/src/mongo/db/storage/kv/kv_collection_catalog_entry_test.cpp b/src/mongo/db/storage/kv/kv_collection_catalog_entry_test.cpp index c4eee897176..744dd3818a2 100644 --- a/src/mongo/db/storage/kv/kv_collection_catalog_entry_test.cpp +++ b/src/mongo/db/storage/kv/kv_collection_catalog_entry_test.cpp @@ -69,7 +69,7 @@ public: } std::unique_ptr<OperationContext> newOperationContext() { - auto opCtx = stdx::make_unique<OperationContextNoop>(&cc(), 0); + auto opCtx = std::make_unique<OperationContextNoop>(&cc(), 0); opCtx->setRecoveryUnit(std::unique_ptr<RecoveryUnit>(_storageEngine.newRecoveryUnit()), WriteUnitOfWork::RecoveryUnitState::kNotInUnitOfWork); return opCtx; diff --git a/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp b/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp index 4801bc2c1dd..e5fad9811a5 100644 --- a/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp +++ b/src/mongo/db/storage/kv/kv_drop_pending_ident_reaper_test.cpp @@ -34,7 +34,6 @@ #include "mongo/db/concurrency/lock_state.h" #include "mongo/db/service_context_test_fixture.h" #include "mongo/db/storage/kv/kv_drop_pending_ident_reaper.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" @@ -173,7 +172,7 @@ void KVDropPendingIdentReaperTest::setUp() { ServiceContextTest::setUp(); auto service = getServiceContext(); service->registerClientObserver(std::make_unique<ReaperTestClientObserver>()); - _engineMock = stdx::make_unique<KVEngineMock>(); + _engineMock = std::make_unique<KVEngineMock>(); } void KVDropPendingIdentReaperTest::tearDown() { _engineMock = {}; diff --git a/src/mongo/db/storage/kv/kv_engine_test_harness.cpp b/src/mongo/db/storage/kv/kv_engine_test_harness.cpp index 6ed9e6c9299..1485bacf687 100644 --- a/src/mongo/db/storage/kv/kv_engine_test_harness.cpp +++ b/src/mongo/db/storage/kv/kv_engine_test_harness.cpp @@ -57,7 +57,7 @@ public: MyOperationContext(KVEngine* engine) : OperationContextNoop(engine->newRecoveryUnit()) {} }; -const std::unique_ptr<ClockSource> clock = stdx::make_unique<ClockSourceMock>(); +const std::unique_ptr<ClockSource> clock = std::make_unique<ClockSourceMock>(); TEST(KVEngineTestHarness, SimpleRS1) { unique_ptr<KVHarnessHelper> helper(KVHarnessHelper::create()); @@ -636,7 +636,7 @@ TEST_F(KVCatalogTest, RestartForPrefixes) { unique_ptr<RecordStore> rs = engine->getRecordStore(&opCtx, "catalog", "catalog", CollectionOptions()); unique_ptr<KVCatalog> catalog = - stdx::make_unique<KVCatalog>(rs.get(), false, false, nullptr); + std::make_unique<KVCatalog>(rs.get(), false, false, nullptr); catalog->init(&opCtx); const BSONCollectionCatalogEntry::MetaData md = diff --git a/src/mongo/db/storage/kv/kv_engine_timestamps_test.cpp b/src/mongo/db/storage/kv/kv_engine_timestamps_test.cpp index 30a3df2e4ca..aeef71561ae 100644 --- a/src/mongo/db/storage/kv/kv_engine_timestamps_test.cpp +++ b/src/mongo/db/storage/kv/kv_engine_timestamps_test.cpp @@ -40,7 +40,6 @@ #include "mongo/db/storage/kv/kv_engine.h" #include "mongo/db/storage/record_store.h" #include "mongo/db/storage/snapshot_manager.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/clock_source_mock.h" diff --git a/src/mongo/db/storage/kv/kv_storage_engine.h b/src/mongo/db/storage/kv/kv_storage_engine.h index 14360bb7700..e75f5271f8b 100644 --- a/src/mongo/db/storage/kv/kv_storage_engine.h +++ b/src/mongo/db/storage/kv/kv_storage_engine.h @@ -31,6 +31,7 @@ #include <functional> #include <map> +#include <memory> #include <string> #include "mongo/base/status_with.h" @@ -45,7 +46,6 @@ #include "mongo/db/storage/record_store.h" #include "mongo/db/storage/storage_engine.h" #include "mongo/db/storage/temporary_record_store.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/util/periodic_runner.h" diff --git a/src/mongo/db/storage/kv/kv_storage_engine_test.cpp b/src/mongo/db/storage/kv/kv_storage_engine_test.cpp index 370677f8f1c..554793f9f79 100644 --- a/src/mongo/db/storage/kv/kv_storage_engine_test.cpp +++ b/src/mongo/db/storage/kv/kv_storage_engine_test.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/base/checked_cast.h" #include "mongo/base/status_with.h" #include "mongo/bson/bsonobjbuilder.h" @@ -48,7 +50,6 @@ #include "mongo/db/storage/kv/kv_storage_engine_test_fixture.h" #include "mongo/db/storage/storage_repair_observer.h" #include "mongo/db/unclean_shutdown.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/barrier.h" #include "mongo/unittest/unittest.h" #include "mongo/util/periodic_runner_factory.h" diff --git a/src/mongo/db/storage/kv/kv_storage_engine_test_fixture.h b/src/mongo/db/storage/kv/kv_storage_engine_test_fixture.h index 2b704e7b4e5..54e2f3a54d0 100644 --- a/src/mongo/db/storage/kv/kv_storage_engine_test_fixture.h +++ b/src/mongo/db/storage/kv/kv_storage_engine_test_fixture.h @@ -131,7 +131,7 @@ public: BSONObj spec = builder.append("name", key).append("ns", collNs.ns()).append("v", 2).done(); auto descriptor = - stdx::make_unique<IndexDescriptor>(coll, IndexNames::findPluginName(spec), spec); + std::make_unique<IndexDescriptor>(coll, IndexNames::findPluginName(spec), spec); CollectionCatalogEntry* cce = CollectionCatalog::get(opCtx).lookupCollectionCatalogEntryByNamespace(collNs); diff --git a/src/mongo/db/storage/mobile/mobile_index.cpp b/src/mongo/db/storage/mobile/mobile_index.cpp index a1c54273ce0..263efc98bba 100644 --- a/src/mongo/db/storage/mobile/mobile_index.cpp +++ b/src/mongo/db/storage/mobile/mobile_index.cpp @@ -386,14 +386,14 @@ public: _startPosition(index.getKeyStringVersion()) { MobileSession* session = MobileRecoveryUnit::get(opCtx)->getSession(opCtx); - _stmt = stdx::make_unique<SqliteStatement>(*session, - "SELECT key, value FROM \"", - _index.getIdent(), - "\" WHERE key ", - (_isForward ? ">=" : "<="), - " ? ORDER BY key ", - (_isForward ? "ASC" : "DESC"), - ";"); + _stmt = std::make_unique<SqliteStatement>(*session, + "SELECT key, value FROM \"", + _index.getIdent(), + "\" WHERE key ", + (_isForward ? ">=" : "<="), + " ? ORDER BY key ", + (_isForward ? "ASC" : "DESC"), + ";"); } virtual ~CursorBase() {} @@ -420,7 +420,7 @@ public: // key if inclusive and before if exclusive. const auto discriminator = _isForward == inclusive ? KeyString::kExclusiveAfter : KeyString::kExclusiveBefore; - _endPosition = stdx::make_unique<KeyString>(_index.getKeyStringVersion()); + _endPosition = std::make_unique<KeyString>(_index.getKeyStringVersion()); _endPosition->resetToKey(stripFieldNames(key), _index.getOrdering(), discriminator); } @@ -660,7 +660,7 @@ SortedDataBuilderInterface* MobileIndexStandard::getBulkBuilder(OperationContext std::unique_ptr<SortedDataInterface::Cursor> MobileIndexStandard::newCursor(OperationContext* opCtx, bool isForward) const { - return stdx::make_unique<CursorStandard>(*this, opCtx, isForward); + return std::make_unique<CursorStandard>(*this, opCtx, isForward); } StatusWith<SpecialFormatInserted> MobileIndexStandard::_insert(OperationContext* opCtx, @@ -699,7 +699,7 @@ SortedDataBuilderInterface* MobileIndexUnique::getBulkBuilder(OperationContext* std::unique_ptr<SortedDataInterface::Cursor> MobileIndexUnique::newCursor(OperationContext* opCtx, bool isForward) const { - return stdx::make_unique<CursorUnique>(*this, opCtx, isForward); + return std::make_unique<CursorUnique>(*this, opCtx, isForward); } StatusWith<SpecialFormatInserted> MobileIndexUnique::_insert(OperationContext* opCtx, diff --git a/src/mongo/db/storage/mobile/mobile_index_test.cpp b/src/mongo/db/storage/mobile/mobile_index_test.cpp index 8013d939505..f11052b3eb1 100644 --- a/src/mongo/db/storage/mobile/mobile_index_test.cpp +++ b/src/mongo/db/storage/mobile/mobile_index_test.cpp @@ -29,6 +29,7 @@ #include <boost/filesystem.hpp> #include <boost/system/error_code.hpp> +#include <memory> #include "mongo/base/init.h" #include "mongo/db/operation_context_noop.h" @@ -37,7 +38,6 @@ #include "mongo/db/storage/mobile/mobile_session_pool.h" #include "mongo/db/storage/sorted_data_interface_test_harness.h" #include "mongo/platform/basic.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/temp_dir.h" #include "mongo/unittest/unittest.h" @@ -61,14 +61,14 @@ public: fassert(37052, status); if (isUnique) { - return stdx::make_unique<MobileIndexUnique>( + return std::make_unique<MobileIndexUnique>( _ordering, ident, "test.mobile", "indexName"); } - return stdx::make_unique<MobileIndexStandard>(_ordering, ident, "test.mobile", "indexName"); + return std::make_unique<MobileIndexStandard>(_ordering, ident, "test.mobile", "indexName"); } std::unique_ptr<RecoveryUnit> newRecoveryUnit() { - return stdx::make_unique<MobileRecoveryUnit>(_sessionPool.get()); + return std::make_unique<MobileRecoveryUnit>(_sessionPool.get()); } private: @@ -79,7 +79,7 @@ private: }; std::unique_ptr<HarnessHelper> makeHarnessHelper() { - return stdx::make_unique<MobileIndexTestHarnessHelper>(); + return std::make_unique<MobileIndexTestHarnessHelper>(); } MONGO_INITIALIZER(RegisterHarnessFactory)(InitializerContext* const) { diff --git a/src/mongo/db/storage/mobile/mobile_kv_engine.cpp b/src/mongo/db/storage/mobile/mobile_kv_engine.cpp index 4bf076e5b99..3426827ee1e 100644 --- a/src/mongo/db/storage/mobile/mobile_kv_engine.cpp +++ b/src/mongo/db/storage/mobile/mobile_kv_engine.cpp @@ -48,7 +48,6 @@ #include "mongo/db/storage/mobile/mobile_session.h" #include "mongo/db/storage/mobile/mobile_sqlite_statement.h" #include "mongo/db/storage/mobile/mobile_util.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" #include "mongo/util/scopeguard.h" @@ -219,7 +218,7 @@ std::unique_ptr<RecordStore> MobileKVEngine::getRecordStore(OperationContext* op StringData ns, StringData ident, const CollectionOptions& options) { - return stdx::make_unique<MobileRecordStore>(opCtx, ns, _path, ident.toString(), options); + return std::make_unique<MobileRecordStore>(opCtx, ns, _path, ident.toString(), options); } std::unique_ptr<RecordStore> MobileKVEngine::makeTemporaryRecordStore(OperationContext* opCtx, diff --git a/src/mongo/db/storage/mobile/mobile_kv_engine_test.cpp b/src/mongo/db/storage/mobile/mobile_kv_engine_test.cpp index 3cde73486e7..dfa93f18c19 100644 --- a/src/mongo/db/storage/mobile/mobile_kv_engine_test.cpp +++ b/src/mongo/db/storage/mobile/mobile_kv_engine_test.cpp @@ -29,10 +29,11 @@ #include "mongo/base/init.h" +#include <memory> + #include "mongo/db/storage/kv/kv_engine_test_harness.h" #include "mongo/db/storage/mobile/mobile_kv_engine.h" #include "mongo/db/storage/mobile/mobile_options_gen.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/temp_dir.h" #include "mongo/util/options_parser/options_parser.h" #include "mongo/util/options_parser/startup_options.h" @@ -56,7 +57,7 @@ public: storeMobileStorageOptionDefinitions(optionenvironment::startupOptionsParsed).ignore(); embedded::mobileGlobalOptions.disableVacuumJob = true; - _engine = stdx::make_unique<MobileKVEngine>( + _engine = std::make_unique<MobileKVEngine>( _dbPath.path(), embedded::mobileGlobalOptions, nullptr); } @@ -77,7 +78,7 @@ private: }; std::unique_ptr<KVHarnessHelper> makeHelper() { - return stdx::make_unique<MobileKVHarnessHelper>(); + return std::make_unique<MobileKVHarnessHelper>(); } MONGO_INITIALIZER(RegisterKVHarnessFactory)(InitializerContext*) { diff --git a/src/mongo/db/storage/mobile/mobile_record_store.cpp b/src/mongo/db/storage/mobile/mobile_record_store.cpp index a28d26dcb3d..ba81032d609 100644 --- a/src/mongo/db/storage/mobile/mobile_record_store.cpp +++ b/src/mongo/db/storage/mobile/mobile_record_store.cpp @@ -33,6 +33,7 @@ #include "mongo/db/storage/mobile/mobile_record_store.h" +#include <memory> #include <sqlite3.h> #include "mongo/base/static_assert.h" @@ -46,7 +47,6 @@ #include "mongo/db/storage/mobile/mobile_util.h" #include "mongo/db/storage/oplog_hack.h" #include "mongo/db/storage/recovery_unit.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" #include "mongo/util/str.h" @@ -63,16 +63,16 @@ public: : _opCtx(opCtx), _forward(forward) { MobileSession* session = MobileRecoveryUnit::get(_opCtx)->getSession(_opCtx); - _stmt = stdx::make_unique<SqliteStatement>(*session, - "SELECT rec_id, data from \"", - ident, - "\" ", - "WHERE rec_id ", - (forward ? ">" : "<"), - " ? ", - "ORDER BY rec_id ", - (forward ? "ASC" : "DESC"), - ";"); + _stmt = std::make_unique<SqliteStatement>(*session, + "SELECT rec_id, data from \"", + ident, + "\" ", + "WHERE rec_id ", + (forward ? ">" : "<"), + " ? ", + "ORDER BY rec_id ", + (forward ? "ASC" : "DESC"), + ";"); _startIdNum = (forward ? RecordId::min().repr() : RecordId::max().repr()); _savedId = RecordId(_startIdNum); @@ -387,7 +387,7 @@ StatusWith<RecordData> MobileRecordStore::updateWithDamages( std::unique_ptr<SeekableRecordCursor> MobileRecordStore::getCursor(OperationContext* opCtx, bool forward) const { - return stdx::make_unique<Cursor>(opCtx, *this, _path, _ident, forward); + return std::make_unique<Cursor>(opCtx, *this, _path, _ident, forward); } /** diff --git a/src/mongo/db/storage/mobile/mobile_record_store_test.cpp b/src/mongo/db/storage/mobile/mobile_record_store_test.cpp index 8fb268d64f4..c0927a227f8 100644 --- a/src/mongo/db/storage/mobile/mobile_record_store_test.cpp +++ b/src/mongo/db/storage/mobile/mobile_record_store_test.cpp @@ -31,6 +31,7 @@ #include <boost/filesystem.hpp> #include <boost/system/error_code.hpp> +#include <memory> #include "mongo/base/init.h" #include "mongo/db/catalog/collection_options.h" @@ -43,7 +44,6 @@ #include "mongo/db/storage/mobile/mobile_sqlite_statement.h" #include "mongo/db/storage/mobile/mobile_util.h" #include "mongo/db/storage/record_store_test_harness.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/temp_dir.h" #include "mongo/unittest/unittest.h" #include "mongo/util/options_parser/options_parser.h" @@ -112,7 +112,7 @@ public: std::unique_ptr<RecordStore> newNonCappedRecordStore(const std::string& ns) override { ServiceContext::UniqueOperationContext opCtx(this->newOperationContext()); MobileRecordStore::create(opCtx.get(), ns); - return stdx::make_unique<MobileRecordStore>( + return std::make_unique<MobileRecordStore>( opCtx.get(), ns, _fullPath, ns, CollectionOptions()); } @@ -131,11 +131,11 @@ public: options.capped = true; options.cappedSize = cappedMaxSize; options.cappedMaxDocs = cappedMaxDocs; - return stdx::make_unique<MobileRecordStore>(opCtx.get(), ns, _fullPath, ns, options); + return std::make_unique<MobileRecordStore>(opCtx.get(), ns, _fullPath, ns, options); } std::unique_ptr<RecoveryUnit> newRecoveryUnit() final { - return stdx::make_unique<MobileRecoveryUnit>(_sessionPool.get()); + return std::make_unique<MobileRecoveryUnit>(_sessionPool.get()); } bool supportsDocLocking() final { @@ -149,7 +149,7 @@ private: }; std::unique_ptr<HarnessHelper> makeHarnessHelper() { - return stdx::make_unique<MobileHarnessHelper>(); + return std::make_unique<MobileHarnessHelper>(); } MONGO_INITIALIZER(RegisterHarnessFactory)(InitializerContext* const) { diff --git a/src/mongo/db/storage/mobile/mobile_session_pool.cpp b/src/mongo/db/storage/mobile/mobile_session_pool.cpp index 1e73885d8b0..179a30cbe5e 100644 --- a/src/mongo/db/storage/mobile/mobile_session_pool.cpp +++ b/src/mongo/db/storage/mobile/mobile_session_pool.cpp @@ -114,7 +114,7 @@ std::unique_ptr<MobileSession> MobileSessionPool::getSession(OperationContext* o // Checks if there is an open session available. if (!_sessions.empty()) { sqlite3* session = _popSession_inlock(); - return stdx::make_unique<MobileSession>(session, this); + return std::make_unique<MobileSession>(session, this); } // Checks if a new session can be opened. @@ -124,7 +124,7 @@ std::unique_ptr<MobileSession> MobileSessionPool::getSession(OperationContext* o embedded::checkStatus(status, SQLITE_OK, "sqlite3_open"); embedded::configureSession(session, _options); _curPoolSize++; - return stdx::make_unique<MobileSession>(session, this); + return std::make_unique<MobileSession>(session, this); } // There are no open sessions available and the maxPoolSize has been reached. @@ -133,7 +133,7 @@ std::unique_ptr<MobileSession> MobileSessionPool::getSession(OperationContext* o _releasedSessionNotifier, lk, [&] { return !_sessions.empty(); }); sqlite3* session = _popSession_inlock(); - return stdx::make_unique<MobileSession>(session, this); + return std::make_unique<MobileSession>(session, this); } void MobileSessionPool::releaseSession(MobileSession* session) { @@ -170,7 +170,7 @@ void MobileSessionPool::shutDown() { int status = sqlite3_open(_path.c_str(), &session); embedded::checkStatus(status, SQLITE_OK, "sqlite3_open"); - std::unique_ptr<MobileSession> mobSession = stdx::make_unique<MobileSession>(session, this); + std::unique_ptr<MobileSession> mobSession = std::make_unique<MobileSession>(session, this); LOG(MOBILE_LOG_LEVEL_LOW) << "MobileSE: Executing queued drops at shutdown"; failedDropsQueue.execAndDequeueAllOps(mobSession.get()); sqlite3_close(session); diff --git a/src/mongo/db/storage/record_store_test_harness.h b/src/mongo/db/storage/record_store_test_harness.h index 0ffb0cb9d2a..d027a749965 100644 --- a/src/mongo/db/storage/record_store_test_harness.h +++ b/src/mongo/db/storage/record_store_test_harness.h @@ -30,11 +30,11 @@ #pragma once #include <cstdint> +#include <memory> #include "mongo/db/operation_context_noop.h" #include "mongo/db/service_context.h" #include "mongo/db/storage/test_harness_helper.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/db/storage/sorted_data_interface_test_harness.h b/src/mongo/db/storage/sorted_data_interface_test_harness.h index 17cf647297d..0df65e0a220 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_harness.h +++ b/src/mongo/db/storage/sorted_data_interface_test_harness.h @@ -38,7 +38,6 @@ #include "mongo/db/service_context.h" #include "mongo/db/storage/sorted_data_interface.h" #include "mongo/db/storage/test_harness_helper.h" -#include "mongo/stdx/memory.h" #include "mongo/util/unowned_ptr.h" namespace mongo { diff --git a/src/mongo/db/storage/storage_engine_init.cpp b/src/mongo/db/storage/storage_engine_init.cpp index 66805071ca2..5377f91dfb2 100644 --- a/src/mongo/db/storage/storage_engine_init.cpp +++ b/src/mongo/db/storage/storage_engine_init.cpp @@ -34,6 +34,7 @@ #include "mongo/db/storage/storage_engine_init.h" #include <map> +#include <memory> #include "mongo/base/init.h" #include "mongo/bson/bsonobjbuilder.h" @@ -44,7 +45,6 @@ #include "mongo/db/storage/storage_options.h" #include "mongo/db/storage/storage_repair_observer.h" #include "mongo/db/unclean_shutdown.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" #include "mongo/util/str.h" @@ -347,7 +347,7 @@ public: if (!storageEngine) { return; } - opCtx->setLockState(stdx::make_unique<LockerImpl>()); + opCtx->setLockState(std::make_unique<LockerImpl>()); opCtx->setRecoveryUnit(std::unique_ptr<RecoveryUnit>(storageEngine->newRecoveryUnit()), WriteUnitOfWork::RecoveryUnitState::kNotInUnitOfWork); } diff --git a/src/mongo/db/storage/storage_repair_observer_test.cpp b/src/mongo/db/storage/storage_repair_observer_test.cpp index e34717b76f5..8a5faf0d01c 100644 --- a/src/mongo/db/storage/storage_repair_observer_test.cpp +++ b/src/mongo/db/storage/storage_repair_observer_test.cpp @@ -54,7 +54,7 @@ public: repl::ReplicationCoordinator::set( getServiceContext(), - stdx::make_unique<repl::ReplicationCoordinatorMock>(getServiceContext())); + std::make_unique<repl::ReplicationCoordinatorMock>(getServiceContext())); } void assertRepairIncompleteOnTearDown() { diff --git a/src/mongo/db/storage/test_harness_helper.h b/src/mongo/db/storage/test_harness_helper.h index fb0d1974b1a..7ca1add29c9 100644 --- a/src/mongo/db/storage/test_harness_helper.h +++ b/src/mongo/db/storage/test_harness_helper.h @@ -40,7 +40,6 @@ #include "mongo/db/service_context.h" #include "mongo/db/service_context_test_fixture.h" #include "mongo/db/storage/sorted_data_interface.h" -#include "mongo/stdx/memory.h" #include "mongo/util/unowned_ptr.h" namespace mongo { diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_customization_hooks.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_customization_hooks.cpp index 7d4b35af2d0..e8b1b1fac4b 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_customization_hooks.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_customization_hooks.cpp @@ -31,17 +31,18 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_customization_hooks.h" +#include <memory> + #include "mongo/base/init.h" #include "mongo/base/string_data.h" #include "mongo/db/service_context.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace { ServiceContext::ConstructorActionRegisterer setWiredTigerCustomizationHooks{ "SetWiredTigerCustomizationHooks", [](ServiceContext* service) { - auto customizationHooks = stdx::make_unique<WiredTigerCustomizationHooks>(); + auto customizationHooks = std::make_unique<WiredTigerCustomizationHooks>(); WiredTigerCustomizationHooks::set(service, std::move(customizationHooks)); }}; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_extensions.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_extensions.cpp index 17f59c7de1e..564c4bae5c6 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_extensions.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_extensions.cpp @@ -31,9 +31,10 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_extensions.h" +#include <memory> + #include "mongo/base/string_data.h" #include "mongo/db/service_context.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp index 70164925ac1..95fe1bf3b50 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp @@ -33,6 +33,7 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_index.h" +#include <memory> #include <set> #include "mongo/base/checked_cast.h" @@ -50,7 +51,6 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_record_store.h" #include "mongo/db/storage/wiredtiger/wiredtiger_session_cache.h" #include "mongo/db/storage/wiredtiger/wiredtiger_util.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/fail_point.h" #include "mongo/util/hex.h" @@ -831,7 +831,7 @@ public: // end after the key if inclusive and before if exclusive. const auto discriminator = _forward == inclusive ? KeyString::kExclusiveAfter : KeyString::kExclusiveBefore; - _endPosition = stdx::make_unique<KeyString>(_idx.keyStringVersion()); + _endPosition = std::make_unique<KeyString>(_idx.keyStringVersion()); _endPosition->resetToKey(stripFieldNames(key), _idx.ordering(), discriminator); } @@ -1249,7 +1249,7 @@ WiredTigerIndexUnique::WiredTigerIndexUnique(OperationContext* ctx, std::unique_ptr<SortedDataInterface::Cursor> WiredTigerIndexUnique::newCursor( OperationContext* opCtx, bool forward) const { - return stdx::make_unique<WiredTigerIndexUniqueCursor>(*this, opCtx, forward, _prefix); + return std::make_unique<WiredTigerIndexUniqueCursor>(*this, opCtx, forward, _prefix); } SortedDataBuilderInterface* WiredTigerIndexUnique::getBulkBuilder(OperationContext* opCtx, @@ -1666,7 +1666,7 @@ WiredTigerIndexStandard::WiredTigerIndexStandard(OperationContext* ctx, std::unique_ptr<SortedDataInterface::Cursor> WiredTigerIndexStandard::newCursor( OperationContext* opCtx, bool forward) const { - return stdx::make_unique<WiredTigerIndexStandardCursor>(*this, opCtx, forward, _prefix); + return std::make_unique<WiredTigerIndexStandardCursor>(*this, opCtx, forward, _prefix); } SortedDataBuilderInterface* WiredTigerIndexStandard::getBulkBuilder(OperationContext* opCtx, diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_index_test.cpp index 4af39c6886c..95ba5e3196e 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_index_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index_test.cpp @@ -43,7 +43,6 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h" #include "mongo/db/storage/wiredtiger/wiredtiger_session_cache.h" #include "mongo/db/storage/wiredtiger/wiredtiger_util.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/temp_dir.h" #include "mongo/unittest/unittest.h" diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index 2c6728dfe88..4fb9b9e1df3 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -81,7 +81,6 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_session_cache.h" #include "mongo/db/storage/wiredtiger/wiredtiger_size_storer.h" #include "mongo/platform/atomic_word.h" -#include "mongo/stdx/memory.h" #include "mongo/util/background.h" #include "mongo/util/concurrency/idle_thread_block.h" #include "mongo/util/concurrency/ticketholder.h" @@ -547,7 +546,7 @@ WiredTigerKVEngine::WiredTigerKVEngine(const std::string& canonicalName, bool repair, bool readOnly) : _clockSource(cs), - _oplogManager(stdx::make_unique<WiredTigerOplogManager>()), + _oplogManager(std::make_unique<WiredTigerOplogManager>()), _canonicalName(canonicalName), _path(path), _sizeStorerSyncTracker(cs, 100000, Seconds(60)), @@ -655,11 +654,11 @@ WiredTigerKVEngine::WiredTigerKVEngine(const std::string& canonicalName, _sessionCache.reset(new WiredTigerSessionCache(this)); - _sessionSweeper = stdx::make_unique<WiredTigerSessionSweeper>(_sessionCache.get()); + _sessionSweeper = std::make_unique<WiredTigerSessionSweeper>(_sessionCache.get()); _sessionSweeper->go(); if (_durable && !_ephemeral) { - _journalFlusher = stdx::make_unique<WiredTigerJournalFlusher>(_sessionCache.get()); + _journalFlusher = std::make_unique<WiredTigerJournalFlusher>(_sessionCache.get()); _journalFlusher->go(); } @@ -674,8 +673,7 @@ WiredTigerKVEngine::WiredTigerKVEngine(const std::string& canonicalName, setStableTimestamp(_recoveryTimestamp, false); } - _checkpointThread = - stdx::make_unique<WiredTigerCheckpointThread>(this, _sessionCache.get()); + _checkpointThread = std::make_unique<WiredTigerCheckpointThread>(this, _sessionCache.get()); _checkpointThread->go(); } @@ -988,7 +986,7 @@ Status WiredTigerKVEngine::beginBackup(OperationContext* opCtx) { syncSizeInfo(true); // This cursor will be freed by the backupSession being closed as the session is uncached - auto session = stdx::make_unique<WiredTigerSession>(_conn); + auto session = std::make_unique<WiredTigerSession>(_conn); WT_CURSOR* c = NULL; WT_SESSION* s = session->getSession(); int ret = WT_OP_CHECK(s->open_cursor(s, "backup:", NULL, NULL, &c)); @@ -1018,7 +1016,7 @@ StatusWith<std::vector<std::string>> WiredTigerKVEngine::beginNonBlockingBackup( syncSizeInfo(true); // This cursor will be freed by the backupSession being closed as the session is uncached - auto sessionRaii = stdx::make_unique<WiredTigerSession>(_conn); + auto sessionRaii = std::make_unique<WiredTigerSession>(_conn); WT_CURSOR* cursor = NULL; WT_SESSION* session = sessionRaii->getSession(); int wtRet = session->open_cursor(session, "backup:", NULL, NULL, &cursor); @@ -1225,9 +1223,9 @@ std::unique_ptr<RecordStore> WiredTigerKVEngine::getGroupedRecordStore( std::unique_ptr<WiredTigerRecordStore> ret; if (prefix == KVPrefix::kNotPrefixed) { - ret = stdx::make_unique<StandardWiredTigerRecordStore>(this, opCtx, params); + ret = std::make_unique<StandardWiredTigerRecordStore>(this, opCtx, params); } else { - ret = stdx::make_unique<PrefixedWiredTigerRecordStore>(this, opCtx, params, prefix); + ret = std::make_unique<PrefixedWiredTigerRecordStore>(this, opCtx, params, prefix); } ret->postConstructorInit(opCtx); @@ -1321,7 +1319,7 @@ std::unique_ptr<RecordStore> WiredTigerKVEngine::makeTemporaryRecordStore(Operat params.cappedMaxDocs = -1; std::unique_ptr<WiredTigerRecordStore> rs; - rs = stdx::make_unique<StandardWiredTigerRecordStore>(this, opCtx, params); + rs = std::make_unique<StandardWiredTigerRecordStore>(this, opCtx, params); rs->postConstructorInit(opCtx); return std::move(rs); diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp index c6e0da77906..0b99c5d33b4 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp @@ -33,6 +33,7 @@ #include <boost/filesystem.hpp> #include <boost/filesystem/path.hpp> +#include <memory> #include "mongo/base/init.h" #include "mongo/db/operation_context_noop.h" @@ -44,7 +45,6 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h" #include "mongo/db/storage/wiredtiger/wiredtiger_record_store.h" #include "mongo/logger/logger.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/temp_dir.h" #include "mongo/unittest/unittest.h" #include "mongo/util/clock_source_mock.h" @@ -91,7 +91,7 @@ private: false); } - const std::unique_ptr<ClockSource> _cs = stdx::make_unique<ClockSourceMock>(); + const std::unique_ptr<ClockSource> _cs = std::make_unique<ClockSourceMock>(); unittest::TempDir _dbpath; std::unique_ptr<WiredTigerKVEngine> _engine; bool _forRepair; @@ -318,7 +318,7 @@ TEST_F(WiredTigerKVEngineTest, TestOplogTruncation) { } std::unique_ptr<KVHarnessHelper> makeHelper() { - return stdx::make_unique<WiredTigerKVHarnessHelper>(); + return std::make_unique<WiredTigerKVHarnessHelper>(); } MONGO_INITIALIZER(RegisterKVHarnessFactory)(InitializerContext*) { diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_prefixed_index_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_prefixed_index_test.cpp index 3becc730727..b37026635f0 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_prefixed_index_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_prefixed_index_test.cpp @@ -44,7 +44,6 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h" #include "mongo/db/storage/wiredtiger/wiredtiger_session_cache.h" #include "mongo/db/storage/wiredtiger/wiredtiger_util.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/temp_dir.h" #include "mongo/unittest/unittest.h" #include "mongo/util/system_clock_source.h" @@ -61,7 +60,7 @@ public: int ret = wiredtiger_open(_dbpath.path().c_str(), NULL, config, &_conn); invariantWTOK(ret); - _fastClockSource = stdx::make_unique<SystemClockSource>(); + _fastClockSource = std::make_unique<SystemClockSource>(); _sessionCache = new WiredTigerSessionCache(_conn, _fastClockSource.get()); } @@ -101,12 +100,12 @@ public: invariantWTOK(WiredTigerIndex::Create(&opCtx, uri, result.getValue())); if (unique) - return stdx::make_unique<WiredTigerIndexUnique>(&opCtx, uri, &desc, prefix); - return stdx::make_unique<WiredTigerIndexStandard>(&opCtx, uri, &desc, prefix); + return std::make_unique<WiredTigerIndexUnique>(&opCtx, uri, &desc, prefix); + return std::make_unique<WiredTigerIndexStandard>(&opCtx, uri, &desc, prefix); } std::unique_ptr<RecoveryUnit> newRecoveryUnit() final { - return stdx::make_unique<WiredTigerRecoveryUnit>(_sessionCache, &_oplogManager); + return std::make_unique<WiredTigerRecoveryUnit>(_sessionCache, &_oplogManager); } private: @@ -118,7 +117,7 @@ private: }; std::unique_ptr<HarnessHelper> makeHarnessHelper() { - return stdx::make_unique<MyHarnessHelper>(); + return std::make_unique<MyHarnessHelper>(); } MONGO_INITIALIZER(RegisterHarnessFactory)(InitializerContext* const) { diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_prefixed_record_store_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_prefixed_record_store_test.cpp index 45de934a4f6..5ac4d728739 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_prefixed_record_store_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_prefixed_record_store_test.cpp @@ -55,7 +55,6 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_session_cache.h" #include "mongo/db/storage/wiredtiger/wiredtiger_size_storer.h" #include "mongo/db/storage/wiredtiger/wiredtiger_util.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/temp_dir.h" #include "mongo/unittest/unittest.h" #include "mongo/util/clock_source_mock.h" @@ -125,7 +124,7 @@ public: params.cappedCallback = nullptr; params.sizeStorer = nullptr; - auto ret = stdx::make_unique<PrefixedWiredTigerRecordStore>( + auto ret = std::make_unique<PrefixedWiredTigerRecordStore>( _engine.get(), &opCtx, params, KVPrefix::generateNextPrefix()); ret->postConstructorInit(&opCtx); return std::move(ret); @@ -173,7 +172,7 @@ public: params.sizeStorer = nullptr; auto ret = - stdx::make_unique<PrefixedWiredTigerRecordStore>(_engine.get(), &opCtx, params, prefix); + std::make_unique<PrefixedWiredTigerRecordStore>(_engine.get(), &opCtx, params, prefix); ret->postConstructorInit(&opCtx); return std::move(ret); } @@ -193,13 +192,13 @@ public: private: unittest::TempDir _dbpath; - const std::unique_ptr<ClockSource> _cs = stdx::make_unique<ClockSourceMock>(); + const std::unique_ptr<ClockSource> _cs = std::make_unique<ClockSourceMock>(); std::unique_ptr<WiredTigerKVEngine> _engine; }; std::unique_ptr<HarnessHelper> makeHarnessHelper() { - return stdx::make_unique<PrefixedWiredTigerHarnessHelper>(); + return std::make_unique<PrefixedWiredTigerHarnessHelper>(); } MONGO_INITIALIZER(RegisterHarnessFactory)(InitializerContext* const) { diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp index 90f763db5e6..84d2f3ece7b 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp @@ -37,6 +37,8 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_record_store.h" +#include <memory> + #include "mongo/base/checked_cast.h" #include "mongo/base/static_assert.h" #include "mongo/bson/util/builder.h" @@ -58,7 +60,6 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h" #include "mongo/db/storage/wiredtiger/wiredtiger_session_cache.h" #include "mongo/db/storage/wiredtiger/wiredtiger_util.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/concurrency/idle_thread_block.h" #include "mongo/util/fail_point.h" @@ -2051,12 +2052,12 @@ std::unique_ptr<SeekableRecordCursor> StandardWiredTigerRecordStore::getCursor( wru->setIsOplogReader(); } - return stdx::make_unique<WiredTigerRecordStoreStandardCursor>(opCtx, *this, forward); + return std::make_unique<WiredTigerRecordStoreStandardCursor>(opCtx, *this, forward); } std::unique_ptr<RecordCursor> StandardWiredTigerRecordStore::getRandomCursorWithOptions( OperationContext* opCtx, StringData extraConfig) const { - return stdx::make_unique<RandomCursor>(opCtx, *this, extraConfig); + return std::make_unique<RandomCursor>(opCtx, *this, extraConfig); } WiredTigerRecordStoreStandardCursor::WiredTigerRecordStoreStandardCursor( @@ -2102,7 +2103,7 @@ std::unique_ptr<SeekableRecordCursor> PrefixedWiredTigerRecordStore::getCursor( wru->setIsOplogReader(); } - return stdx::make_unique<WiredTigerRecordStorePrefixedCursor>(opCtx, *this, _prefix, forward); + return std::make_unique<WiredTigerRecordStorePrefixedCursor>(opCtx, *this, _prefix, forward); } std::unique_ptr<RecordCursor> PrefixedWiredTigerRecordStore::getRandomCursorWithOptions( diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp index 4c7dcf641a6..f6040a92621 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp @@ -48,7 +48,6 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h" #include "mongo/db/storage/wiredtiger/wiredtiger_size_storer.h" #include "mongo/db/storage/wiredtiger/wiredtiger_util.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/temp_dir.h" #include "mongo/unittest/unittest.h" #include "mongo/util/fail_point.h" diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp index bd0b508f05b..8bcde18b042 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit_test.cpp @@ -103,7 +103,7 @@ public: params.sizeStorer = nullptr; params.isReadOnly = false; - auto ret = stdx::make_unique<StandardWiredTigerRecordStore>(&_engine, opCtx, params); + auto ret = std::make_unique<StandardWiredTigerRecordStore>(&_engine, opCtx, params); ret->postConstructorInit(opCtx); return std::move(ret); } diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp index fb41f7c2b3b..5344e0163fc 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp @@ -33,6 +33,8 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_session_cache.h" +#include <memory> + #include "mongo/base/error_codes.h" #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/global_settings.h" @@ -41,7 +43,6 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h" #include "mongo/db/storage/wiredtiger/wiredtiger_parameters_gen.h" #include "mongo/db/storage/wiredtiger/wiredtiger_util.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/util/log.h" #include "mongo/util/scopeguard.h" diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache_test.cpp index 8cfd3d1ddc5..37ac7eddc4e 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache_test.cpp @@ -51,7 +51,7 @@ public: ss << "create,"; ss << extraStrings; string config = ss.str(); - _fastClockSource = stdx::make_unique<SystemClockSource>(); + _fastClockSource = std::make_unique<SystemClockSource>(); int ret = wiredtiger_open(dbpath.toString().c_str(), NULL, config.c_str(), &_conn); ASSERT_OK(wtRCToStatus(ret)); ASSERT(_conn); diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_standard_index_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_standard_index_test.cpp index 9407ff2dedc..7dc5d65ff38 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_standard_index_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_standard_index_test.cpp @@ -44,7 +44,6 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h" #include "mongo/db/storage/wiredtiger/wiredtiger_session_cache.h" #include "mongo/db/storage/wiredtiger/wiredtiger_util.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/temp_dir.h" #include "mongo/unittest/unittest.h" #include "mongo/util/system_clock_source.h" @@ -61,7 +60,7 @@ public: int ret = wiredtiger_open(_dbpath.path().c_str(), NULL, config, &_conn); invariantWTOK(ret); - _fastClockSource = stdx::make_unique<SystemClockSource>(); + _fastClockSource = std::make_unique<SystemClockSource>(); _sessionCache = new WiredTigerSessionCache(_conn, _fastClockSource.get()); } @@ -101,12 +100,12 @@ public: invariantWTOK(WiredTigerIndex::Create(&opCtx, uri, result.getValue())); if (unique) - return stdx::make_unique<WiredTigerIndexUnique>(&opCtx, uri, &desc, prefix); - return stdx::make_unique<WiredTigerIndexStandard>(&opCtx, uri, &desc, prefix); + return std::make_unique<WiredTigerIndexUnique>(&opCtx, uri, &desc, prefix); + return std::make_unique<WiredTigerIndexStandard>(&opCtx, uri, &desc, prefix); } std::unique_ptr<RecoveryUnit> newRecoveryUnit() final { - return stdx::make_unique<WiredTigerRecoveryUnit>(_sessionCache, &_oplogManager); + return std::make_unique<WiredTigerRecoveryUnit>(_sessionCache, &_oplogManager); } private: @@ -118,7 +117,7 @@ private: }; std::unique_ptr<HarnessHelper> makeHarnessHelper() { - return stdx::make_unique<MyHarnessHelper>(); + return std::make_unique<MyHarnessHelper>(); } MONGO_INITIALIZER(RegisterHarnessFactory)(InitializerContext* const) { diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_standard_record_store_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_standard_record_store_test.cpp index 0d4c5fbc477..24a5f3832d6 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_standard_record_store_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_standard_record_store_test.cpp @@ -54,7 +54,6 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_session_cache.h" #include "mongo/db/storage/wiredtiger/wiredtiger_size_storer.h" #include "mongo/db/storage/wiredtiger/wiredtiger_util.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/temp_dir.h" #include "mongo/unittest/unittest.h" #include "mongo/util/clock_source_mock.h" @@ -124,7 +123,7 @@ public: params.cappedCallback = nullptr; params.sizeStorer = nullptr; - auto ret = stdx::make_unique<StandardWiredTigerRecordStore>(&_engine, &opCtx, params); + auto ret = std::make_unique<StandardWiredTigerRecordStore>(&_engine, &opCtx, params); ret->postConstructorInit(&opCtx); return std::move(ret); } @@ -170,7 +169,7 @@ public: params.cappedCallback = nullptr; params.sizeStorer = nullptr; - auto ret = stdx::make_unique<StandardWiredTigerRecordStore>(&_engine, &opCtx, params); + auto ret = std::make_unique<StandardWiredTigerRecordStore>(&_engine, &opCtx, params); ret->postConstructorInit(&opCtx); return std::move(ret); } @@ -195,7 +194,7 @@ private: }; std::unique_ptr<HarnessHelper> makeHarnessHelper() { - return stdx::make_unique<WiredTigerHarnessHelper>(); + return std::make_unique<WiredTigerHarnessHelper>(); } MONGO_INITIALIZER(RegisterHarnessFactory)(InitializerContext* const) { diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_util_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_util_test.cpp index d0595aa6983..0199cd8a1ed 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_util_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_util_test.cpp @@ -55,7 +55,7 @@ public: ss << "create,"; ss << extraStrings; string config = ss.str(); - _fastClockSource = stdx::make_unique<SystemClockSource>(); + _fastClockSource = std::make_unique<SystemClockSource>(); int ret = wiredtiger_open(dbpath.toString().c_str(), NULL, config.c_str(), &_conn); ASSERT_OK(wtRCToStatus(ret)); ASSERT(_conn); diff --git a/src/mongo/db/transaction_history_iterator_test.cpp b/src/mongo/db/transaction_history_iterator_test.cpp index b64f5338ba3..50f8a51192d 100644 --- a/src/mongo/db/transaction_history_iterator_test.cpp +++ b/src/mongo/db/transaction_history_iterator_test.cpp @@ -46,7 +46,6 @@ #include "mongo/db/service_context.h" #include "mongo/db/service_context_d_test_fixture.h" #include "mongo/db/transaction_history_iterator.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { diff --git a/src/mongo/db/transaction_participant.cpp b/src/mongo/db/transaction_participant.cpp index dde5cb55a17..e48239bda6c 100644 --- a/src/mongo/db/transaction_participant.cpp +++ b/src/mongo/db/transaction_participant.cpp @@ -676,7 +676,7 @@ TransactionParticipant::TxnResources::TxnResources(WithLock wl, _ruState = opCtx->getWriteUnitOfWork()->release(); opCtx->setWriteUnitOfWork(nullptr); - _locker = opCtx->swapLockState(stdx::make_unique<LockerImpl>()); + _locker = opCtx->swapLockState(std::make_unique<LockerImpl>()); // Inherit the locking setting from the original one. opCtx->lockState()->setShouldConflictWithSecondaryBatchApplication( _locker->shouldConflictWithSecondaryBatchApplication()); diff --git a/src/mongo/db/transaction_participant_retryable_writes_test.cpp b/src/mongo/db/transaction_participant_retryable_writes_test.cpp index d5e0ded3338..a50b3a95ea3 100644 --- a/src/mongo/db/transaction_participant_retryable_writes_test.cpp +++ b/src/mongo/db/transaction_participant_retryable_writes_test.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/db/client.h" #include "mongo/db/db_raii.h" #include "mongo/db/dbdirectclient.h" @@ -45,7 +47,6 @@ #include "mongo/db/session_catalog_mongod.h" #include "mongo/db/transaction_participant.h" #include "mongo/stdx/future.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" #include "mongo/util/net/socket_utils.h" @@ -172,7 +173,7 @@ protected: const auto service = opCtx()->getServiceContext(); const auto opObserverRegistry = dynamic_cast<OpObserverRegistry*>(service->getOpObserver()); - opObserverRegistry->addObserver(stdx::make_unique<OpObserverMock>()); + opObserverRegistry->addObserver(std::make_unique<OpObserverMock>()); opCtx()->setLogicalSessionId(makeLogicalSessionIdForTest()); _opContextSession.emplace(opCtx()); diff --git a/src/mongo/db/transaction_participant_test.cpp b/src/mongo/db/transaction_participant_test.cpp index 5c27632ff13..9f3ef0ea5f7 100644 --- a/src/mongo/db/transaction_participant_test.cpp +++ b/src/mongo/db/transaction_participant_test.cpp @@ -29,6 +29,7 @@ #include "mongo/platform/basic.h" #include <boost/optional/optional_io.hpp> +#include <memory> #include "mongo/db/client.h" #include "mongo/db/db_raii.h" @@ -48,7 +49,6 @@ #include "mongo/db/transaction_participant_gen.h" #include "mongo/logger/logger.h" #include "mongo/stdx/future.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/barrier.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" @@ -230,7 +230,7 @@ protected: const auto service = opCtx()->getServiceContext(); OpObserverRegistry* opObserverRegistry = dynamic_cast<OpObserverRegistry*>(service->getOpObserver()); - auto mockObserver = stdx::make_unique<OpObserverMock>(); + auto mockObserver = std::make_unique<OpObserverMock>(); _opObserver = mockObserver.get(); opObserverRegistry->addObserver(std::move(mockObserver)); @@ -1434,7 +1434,7 @@ protected: * Set up and return a mock clock source. */ ClockSourceMock* initMockPreciseClockSource() { - getServiceContext()->setPreciseClockSource(stdx::make_unique<ClockSourceMock>()); + getServiceContext()->setPreciseClockSource(std::make_unique<ClockSourceMock>()); return dynamic_cast<ClockSourceMock*>(getServiceContext()->getPreciseClockSource()); } @@ -1442,7 +1442,7 @@ protected: * Set up and return a mock tick source. */ TickSourceMicrosecondMock* initMockTickSource() { - getServiceContext()->setTickSource(stdx::make_unique<TickSourceMicrosecondMock>()); + getServiceContext()->setTickSource(std::make_unique<TickSourceMicrosecondMock>()); auto tickSource = dynamic_cast<TickSourceMicrosecondMock*>(getServiceContext()->getTickSource()); // Ensure that the tick source is not initialized to zero. diff --git a/src/mongo/db/ttl.cpp b/src/mongo/db/ttl.cpp index 77ca6089df4..69df58f9428 100644 --- a/src/mongo/db/ttl.cpp +++ b/src/mongo/db/ttl.cpp @@ -255,7 +255,7 @@ private: const char* keyFieldName = key.firstElement().fieldName(); BSONObj query = BSON(keyFieldName << BSON("$gte" << kDawnOfTime << "$lte" << expirationTime)); - auto qr = stdx::make_unique<QueryRequest>(collectionNSS); + auto qr = std::make_unique<QueryRequest>(collectionNSS); qr->setFilter(query); auto canonicalQuery = CanonicalQuery::canonicalize(opCtx, std::move(qr)); invariant(canonicalQuery.getStatus()); diff --git a/src/mongo/db/update/addtoset_node.h b/src/mongo/db/update/addtoset_node.h index d634691011f..74564c91c47 100644 --- a/src/mongo/db/update/addtoset_node.h +++ b/src/mongo/db/update/addtoset_node.h @@ -29,12 +29,12 @@ #pragma once +#include <memory> #include <vector> #include "mongo/base/string_data.h" #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/update/modifier_node.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -46,7 +46,7 @@ public: Status init(BSONElement modExpr, const boost::intrusive_ptr<ExpressionContext>& expCtx) final; std::unique_ptr<UpdateNode> clone() const final { - return stdx::make_unique<AddToSetNode>(*this); + return std::make_unique<AddToSetNode>(*this); } void setCollator(const CollatorInterface* collator) final; diff --git a/src/mongo/db/update/arithmetic_node.h b/src/mongo/db/update/arithmetic_node.h index b24c3391f4e..c450e6dcdcc 100644 --- a/src/mongo/db/update/arithmetic_node.h +++ b/src/mongo/db/update/arithmetic_node.h @@ -29,9 +29,10 @@ #pragma once +#include <memory> + #include "mongo/base/string_data.h" #include "mongo/db/update/modifier_node.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -47,7 +48,7 @@ public: Status init(BSONElement modExpr, const boost::intrusive_ptr<ExpressionContext>& expCtx) final; std::unique_ptr<UpdateNode> clone() const final { - return stdx::make_unique<ArithmeticNode>(*this); + return std::make_unique<ArithmeticNode>(*this); } void setCollator(const CollatorInterface* collator) final {} diff --git a/src/mongo/db/update/array_culling_node.h b/src/mongo/db/update/array_culling_node.h index c9b36e97682..dd59033d3b7 100644 --- a/src/mongo/db/update/array_culling_node.h +++ b/src/mongo/db/update/array_culling_node.h @@ -29,9 +29,10 @@ #pragma once +#include <memory> + #include "mongo/base/clonable_ptr.h" #include "mongo/db/update/modifier_node.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/db/update/bit_node.h b/src/mongo/db/update/bit_node.h index 96840fdec1e..07812b3e08a 100644 --- a/src/mongo/db/update/bit_node.h +++ b/src/mongo/db/update/bit_node.h @@ -29,10 +29,11 @@ #pragma once +#include <memory> + #include "mongo/base/string_data.h" #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/update/modifier_node.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -44,7 +45,7 @@ public: Status init(BSONElement modExpr, const boost::intrusive_ptr<ExpressionContext>& expCtx) final; std::unique_ptr<UpdateNode> clone() const final { - return stdx::make_unique<BitNode>(*this); + return std::make_unique<BitNode>(*this); } void setCollator(const CollatorInterface* collator) final {} diff --git a/src/mongo/db/update/compare_node.h b/src/mongo/db/update/compare_node.h index 95bcd666d8f..a1f25f96203 100644 --- a/src/mongo/db/update/compare_node.h +++ b/src/mongo/db/update/compare_node.h @@ -29,9 +29,10 @@ #pragma once +#include <memory> + #include "mongo/base/string_data.h" #include "mongo/db/update/modifier_node.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -47,7 +48,7 @@ public: Status init(BSONElement modExpr, const boost::intrusive_ptr<ExpressionContext>& expCtx) final; std::unique_ptr<UpdateNode> clone() const final { - return stdx::make_unique<CompareNode>(*this); + return std::make_unique<CompareNode>(*this); } void setCollator(const CollatorInterface* collator) final; diff --git a/src/mongo/db/update/conflict_placeholder_node.h b/src/mongo/db/update/conflict_placeholder_node.h index 469613a515c..a1cf0cacda5 100644 --- a/src/mongo/db/update/conflict_placeholder_node.h +++ b/src/mongo/db/update/conflict_placeholder_node.h @@ -30,12 +30,12 @@ #pragma once #include <map> +#include <memory> #include <string> #include <utility> #include <vector> #include "mongo/db/update/update_leaf_node.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -55,7 +55,7 @@ public: } std::unique_ptr<UpdateNode> clone() const final { - return stdx::make_unique<ConflictPlaceholderNode>(*this); + return std::make_unique<ConflictPlaceholderNode>(*this); } void setCollator(const CollatorInterface* collator) final {} diff --git a/src/mongo/db/update/current_date_node.h b/src/mongo/db/update/current_date_node.h index 7872dadce9a..a28de18ad36 100644 --- a/src/mongo/db/update/current_date_node.h +++ b/src/mongo/db/update/current_date_node.h @@ -29,9 +29,10 @@ #pragma once +#include <memory> + #include "mongo/base/string_data.h" #include "mongo/db/update/modifier_node.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -43,7 +44,7 @@ public: Status init(BSONElement modExpr, const boost::intrusive_ptr<ExpressionContext>& expCtx) final; std::unique_ptr<UpdateNode> clone() const final { - return stdx::make_unique<CurrentDateNode>(*this); + return std::make_unique<CurrentDateNode>(*this); } void setCollator(const CollatorInterface* collator) final {} diff --git a/src/mongo/db/update/modifier_node.h b/src/mongo/db/update/modifier_node.h index 4649cbc03aa..4c26735400d 100644 --- a/src/mongo/db/update/modifier_node.h +++ b/src/mongo/db/update/modifier_node.h @@ -30,13 +30,13 @@ #pragma once #include <map> +#include <memory> #include <string> #include <utility> #include <vector> #include "mongo/base/string_data.h" #include "mongo/db/update/update_leaf_node.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/db/update/modifier_table.cpp b/src/mongo/db/update/modifier_table.cpp index e46a7fb2de4..ed054989547 100644 --- a/src/mongo/db/update/modifier_table.cpp +++ b/src/mongo/db/update/modifier_table.cpp @@ -29,6 +29,7 @@ #include "mongo/db/update/modifier_table.h" +#include <memory> #include <string> #include <utility> @@ -48,7 +49,6 @@ #include "mongo/db/update/rename_node.h" #include "mongo/db/update/set_node.h" #include "mongo/db/update/unset_node.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -138,37 +138,37 @@ ModifierType getType(StringData typeStr) { std::unique_ptr<UpdateLeafNode> makeUpdateLeafNode(ModifierType modType) { switch (modType) { case MOD_ADD_TO_SET: - return stdx::make_unique<AddToSetNode>(); + return std::make_unique<AddToSetNode>(); case MOD_BIT: - return stdx::make_unique<BitNode>(); + return std::make_unique<BitNode>(); case MOD_CONFLICT_PLACEHOLDER: - return stdx::make_unique<ConflictPlaceholderNode>(); + return std::make_unique<ConflictPlaceholderNode>(); case MOD_CURRENTDATE: - return stdx::make_unique<CurrentDateNode>(); + return std::make_unique<CurrentDateNode>(); case MOD_INC: - return stdx::make_unique<ArithmeticNode>(ArithmeticNode::ArithmeticOp::kAdd); + return std::make_unique<ArithmeticNode>(ArithmeticNode::ArithmeticOp::kAdd); case MOD_MAX: - return stdx::make_unique<CompareNode>(CompareNode::CompareMode::kMax); + return std::make_unique<CompareNode>(CompareNode::CompareMode::kMax); case MOD_MIN: - return stdx::make_unique<CompareNode>(CompareNode::CompareMode::kMin); + return std::make_unique<CompareNode>(CompareNode::CompareMode::kMin); case MOD_MUL: - return stdx::make_unique<ArithmeticNode>(ArithmeticNode::ArithmeticOp::kMultiply); + return std::make_unique<ArithmeticNode>(ArithmeticNode::ArithmeticOp::kMultiply); case MOD_POP: - return stdx::make_unique<PopNode>(); + return std::make_unique<PopNode>(); case MOD_PULL: - return stdx::make_unique<PullNode>(); + return std::make_unique<PullNode>(); case MOD_PULL_ALL: - return stdx::make_unique<PullAllNode>(); + return std::make_unique<PullAllNode>(); case MOD_PUSH: - return stdx::make_unique<PushNode>(); + return std::make_unique<PushNode>(); case MOD_RENAME: - return stdx::make_unique<RenameNode>(); + return std::make_unique<RenameNode>(); case MOD_SET: - return stdx::make_unique<SetNode>(); + return std::make_unique<SetNode>(); case MOD_SET_ON_INSERT: - return stdx::make_unique<SetNode>(UpdateNode::Context::kInsertOnly); + return std::make_unique<SetNode>(UpdateNode::Context::kInsertOnly); case MOD_UNSET: - return stdx::make_unique<UnsetNode>(); + return std::make_unique<UnsetNode>(); default: return nullptr; } diff --git a/src/mongo/db/update/object_replace_executor.h b/src/mongo/db/update/object_replace_executor.h index f141f169d6f..c2b38154560 100644 --- a/src/mongo/db/update/object_replace_executor.h +++ b/src/mongo/db/update/object_replace_executor.h @@ -30,12 +30,12 @@ #pragma once #include <map> +#include <memory> #include <string> #include <utility> #include <vector> #include "mongo/db/update/update_executor.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/db/update/path_support_test.cpp b/src/mongo/db/update/path_support_test.cpp index 78f721e558d..b9c3c0685a8 100644 --- a/src/mongo/db/update/path_support_test.cpp +++ b/src/mongo/db/update/path_support_test.cpp @@ -50,7 +50,6 @@ #include "mongo/db/matcher/expression_leaf.h" #include "mongo/db/matcher/expression_parser.h" #include "mongo/db/pipeline/expression_context_for_test.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/str.h" @@ -724,7 +723,7 @@ public: ImmutablePaths() {} void addPath(const string& path) { - _ownedPaths.push_back(stdx::make_unique<FieldRef>(path)); + _ownedPaths.push_back(std::make_unique<FieldRef>(path)); FieldRef const* conflictPath = NULL; ASSERT(_immutablePathSet.insert(_ownedPaths.back().get(), &conflictPath)); } diff --git a/src/mongo/db/update/pipeline_executor.h b/src/mongo/db/update/pipeline_executor.h index be8d4b6e0f5..e0b16b851c2 100644 --- a/src/mongo/db/update/pipeline_executor.h +++ b/src/mongo/db/update/pipeline_executor.h @@ -30,6 +30,7 @@ #pragma once #include <map> +#include <memory> #include <string> #include <utility> #include <vector> @@ -37,7 +38,6 @@ #include "mongo/db/pipeline/document_source.h" #include "mongo/db/pipeline/pipeline.h" #include "mongo/db/update/update_executor.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/db/update/pop_node.h b/src/mongo/db/update/pop_node.h index bf15cb2731a..e731a1956fb 100644 --- a/src/mongo/db/update/pop_node.h +++ b/src/mongo/db/update/pop_node.h @@ -29,9 +29,10 @@ #pragma once +#include <memory> + #include "mongo/base/string_data.h" #include "mongo/db/update/modifier_node.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -49,7 +50,7 @@ public: ModifyResult modifyResult) const final; std::unique_ptr<UpdateNode> clone() const final { - return stdx::make_unique<PopNode>(*this); + return std::make_unique<PopNode>(*this); } void setCollator(const CollatorInterface* collator) final {} diff --git a/src/mongo/db/update/pull_node.cpp b/src/mongo/db/update/pull_node.cpp index 46678b9a43c..def1a621402 100644 --- a/src/mongo/db/update/pull_node.cpp +++ b/src/mongo/db/update/pull_node.cpp @@ -45,11 +45,11 @@ public: ObjectMatcher(BSONObj matchCondition, const boost::intrusive_ptr<ExpressionContext>& expCtx) : _matchExpr(matchCondition, expCtx, - stdx::make_unique<ExtensionsCallbackNoop>(), + std::make_unique<ExtensionsCallbackNoop>(), MatchExpressionParser::kBanAllSpecialFeatures) {} std::unique_ptr<ElementMatcher> clone() const final { - return stdx::make_unique<ObjectMatcher>(*this); + return std::make_unique<ObjectMatcher>(*this); } bool match(const mutablebson::ConstElement& element) final { @@ -85,11 +85,11 @@ public: const boost::intrusive_ptr<ExpressionContext>& expCtx) : _matchExpr(matchCondition.wrap(""), expCtx, - stdx::make_unique<ExtensionsCallbackNoop>(), + std::make_unique<ExtensionsCallbackNoop>(), MatchExpressionParser::kBanAllSpecialFeatures) {} std::unique_ptr<ElementMatcher> clone() const final { - return stdx::make_unique<WrappedObjectMatcher>(*this); + return std::make_unique<WrappedObjectMatcher>(*this); } bool match(const mutablebson::ConstElement& element) final { @@ -119,7 +119,7 @@ public: : _modExpr(modExpr), _collator(collator) {} std::unique_ptr<ElementMatcher> clone() const final { - return stdx::make_unique<EqualityMatcher>(*this); + return std::make_unique<EqualityMatcher>(*this); } bool match(const mutablebson::ConstElement& element) final { @@ -146,11 +146,11 @@ Status PullNode::init(BSONElement modExpr, const boost::intrusive_ptr<Expression if (modExpr.type() == mongo::Object && !MatchExpressionParser::parsePathAcceptingKeyword( modExpr.embeddedObject().firstElement())) { - _matcher = stdx::make_unique<ObjectMatcher>(modExpr.embeddedObject(), expCtx); + _matcher = std::make_unique<ObjectMatcher>(modExpr.embeddedObject(), expCtx); } else if (modExpr.type() == mongo::Object || modExpr.type() == mongo::RegEx) { - _matcher = stdx::make_unique<WrappedObjectMatcher>(modExpr, expCtx); + _matcher = std::make_unique<WrappedObjectMatcher>(modExpr, expCtx); } else { - _matcher = stdx::make_unique<EqualityMatcher>(modExpr, expCtx->getCollator()); + _matcher = std::make_unique<EqualityMatcher>(modExpr, expCtx->getCollator()); } } catch (AssertionException& exception) { return exception.toStatus(); diff --git a/src/mongo/db/update/pull_node.h b/src/mongo/db/update/pull_node.h index 71ecf81bae7..63fe5791fab 100644 --- a/src/mongo/db/update/pull_node.h +++ b/src/mongo/db/update/pull_node.h @@ -29,9 +29,10 @@ #pragma once +#include <memory> + #include "mongo/base/string_data.h" #include "mongo/db/update/array_culling_node.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -47,7 +48,7 @@ public: Status init(BSONElement modExpr, const boost::intrusive_ptr<ExpressionContext>& expCtx) final; std::unique_ptr<UpdateNode> clone() const final { - return stdx::make_unique<PullNode>(*this); + return std::make_unique<PullNode>(*this); } void acceptVisitor(UpdateNodeVisitor* visitor) final { diff --git a/src/mongo/db/update/pullall_node.cpp b/src/mongo/db/update/pullall_node.cpp index c082823657c..e4c0936fa83 100644 --- a/src/mongo/db/update/pullall_node.cpp +++ b/src/mongo/db/update/pullall_node.cpp @@ -42,7 +42,7 @@ public: : _elementsToMatch(std::move(elementsToMatch)), _collator(collator) {} std::unique_ptr<ElementMatcher> clone() const final { - return stdx::make_unique<SetMatcher>(*this); + return std::make_unique<SetMatcher>(*this); } bool match(const mutablebson::ConstElement& element) final { @@ -83,7 +83,7 @@ Status PullAllNode::init(BSONElement modExpr, << typeName(modExpr.type())); } - _matcher = stdx::make_unique<SetMatcher>(modExpr.Array(), expCtx->getCollator()); + _matcher = std::make_unique<SetMatcher>(modExpr.Array(), expCtx->getCollator()); return Status::OK(); } diff --git a/src/mongo/db/update/pullall_node.h b/src/mongo/db/update/pullall_node.h index e529123e5ef..432c143ee52 100644 --- a/src/mongo/db/update/pullall_node.h +++ b/src/mongo/db/update/pullall_node.h @@ -29,9 +29,10 @@ #pragma once +#include <memory> + #include "mongo/base/string_data.h" #include "mongo/db/update/array_culling_node.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -47,7 +48,7 @@ public: Status init(BSONElement modExpr, const boost::intrusive_ptr<ExpressionContext>& expCtx) final; std::unique_ptr<UpdateNode> clone() const final { - return stdx::make_unique<PullAllNode>(*this); + return std::make_unique<PullAllNode>(*this); } void acceptVisitor(UpdateNodeVisitor* visitor) final { diff --git a/src/mongo/db/update/push_node.h b/src/mongo/db/update/push_node.h index beab21950cc..33677ae6652 100644 --- a/src/mongo/db/update/push_node.h +++ b/src/mongo/db/update/push_node.h @@ -31,12 +31,12 @@ #include <boost/optional.hpp> #include <limits> +#include <memory> #include <vector> #include "mongo/base/string_data.h" #include "mongo/db/update/modifier_node.h" #include "mongo/db/update/push_sorter.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -45,7 +45,7 @@ public: Status init(BSONElement modExpr, const boost::intrusive_ptr<ExpressionContext>& expCtx) final; std::unique_ptr<UpdateNode> clone() const final { - return stdx::make_unique<PushNode>(*this); + return std::make_unique<PushNode>(*this); } void setCollator(const CollatorInterface* collator) final { diff --git a/src/mongo/db/update/rename_node.cpp b/src/mongo/db/update/rename_node.cpp index 4177a5f446d..bdf968664d0 100644 --- a/src/mongo/db/update/rename_node.cpp +++ b/src/mongo/db/update/rename_node.cpp @@ -59,7 +59,7 @@ public: SetElementNode(mutablebson::Element elemToSet) : _elemToSet(elemToSet) {} std::unique_ptr<UpdateNode> clone() const final { - return stdx::make_unique<SetElementNode>(*this); + return std::make_unique<SetElementNode>(*this); } void setCollator(const CollatorInterface* collator) final {} diff --git a/src/mongo/db/update/rename_node.h b/src/mongo/db/update/rename_node.h index 5dd23287e8d..668f42d5125 100644 --- a/src/mongo/db/update/rename_node.h +++ b/src/mongo/db/update/rename_node.h @@ -30,12 +30,12 @@ #pragma once #include <map> +#include <memory> #include <string> #include <utility> #include <vector> #include "mongo/db/update/update_leaf_node.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -52,7 +52,7 @@ public: Status init(BSONElement modExpr, const boost::intrusive_ptr<ExpressionContext>& expCtx) final; std::unique_ptr<UpdateNode> clone() const final { - return stdx::make_unique<RenameNode>(*this); + return std::make_unique<RenameNode>(*this); } void setCollator(const CollatorInterface* collator) final {} diff --git a/src/mongo/db/update/set_node.h b/src/mongo/db/update/set_node.h index f16c752f84d..4261f3e736b 100644 --- a/src/mongo/db/update/set_node.h +++ b/src/mongo/db/update/set_node.h @@ -29,9 +29,10 @@ #pragma once +#include <memory> + #include "mongo/base/string_data.h" #include "mongo/db/update/modifier_node.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -45,7 +46,7 @@ public: Status init(BSONElement modExpr, const boost::intrusive_ptr<ExpressionContext>& expCtx) final; std::unique_ptr<UpdateNode> clone() const final { - return stdx::make_unique<SetNode>(*this); + return std::make_unique<SetNode>(*this); } void setCollator(const CollatorInterface* collator) final {} diff --git a/src/mongo/db/update/unset_node.h b/src/mongo/db/update/unset_node.h index 7a773a821aa..8fc466fef4f 100644 --- a/src/mongo/db/update/unset_node.h +++ b/src/mongo/db/update/unset_node.h @@ -29,9 +29,10 @@ #pragma once +#include <memory> + #include "mongo/base/string_data.h" #include "mongo/db/update/modifier_node.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -43,7 +44,7 @@ public: Status init(BSONElement modExpr, const boost::intrusive_ptr<ExpressionContext>& expCtx) final; std::unique_ptr<UpdateNode> clone() const final { - return stdx::make_unique<UnsetNode>(*this); + return std::make_unique<UnsetNode>(*this); } void setCollator(const CollatorInterface* collator) final {} diff --git a/src/mongo/db/update/update_array_node.cpp b/src/mongo/db/update/update_array_node.cpp index ab062760d62..53a4070e0ed 100644 --- a/src/mongo/db/update/update_array_node.cpp +++ b/src/mongo/db/update/update_array_node.cpp @@ -38,7 +38,7 @@ std::unique_ptr<UpdateNode> UpdateArrayNode::createUpdateNodeByMerging( const UpdateArrayNode& leftNode, const UpdateArrayNode& rightNode, FieldRef* pathTaken) { invariant(&leftNode._arrayFilters == &rightNode._arrayFilters); - auto mergedNode = stdx::make_unique<UpdateArrayNode>(leftNode._arrayFilters); + auto mergedNode = std::make_unique<UpdateArrayNode>(leftNode._arrayFilters); const bool wrapFieldNameAsArrayFilterIdentifier = true; mergedNode->_children = createUpdateNodeMapByMerging( diff --git a/src/mongo/db/update/update_array_node.h b/src/mongo/db/update/update_array_node.h index 0c0ec5550d8..7d942698953 100644 --- a/src/mongo/db/update/update_array_node.h +++ b/src/mongo/db/update/update_array_node.h @@ -30,6 +30,7 @@ #pragma once #include <map> +#include <memory> #include <string> #include <utility> #include <vector> @@ -37,7 +38,6 @@ #include "mongo/base/clonable_ptr.h" #include "mongo/db/matcher/expression_with_placeholder.h" #include "mongo/db/update/update_internal_node.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -66,7 +66,7 @@ public: : UpdateInternalNode(Type::Array), _arrayFilters(arrayFilters) {} std::unique_ptr<UpdateNode> clone() const final { - return stdx::make_unique<UpdateArrayNode>(*this); + return std::make_unique<UpdateArrayNode>(*this); } void setCollator(const CollatorInterface* collator) final { diff --git a/src/mongo/db/update/update_driver.cpp b/src/mongo/db/update/update_driver.cpp index 3f2024dba1c..4cd79d7b1cf 100644 --- a/src/mongo/db/update/update_driver.cpp +++ b/src/mongo/db/update/update_driver.cpp @@ -159,7 +159,7 @@ void UpdateDriver::parse( "arrayFilters may not be specified for pipeline-syle updates", arrayFilters.empty()); _updateExecutor = - stdx::make_unique<PipelineExecutor>(_expCtx, updateMod.getUpdatePipeline(), constants); + std::make_unique<PipelineExecutor>(_expCtx, updateMod.getUpdatePipeline(), constants); _updateType = UpdateType::kPipeline; return; } @@ -172,7 +172,7 @@ void UpdateDriver::parse( "multi update is not supported for replacement-style update", !multi); - _updateExecutor = stdx::make_unique<ObjectReplaceExecutor>(updateMod.getUpdateClassic()); + _updateExecutor = std::make_unique<ObjectReplaceExecutor>(updateMod.getUpdateClassic()); // Register the fact that this driver will only do full object replacements. _updateType = UpdateType::kReplacement; @@ -195,9 +195,9 @@ void UpdateDriver::parse( uassertStatusOK(updateSemanticsFromElement(updateSemanticsElement)); } - auto root = stdx::make_unique<UpdateObjectNode>(); + auto root = std::make_unique<UpdateObjectNode>(); _positional = parseUpdateExpression(updateExpr, root.get(), _expCtx, arrayFilters); - _updateExecutor = stdx::make_unique<UpdateTreeExecutor>(std::move(root)); + _updateExecutor = std::make_unique<UpdateTreeExecutor>(std::move(root)); } Status UpdateDriver::populateDocumentWithQueryFields(OperationContext* opCtx, @@ -207,7 +207,7 @@ Status UpdateDriver::populateDocumentWithQueryFields(OperationContext* opCtx, // We canonicalize the query to collapse $and/$or, and the namespace is not needed. Also, // because this is for the upsert case, where we insert a new document if one was not found, the // $where/$text clauses do not make sense, hence empty ExtensionsCallback. - auto qr = stdx::make_unique<QueryRequest>(NamespaceString("")); + auto qr = std::make_unique<QueryRequest>(NamespaceString("")); qr->setFilter(query); const boost::intrusive_ptr<ExpressionContext> expCtx; // $expr is not allowed in the query for an upsert, since it is not clear what the equality diff --git a/src/mongo/db/update/update_node_test_fixture.h b/src/mongo/db/update/update_node_test_fixture.h index 73953167ffc..e0b448fd9e4 100644 --- a/src/mongo/db/update/update_node_test_fixture.h +++ b/src/mongo/db/update/update_node_test_fixture.h @@ -47,7 +47,7 @@ protected: // Set up the logical clock needed by CurrentDateNode and ObjectReplaceExecutor. auto service = mongo::getGlobalServiceContext(); - auto logicalClock = mongo::stdx::make_unique<mongo::LogicalClock>(service); + auto logicalClock = std::make_unique<mongo::LogicalClock>(service); mongo::LogicalClock::set(service, std::move(logicalClock)); } @@ -62,7 +62,7 @@ protected: _validateForStorage = true; _indexData.reset(); _logDoc.reset(); - _logBuilder = stdx::make_unique<LogBuilder>(_logDoc.root()); + _logBuilder = std::make_unique<LogBuilder>(_logDoc.root()); _modifiedPaths.clear(); } @@ -86,7 +86,7 @@ protected: } void addImmutablePath(StringData path) { - auto fieldRef = stdx::make_unique<FieldRef>(path); + auto fieldRef = std::make_unique<FieldRef>(path); _immutablePathsVector.push_back(std::move(fieldRef)); _immutablePaths.insert(_immutablePathsVector.back().get()); } @@ -119,7 +119,7 @@ protected: void addIndexedPath(StringData path) { if (!_indexData) { - _indexData = stdx::make_unique<UpdateIndexData>(); + _indexData = std::make_unique<UpdateIndexData>(); } _indexData->addPath(FieldRef(path)); } diff --git a/src/mongo/db/update/update_object_node.cpp b/src/mongo/db/update/update_object_node.cpp index 3ca3a85f797..6298b8389c5 100644 --- a/src/mongo/db/update/update_object_node.cpp +++ b/src/mongo/db/update/update_object_node.cpp @@ -31,12 +31,13 @@ #include "mongo/db/update/update_object_node.h" +#include <memory> + #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/update/field_checker.h" #include "mongo/db/update/modifier_table.h" #include "mongo/db/update/update_array_node.h" #include "mongo/db/update/update_leaf_node.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { @@ -303,9 +304,9 @@ StatusWith<bool> UpdateObjectNode::parseAndMerge( } else { std::unique_ptr<UpdateInternalNode> ownedChild; if (childShouldBeArrayNode) { - ownedChild = stdx::make_unique<UpdateArrayNode>(arrayFilters); + ownedChild = std::make_unique<UpdateArrayNode>(arrayFilters); } else { - ownedChild = stdx::make_unique<UpdateObjectNode>(); + ownedChild = std::make_unique<UpdateObjectNode>(); } child = ownedChild.get(); current->setChild(std::move(childName), std::move(ownedChild)); @@ -347,7 +348,7 @@ StatusWith<bool> UpdateObjectNode::parseAndMerge( // static std::unique_ptr<UpdateNode> UpdateObjectNode::createUpdateNodeByMerging( const UpdateObjectNode& leftNode, const UpdateObjectNode& rightNode, FieldRef* pathTaken) { - auto mergedNode = stdx::make_unique<UpdateObjectNode>(); + auto mergedNode = std::make_unique<UpdateObjectNode>(); mergedNode->_children = createUpdateNodeMapByMerging(leftNode._children, rightNode._children, pathTaken); diff --git a/src/mongo/db/update/update_object_node.h b/src/mongo/db/update/update_object_node.h index 5cbae91f1a5..6f9bed7357a 100644 --- a/src/mongo/db/update/update_object_node.h +++ b/src/mongo/db/update/update_object_node.h @@ -30,6 +30,7 @@ #pragma once #include <map> +#include <memory> #include <string> #include <utility> #include <vector> @@ -39,7 +40,6 @@ #include "mongo/db/matcher/expression_with_placeholder.h" #include "mongo/db/update/modifier_table.h" #include "mongo/db/update/update_internal_node.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/unordered_map.h" namespace mongo { @@ -82,7 +82,7 @@ public: UpdateObjectNode() : UpdateInternalNode(Type::Object) {} std::unique_ptr<UpdateNode> clone() const final { - return stdx::make_unique<UpdateObjectNode>(*this); + return std::make_unique<UpdateObjectNode>(*this); } void setCollator(const CollatorInterface* collator) final { diff --git a/src/mongo/db/views/view_catalog_test.cpp b/src/mongo/db/views/view_catalog_test.cpp index b9c82fc1a36..8ad236b37df 100644 --- a/src/mongo/db/views/view_catalog_test.cpp +++ b/src/mongo/db/views/view_catalog_test.cpp @@ -51,7 +51,6 @@ #include "mongo/db/views/view.h" #include "mongo/db/views/view_catalog.h" #include "mongo/db/views/view_graph.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/str.h" @@ -109,7 +108,7 @@ const std::string DurableViewCatalogDummy::name = "dummy"; class ViewCatalogFixture : public unittest::Test { public: ViewCatalogFixture() - : _queryServiceContext(stdx::make_unique<QueryTestServiceContext>()), + : _queryServiceContext(std::make_unique<QueryTestServiceContext>()), opCtx(_queryServiceContext->makeOperationContext()), viewCatalog(std::move(durableViewCatalogUnique)) {} @@ -140,8 +139,8 @@ public: settings.setReplSetString("viewCatalogTestSet/node1:12345"); - repl::StorageInterface::set(service, stdx::make_unique<repl::StorageInterfaceMock>()); - auto replCoord = stdx::make_unique<repl::ReplicationCoordinatorMock>(service, settings); + repl::StorageInterface::set(service, std::make_unique<repl::StorageInterfaceMock>()); + auto replCoord = std::make_unique<repl::ReplicationCoordinatorMock>(service, settings); // Ensure that we are primary. ASSERT_OK(replCoord->setFollowerMode(repl::MemberState::RS_PRIMARY)); diff --git a/src/mongo/db/views/view_definition_test.cpp b/src/mongo/db/views/view_definition_test.cpp index a2aa0ed2536..67bb1dec78b 100644 --- a/src/mongo/db/views/view_definition_test.cpp +++ b/src/mongo/db/views/view_definition_test.cpp @@ -38,7 +38,6 @@ #include "mongo/db/namespace_string.h" #include "mongo/db/query/collation/collator_interface_mock.h" #include "mongo/db/views/view.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" @@ -58,7 +57,7 @@ TEST(ViewDefinitionTest, ViewDefinitionCreationCorrectlyBuildsNamespaceStrings) TEST(ViewDefinitionTest, CopyConstructorProperlyClonesAllFields) { auto collator = - stdx::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kReverseString); + std::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kReverseString); ViewDefinition originalView( viewNss.db(), viewNss.coll(), backingNss.coll(), samplePipeline, std::move(collator)); ViewDefinition copiedView(originalView); @@ -75,7 +74,7 @@ TEST(ViewDefinitionTest, CopyConstructorProperlyClonesAllFields) { TEST(ViewDefinitionTest, CopyAssignmentOperatorProperlyClonesAllFields) { auto collator = - stdx::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kReverseString); + std::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kReverseString); ViewDefinition originalView( viewNss.db(), viewNss.coll(), backingNss.coll(), samplePipeline, std::move(collator)); ViewDefinition copiedView = originalView; diff --git a/src/mongo/db/views/view_graph_test.cpp b/src/mongo/db/views/view_graph_test.cpp index 8d20a30fd53..5ace80ef15a 100644 --- a/src/mongo/db/views/view_graph_test.cpp +++ b/src/mongo/db/views/view_graph_test.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/bson/bsonmisc.h" #include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonobjbuilder.h" @@ -38,7 +40,6 @@ #include "mongo/db/query/query_test_service_context.h" #include "mongo/db/views/view.h" #include "mongo/db/views/view_graph.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { 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) diff --git a/src/mongo/embedded/embedded.cpp b/src/mongo/embedded/embedded.cpp index db941660254..d63202c95b4 100644 --- a/src/mongo/embedded/embedded.cpp +++ b/src/mongo/embedded/embedded.cpp @@ -115,7 +115,7 @@ ServiceContext::ConstructorActionRegisterer replicationManagerInitializer( [](ServiceContext* serviceContext) { repl::StorageInterface::set(serviceContext, std::make_unique<repl::StorageInterfaceImpl>()); - auto logicalClock = stdx::make_unique<LogicalClock>(serviceContext); + auto logicalClock = std::make_unique<LogicalClock>(serviceContext); LogicalClock::set(serviceContext, std::move(logicalClock)); auto replCoord = std::make_unique<ReplicationCoordinatorEmbedded>(serviceContext); @@ -313,7 +313,7 @@ ServiceContext* initialize(const char* yaml_config) { // Set up the logical session cache LogicalSessionCache::set(serviceContext, - stdx::make_unique<LogicalSessionCacheImpl>( + std::make_unique<LogicalSessionCacheImpl>( std::make_unique<ServiceLiaisonMongod>(), std::make_shared<SessionsCollectionStandalone>(), [](OperationContext*, SessionsCollection&, Date_t) { diff --git a/src/mongo/embedded/mongoc_embedded/mongoc_embedded_test.cpp b/src/mongo/embedded/mongoc_embedded/mongoc_embedded_test.cpp index c6c5c65c8a8..2138c420e2d 100644 --- a/src/mongo/embedded/mongoc_embedded/mongoc_embedded_test.cpp +++ b/src/mongo/embedded/mongoc_embedded/mongoc_embedded_test.cpp @@ -33,6 +33,7 @@ #include "mongoc_embedded/mongoc_embedded.h" +#include <memory> #include <set> #include <mongoc/mongoc.h> @@ -42,7 +43,6 @@ #include "mongo/db/server_options.h" #include "mongo/embedded/mongo_embedded/mongo_embedded.h" #include "mongo/embedded/mongoc_embedded/mongoc_embedded_test_gen.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/temp_dir.h" #include "mongo/unittest/unittest.h" #include "mongo/util/log.h" diff --git a/src/mongo/executor/async_timer_mock.cpp b/src/mongo/executor/async_timer_mock.cpp index 0ba1712a189..6a796b684e7 100644 --- a/src/mongo/executor/async_timer_mock.cpp +++ b/src/mongo/executor/async_timer_mock.cpp @@ -29,8 +29,9 @@ #include "mongo/executor/async_timer_mock.h" +#include <memory> + #include "mongo/base/system_error.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace executor { @@ -135,7 +136,7 @@ void AsyncTimerMock::expireAfter(Milliseconds expiration) { std::unique_ptr<AsyncTimerInterface> AsyncTimerFactoryMock::make(Milliseconds expiration) { stdx::lock_guard<stdx::recursive_mutex> lk(_timersMutex); auto elem = _timers.emplace(std::make_shared<AsyncTimerMockImpl>(expiration)); - return stdx::make_unique<AsyncTimerMock>(*elem.first); + return std::make_unique<AsyncTimerMock>(*elem.first); } void AsyncTimerFactoryMock::fastForward(Milliseconds time) { diff --git a/src/mongo/executor/connection_pool_test.cpp b/src/mongo/executor/connection_pool_test.cpp index c2220cd95f6..e839371dbcd 100644 --- a/src/mongo/executor/connection_pool_test.cpp +++ b/src/mongo/executor/connection_pool_test.cpp @@ -29,16 +29,16 @@ #include "mongo/platform/basic.h" +#include "mongo/executor/connection_pool_test_fixture.h" + #include <algorithm> +#include <memory> #include <random> #include <stack> #include <tuple> -#include "mongo/executor/connection_pool_test_fixture.h" - #include "mongo/executor/connection_pool.h" #include "mongo/stdx/future.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/scopeguard.h" diff --git a/src/mongo/executor/connection_pool_test_fixture.cpp b/src/mongo/executor/connection_pool_test_fixture.cpp index 1f6217c6ef3..dd8f4012388 100644 --- a/src/mongo/executor/connection_pool_test_fixture.cpp +++ b/src/mongo/executor/connection_pool_test_fixture.cpp @@ -31,7 +31,8 @@ #include "mongo/executor/connection_pool_test_fixture.h" -#include "mongo/stdx/memory.h" +#include <memory> + namespace mongo { namespace executor { @@ -226,7 +227,7 @@ std::shared_ptr<ConnectionPool::ConnectionInterface> PoolImpl::makeConnection( } std::shared_ptr<ConnectionPool::TimerInterface> PoolImpl::makeTimer() { - return stdx::make_unique<TimerImpl>(this); + return std::make_unique<TimerImpl>(this); } const std::shared_ptr<OutOfLineExecutor>& PoolImpl::getExecutor() { diff --git a/src/mongo/executor/network_interface_factory.cpp b/src/mongo/executor/network_interface_factory.cpp index 31482720c9f..0489d9adde0 100644 --- a/src/mongo/executor/network_interface_factory.cpp +++ b/src/mongo/executor/network_interface_factory.cpp @@ -31,6 +31,8 @@ #include "mongo/executor/network_interface_factory.h" +#include <memory> + #include "mongo/base/init.h" #include "mongo/base/status.h" #include "mongo/config.h" @@ -38,7 +40,6 @@ #include "mongo/executor/network_connection_hook.h" #include "mongo/executor/network_interface_tl.h" #include "mongo/rpc/metadata/metadata_hook.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace executor { diff --git a/src/mongo/executor/network_interface_integration_fixture.cpp b/src/mongo/executor/network_interface_integration_fixture.cpp index 2729326442a..ad2e31fdb03 100644 --- a/src/mongo/executor/network_interface_integration_fixture.cpp +++ b/src/mongo/executor/network_interface_integration_fixture.cpp @@ -31,6 +31,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/client/connection_string.h" #include "mongo/executor/network_interface_factory.h" #include "mongo/executor/network_interface_integration_fixture.h" @@ -38,7 +40,6 @@ #include "mongo/executor/task_executor.h" #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/stdx/future.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/integration_test.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" diff --git a/src/mongo/executor/network_interface_integration_test.cpp b/src/mongo/executor/network_interface_integration_test.cpp index 57371e05545..163415c923c 100644 --- a/src/mongo/executor/network_interface_integration_test.cpp +++ b/src/mongo/executor/network_interface_integration_test.cpp @@ -33,6 +33,7 @@ #include <algorithm> #include <exception> +#include <memory> #include "mongo/base/status_with.h" #include "mongo/client/connection_string.h" @@ -45,7 +46,6 @@ #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/rpc/message.h" #include "mongo/stdx/future.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/integration_test.h" #include "mongo/unittest/unittest.h" #include "mongo/util/assert_util.h" @@ -106,7 +106,7 @@ class HangingHook : public executor::NetworkConnectionHook { // Test that we time out a command if the connection hook hangs. TEST_F(NetworkInterfaceIntegrationFixture, HookHangs) { - startNet(stdx::make_unique<HangingHook>()); + startNet(std::make_unique<HangingHook>()); /** * Since mongos's have no ping command, we effectively skip this test by returning diff --git a/src/mongo/executor/network_interface_mock_test.cpp b/src/mongo/executor/network_interface_mock_test.cpp index d31244d368c..d0575679cdd 100644 --- a/src/mongo/executor/network_interface_mock_test.cpp +++ b/src/mongo/executor/network_interface_mock_test.cpp @@ -39,7 +39,6 @@ #include "mongo/executor/network_interface_mock.h" #include "mongo/executor/test_network_connection_hook.h" #include "mongo/executor/thread_pool_mock.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { diff --git a/src/mongo/executor/network_interface_perf_test.cpp b/src/mongo/executor/network_interface_perf_test.cpp index 29eb7ebb84c..205caa22a2a 100644 --- a/src/mongo/executor/network_interface_perf_test.cpp +++ b/src/mongo/executor/network_interface_perf_test.cpp @@ -32,6 +32,7 @@ #include "mongo/platform/basic.h" #include <exception> +#include <memory> #include "mongo/base/status_with.h" #include "mongo/bson/bsonmisc.h" @@ -42,7 +43,6 @@ #include "mongo/executor/network_interface_asio.h" #include "mongo/executor/network_interface_asio_test_utils.h" #include "mongo/executor/task_executor.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/integration_test.h" #include "mongo/unittest/unittest.h" #include "mongo/util/assert_util.h" @@ -101,8 +101,8 @@ int timeNetworkTestMillis(std::size_t operations, NetworkInterface* net) { TEST(NetworkInterfaceASIO, SerialPerf) { NetworkInterfaceASIO::Options options{}; - options.streamFactory = stdx::make_unique<AsyncStreamFactory>(); - options.timerFactory = stdx::make_unique<AsyncTimerFactoryASIO>(); + options.streamFactory = std::make_unique<AsyncStreamFactory>(); + options.timerFactory = std::make_unique<AsyncTimerFactoryASIO>(); NetworkInterfaceASIO netAsio{std::move(options)}; int duration = timeNetworkTestMillis(numOperations, &netAsio); diff --git a/src/mongo/executor/network_interface_thread_pool_test.cpp b/src/mongo/executor/network_interface_thread_pool_test.cpp index 1f5fef066ab..a166ff5153f 100644 --- a/src/mongo/executor/network_interface_thread_pool_test.cpp +++ b/src/mongo/executor/network_interface_thread_pool_test.cpp @@ -31,11 +31,12 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/base/init.h" #include "mongo/executor/async_timer_mock.h" #include "mongo/executor/network_interface_asio.h" #include "mongo/executor/network_interface_thread_pool.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/concurrency/thread_pool_test_common.h" #include "mongo/util/concurrency/thread_pool_test_fixture.h" @@ -47,9 +48,9 @@ class NetworkInterfaceThreadPoolWithASIO : public ThreadPoolInterface { public: NetworkInterfaceThreadPoolWithASIO() { executor::NetworkInterfaceASIO::Options options; - options.timerFactory = stdx::make_unique<executor::AsyncTimerFactoryMock>(); - _asio = stdx::make_unique<executor::NetworkInterfaceASIO>(std::move(options)); - _pool = stdx::make_unique<executor::NetworkInterfaceThreadPool>(_asio.get()); + options.timerFactory = std::make_unique<executor::AsyncTimerFactoryMock>(); + _asio = std::make_unique<executor::NetworkInterfaceASIO>(std::move(options)); + _pool = std::make_unique<executor::NetworkInterfaceThreadPool>(_asio.get()); _asio->startup(); } @@ -80,7 +81,7 @@ private: MONGO_INITIALIZER(ThreadPoolCommonTests)(InitializerContext*) { addTestsForThreadPool("ThreadPoolCommon", - []() { return stdx::make_unique<NetworkInterfaceThreadPoolWithASIO>(); }); + []() { return std::make_unique<NetworkInterfaceThreadPoolWithASIO>(); }); return Status::OK(); } diff --git a/src/mongo/executor/task_executor.h b/src/mongo/executor/task_executor.h index 92aad54a22a..2cceb303a56 100644 --- a/src/mongo/executor/task_executor.h +++ b/src/mongo/executor/task_executor.h @@ -30,6 +30,7 @@ #pragma once #include <functional> +#include <functional> #include <memory> #include <string> diff --git a/src/mongo/executor/task_executor_test_common.cpp b/src/mongo/executor/task_executor_test_common.cpp index cd38281d267..02cc4367bba 100644 --- a/src/mongo/executor/task_executor_test_common.cpp +++ b/src/mongo/executor/task_executor_test_common.cpp @@ -40,7 +40,6 @@ #include "mongo/executor/network_interface_mock.h" #include "mongo/executor/task_executor.h" #include "mongo/executor/task_executor_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/stdx/unordered_map.h" #include "mongo/unittest/unittest.h" @@ -93,20 +92,20 @@ public: } }; -#define COMMON_EXECUTOR_TEST(TEST_NAME) \ - class CET_##TEST_NAME : public CommonTaskExecutorTestFixture { \ - public: \ - CET_##TEST_NAME(ExecutorFactory makeExecutor) \ - : CommonTaskExecutorTestFixture(std::move(makeExecutor)) {} \ - \ - private: \ - void _doTest() override; \ - static const CetRegistrationAgent _agent; \ - }; \ - const CetRegistrationAgent CET_##TEST_NAME::_agent( \ - #TEST_NAME, [](ExecutorFactory makeExecutor) { \ - return stdx::make_unique<CET_##TEST_NAME>(std::move(makeExecutor)); \ - }); \ +#define COMMON_EXECUTOR_TEST(TEST_NAME) \ + class CET_##TEST_NAME : public CommonTaskExecutorTestFixture { \ + public: \ + CET_##TEST_NAME(ExecutorFactory makeExecutor) \ + : CommonTaskExecutorTestFixture(std::move(makeExecutor)) {} \ + \ + private: \ + void _doTest() override; \ + static const CetRegistrationAgent _agent; \ + }; \ + const CetRegistrationAgent CET_##TEST_NAME::_agent( \ + #TEST_NAME, [](ExecutorFactory makeExecutor) { \ + return std::make_unique<CET_##TEST_NAME>(std::move(makeExecutor)); \ + }); \ void CET_##TEST_NAME::_doTest() auto makeSetStatusClosure(Status* target) { @@ -336,7 +335,7 @@ COMMON_EXECUTOR_TEST(EventWaitingWithTimeoutTest) { auto serviceContext = ServiceContext::make(); - serviceContext->setFastClockSource(stdx::make_unique<ClockSourceMock>()); + serviceContext->setFastClockSource(std::make_unique<ClockSourceMock>()); auto mockClock = static_cast<ClockSourceMock*>(serviceContext->getFastClockSource()); auto client = serviceContext->makeClient("for testing"); @@ -358,7 +357,7 @@ COMMON_EXECUTOR_TEST(EventSignalWithTimeoutTest) { auto serviceContext = ServiceContext::make(); - serviceContext->setFastClockSource(stdx::make_unique<ClockSourceMock>()); + serviceContext->setFastClockSource(std::make_unique<ClockSourceMock>()); auto mockClock = static_cast<ClockSourceMock*>(serviceContext->getFastClockSource()); auto client = serviceContext->makeClient("for testing"); diff --git a/src/mongo/executor/task_executor_test_fixture.cpp b/src/mongo/executor/task_executor_test_fixture.cpp index b1286e600d3..085c9aef560 100644 --- a/src/mongo/executor/task_executor_test_fixture.cpp +++ b/src/mongo/executor/task_executor_test_fixture.cpp @@ -31,10 +31,11 @@ #include "mongo/executor/task_executor_test_fixture.h" +#include <memory> + #include "mongo/base/status.h" #include "mongo/executor/network_interface_mock.h" #include "mongo/executor/remote_command_request.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/str.h" @@ -61,7 +62,7 @@ RemoteCommandRequest TaskExecutorTest::assertRemoteCommandNameEquals( TaskExecutorTest::~TaskExecutorTest() = default; void TaskExecutorTest::setUp() { - auto net = stdx::make_unique<NetworkInterfaceMock>(); + auto net = std::make_unique<NetworkInterfaceMock>(); _net = net.get(); _executor = makeTaskExecutor(std::move(net)); } diff --git a/src/mongo/executor/test_network_connection_hook.h b/src/mongo/executor/test_network_connection_hook.h index d1cc11b8626..5a22ac24f54 100644 --- a/src/mongo/executor/test_network_connection_hook.h +++ b/src/mongo/executor/test_network_connection_hook.h @@ -32,7 +32,6 @@ #include "mongo/base/status_with.h" #include "mongo/executor/network_connection_hook.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace executor { @@ -80,9 +79,9 @@ template <typename Val, typename Req, typename Rep> std::unique_ptr<TestConnectionHook<Val, Req, Rep>> makeTestHook(Val&& validateFunc, Req&& requestFunc, Rep&& replyFunc) { - return stdx::make_unique<TestConnectionHook<Val, Req, Rep>>(std::forward<Val>(validateFunc), - std::forward<Req>(requestFunc), - std::forward<Rep>(replyFunc)); + return std::make_unique<TestConnectionHook<Val, Req, Rep>>(std::forward<Val>(validateFunc), + std::forward<Req>(requestFunc), + std::forward<Rep>(replyFunc)); } } // namespace executor diff --git a/src/mongo/executor/thread_pool_task_executor_test.cpp b/src/mongo/executor/thread_pool_task_executor_test.cpp index b487cc87a41..ed458e50a7c 100644 --- a/src/mongo/executor/thread_pool_task_executor_test.cpp +++ b/src/mongo/executor/thread_pool_task_executor_test.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/base/checked_cast.h" #include "mongo/base/init.h" #include "mongo/base/status.h" @@ -39,7 +41,6 @@ #include "mongo/executor/thread_pool_mock.h" #include "mongo/executor/thread_pool_task_executor.h" #include "mongo/executor/thread_pool_task_executor_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/barrier.h" #include "mongo/unittest/unittest.h" #include "mongo/util/fail_point_service.h" diff --git a/src/mongo/executor/thread_pool_task_executor_test_fixture.cpp b/src/mongo/executor/thread_pool_task_executor_test_fixture.cpp index ba35b1963e9..ce0efbda2da 100644 --- a/src/mongo/executor/thread_pool_task_executor_test_fixture.cpp +++ b/src/mongo/executor/thread_pool_task_executor_test_fixture.cpp @@ -31,8 +31,9 @@ #include "mongo/executor/thread_pool_task_executor_test_fixture.h" +#include <memory> + #include "mongo/executor/thread_pool_mock.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace executor { @@ -40,8 +41,8 @@ namespace executor { std::unique_ptr<ThreadPoolTaskExecutor> makeThreadPoolTestExecutor( std::unique_ptr<NetworkInterfaceMock> net, ThreadPoolMock::Options options) { auto netPtr = net.get(); - return stdx::make_unique<ThreadPoolTaskExecutor>( - stdx::make_unique<ThreadPoolMock>(netPtr, 1, std::move(options)), std::move(net)); + return std::make_unique<ThreadPoolTaskExecutor>( + std::make_unique<ThreadPoolMock>(netPtr, 1, std::move(options)), std::move(net)); } ThreadPoolExecutorTest::ThreadPoolExecutorTest() {} diff --git a/src/mongo/logger/logstream_builder.cpp b/src/mongo/logger/logstream_builder.cpp index d21b50e49e8..5b6115b4cfb 100644 --- a/src/mongo/logger/logstream_builder.cpp +++ b/src/mongo/logger/logstream_builder.cpp @@ -37,7 +37,6 @@ #include "mongo/base/status.h" #include "mongo/logger/message_event_utf8_encoder.h" #include "mongo/logger/tee.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" // TODO: remove apple dep for this in threadlocal.h #include "mongo/util/time_support.h" @@ -120,7 +119,7 @@ void LogstreamBuilder::makeStream() { if (_shouldCache && isThreadOstreamCacheInitialized && threadOstreamCache) { _os = std::move(threadOstreamCache); } else { - _os = stdx::make_unique<std::ostringstream>(); + _os = std::make_unique<std::ostringstream>(); } } } diff --git a/src/mongo/platform/decimal128_bson_test.cpp b/src/mongo/platform/decimal128_bson_test.cpp index 9cfbeca8bdb..fb2a2a702df 100644 --- a/src/mongo/platform/decimal128_bson_test.cpp +++ b/src/mongo/platform/decimal128_bson_test.cpp @@ -35,6 +35,7 @@ #include <array> #include <cmath> +#include <memory> #include <utility> #include "mongo/bson/bsonelement.h" @@ -43,7 +44,6 @@ #include "mongo/config.h" #include "mongo/db/json.h" #include "mongo/platform/decimal128.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/hex.h" #include "mongo/util/log.h" diff --git a/src/mongo/platform/decimal128_test.cpp b/src/mongo/platform/decimal128_test.cpp index dfce92f4fb8..1f0362e6a3a 100644 --- a/src/mongo/platform/decimal128_test.cpp +++ b/src/mongo/platform/decimal128_test.cpp @@ -31,11 +31,11 @@ #include <array> #include <cmath> +#include <memory> #include <string> #include <utility> #include "mongo/config.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -345,7 +345,7 @@ TEST(Decimal128Test, TestDecimal128ToInt32Even) { int32_t out[6] = {-3, -2, -2, 2, 2, 3}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toInt(), out[testNo]); } } @@ -356,7 +356,7 @@ TEST(Decimal128Test, TestDecimal128ToInt32Neg) { int32_t out[6] = {-3, -3, -3, 2, 2, 2}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toInt(roundMode), out[testNo]); } } @@ -367,7 +367,7 @@ TEST(Decimal128Test, TestDecimal128ToInt32Pos) { int32_t out[6] = {-2, -2, -2, 3, 3, 3}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toInt(roundMode), out[testNo]); } } @@ -378,7 +378,7 @@ TEST(Decimal128Test, TestDecimal128ToInt32Zero) { int32_t out[6] = {-2, -2, -2, 2, 2, 2}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toInt(roundMode), out[testNo]); } } @@ -389,7 +389,7 @@ TEST(Decimal128Test, TestDecimal128ToInt32Away) { int32_t out[6] = {-3, -3, -2, 2, 3, 3}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toInt(roundMode), out[testNo]); } } @@ -404,7 +404,7 @@ TEST(Decimal128Test, TestDecimal128ToInt64Even) { int64_t out[6] = {-4294967297, -4294967296, -4294967296, 4294967296, 4294967296, 4294967297}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toLong(), out[testNo]); } } @@ -420,7 +420,7 @@ TEST(Decimal128Test, TestDecimal128ToInt64Neg) { int64_t out[6] = {-4294967297, -4294967297, -4294967297, 4294967296, 4294967296, 4294967296}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toLong(roundMode), out[testNo]); } } @@ -436,7 +436,7 @@ TEST(Decimal128Test, TestDecimal128ToInt64Pos) { int64_t out[6] = {-4294967296, -4294967296, -4294967296, 4294967297, 4294967297, 4294967297}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toLong(roundMode), out[testNo]); } } @@ -452,7 +452,7 @@ TEST(Decimal128Test, TestDecimal128ToInt64Zero) { int64_t out[6] = {-4294967296, -4294967296, -4294967296, 4294967296, 4294967296, 4294967296}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toLong(roundMode), out[testNo]); } } @@ -468,7 +468,7 @@ TEST(Decimal128Test, TestDecimal128ToInt64Away) { int64_t out[6] = {-4294967297, -4294967297, -4294967296, 4294967296, 4294967297, 4294967297}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toLong(roundMode), out[testNo]); } } @@ -478,7 +478,7 @@ TEST(Decimal128Test, TestDecimal128ToInt32ExactEven) { int32_t out[6] = {-3, -2, -2, 2, 2, 3}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toIntExact(), out[testNo]); } } @@ -489,7 +489,7 @@ TEST(Decimal128Test, TestDecimal128ToInt32ExactNeg) { int32_t out[6] = {-3, -3, -3, 2, 2, 2}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toIntExact(roundMode), out[testNo]); } } @@ -500,7 +500,7 @@ TEST(Decimal128Test, TestDecimal128ToInt32ExactPos) { int32_t out[6] = {-2, -2, -2, 3, 3, 3}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toIntExact(roundMode), out[testNo]); } } @@ -511,7 +511,7 @@ TEST(Decimal128Test, TestDecimal128ToInt32ExactZero) { int32_t out[6] = {-2, -2, -2, 2, 2, 2}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toIntExact(roundMode), out[testNo]); } } @@ -522,7 +522,7 @@ TEST(Decimal128Test, TestDecimal128ToInt32ExactAway) { int32_t out[6] = {-3, -3, -2, 2, 3, 3}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toIntExact(roundMode), out[testNo]); } } @@ -537,7 +537,7 @@ TEST(Decimal128Test, TestDecimal128ToInt64ExactEven) { int64_t out[6] = {-4294967297, -4294967296, -4294967296, 4294967296, 4294967296, 4294967297}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toLongExact(), out[testNo]); } } @@ -553,7 +553,7 @@ TEST(Decimal128Test, TestDecimal128ToInt64ExactNeg) { int64_t out[6] = {-4294967297, -4294967297, -4294967297, 4294967296, 4294967296, 4294967296}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toLongExact(roundMode), out[testNo]); } } @@ -569,7 +569,7 @@ TEST(Decimal128Test, TestDecimal128ToInt64ExactPos) { int64_t out[6] = {-4294967296, -4294967296, -4294967296, 4294967297, 4294967297, 4294967297}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toLongExact(roundMode), out[testNo]); } } @@ -585,7 +585,7 @@ TEST(Decimal128Test, TestDecimal128ToInt64ExactZero) { int64_t out[6] = {-4294967296, -4294967296, -4294967296, 4294967296, 4294967296, 4294967296}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toLongExact(roundMode), out[testNo]); } } @@ -601,7 +601,7 @@ TEST(Decimal128Test, TestDecimal128ToInt64ExactAway) { int64_t out[6] = {-4294967297, -4294967297, -4294967296, 4294967296, 4294967297, 4294967297}; std::unique_ptr<Decimal128> decPtr; for (int testNo = 0; testNo < 6; ++testNo) { - decPtr = stdx::make_unique<Decimal128>(in[testNo]); + decPtr = std::make_unique<Decimal128>(in[testNo]); ASSERT_EQUALS(decPtr->toLongExact(roundMode), out[testNo]); } } diff --git a/src/mongo/platform/random.cpp b/src/mongo/platform/random.cpp index ec46ce8c2cc..f12ffb57a5d 100644 --- a/src/mongo/platform/random.cpp +++ b/src/mongo/platform/random.cpp @@ -46,8 +46,8 @@ #include <fstream> #include <iostream> #include <limits> +#include <memory> -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" @@ -144,7 +144,7 @@ private: }; std::unique_ptr<SecureRandom> SecureRandom::create() { - return stdx::make_unique<WinSecureRandom>(); + return std::make_unique<WinSecureRandom>(); } #elif defined(__linux__) || defined(__sun) || defined(__APPLE__) || defined(__FreeBSD__) || \ @@ -153,7 +153,7 @@ std::unique_ptr<SecureRandom> SecureRandom::create() { class InputStreamSecureRandom : public SecureRandom { public: InputStreamSecureRandom(const char* fn) { - _in = stdx::make_unique<std::ifstream>(fn, std::ios::binary | std::ios::in); + _in = std::make_unique<std::ifstream>(fn, std::ios::binary | std::ios::in); if (!_in->is_open()) { error() << "cannot open " << fn << " " << strerror(errno); fassertFailed(28839); @@ -175,7 +175,7 @@ private: }; std::unique_ptr<SecureRandom> SecureRandom::create() { - return stdx::make_unique<InputStreamSecureRandom>("/dev/urandom"); + return std::make_unique<InputStreamSecureRandom>("/dev/urandom"); } #elif defined(__OpenBSD__) @@ -190,7 +190,7 @@ public: }; std::unique_ptr<SecureRandom> SecureRandom::create() { - return stdx::make_unique<Arc4SecureRandom>(); + return std::make_unique<Arc4SecureRandom>(); } #else diff --git a/src/mongo/platform/shared_library_posix.cpp b/src/mongo/platform/shared_library_posix.cpp index 16728da3d12..a383efab94e 100644 --- a/src/mongo/platform/shared_library_posix.cpp +++ b/src/mongo/platform/shared_library_posix.cpp @@ -34,8 +34,8 @@ #include <boost/filesystem.hpp> #include <dlfcn.h> +#include <memory> -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" #include "mongo/util/str.h" diff --git a/src/mongo/rpc/factory.cpp b/src/mongo/rpc/factory.cpp index 50459f68e2a..e7d7c2ec67b 100644 --- a/src/mongo/rpc/factory.cpp +++ b/src/mongo/rpc/factory.cpp @@ -31,6 +31,8 @@ #include "mongo/rpc/factory.h" +#include <memory> + #include "mongo/rpc/legacy_reply.h" #include "mongo/rpc/legacy_reply_builder.h" #include "mongo/rpc/legacy_request.h" @@ -38,7 +40,6 @@ #include "mongo/rpc/message.h" #include "mongo/rpc/op_msg_rpc_impls.h" #include "mongo/rpc/protocol.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/str.h" @@ -58,9 +59,9 @@ Message messageFromOpMsgRequest(Protocol proto, const OpMsgRequest& request) { std::unique_ptr<ReplyInterface> makeReply(const Message* unownedMessage) { switch (unownedMessage->operation()) { case mongo::dbMsg: - return stdx::make_unique<OpMsgReply>(OpMsg::parseOwned(*unownedMessage)); + return std::make_unique<OpMsgReply>(OpMsg::parseOwned(*unownedMessage)); case mongo::opReply: - return stdx::make_unique<LegacyReply>(unownedMessage); + return std::make_unique<LegacyReply>(unownedMessage); default: uasserted(ErrorCodes::UnsupportedFormat, str::stream() << "Received a reply message with unexpected opcode: " @@ -84,9 +85,9 @@ OpMsgRequest opMsgRequestFromAnyProtocol(const Message& unownedMessage) { std::unique_ptr<ReplyBuilderInterface> makeReplyBuilder(Protocol protocol) { switch (protocol) { case Protocol::kOpMsg: - return stdx::make_unique<OpMsgReplyBuilder>(); + return std::make_unique<OpMsgReplyBuilder>(); case Protocol::kOpQuery: - return stdx::make_unique<LegacyReplyBuilder>(); + return std::make_unique<LegacyReplyBuilder>(); } MONGO_UNREACHABLE; } diff --git a/src/mongo/rpc/legacy_reply_builder.cpp b/src/mongo/rpc/legacy_reply_builder.cpp index 9fc8ad65a8b..ca4e2d0e08a 100644 --- a/src/mongo/rpc/legacy_reply_builder.cpp +++ b/src/mongo/rpc/legacy_reply_builder.cpp @@ -32,13 +32,13 @@ #include "mongo/rpc/legacy_reply_builder.h" #include <iterator> +#include <memory> #include "mongo/db/dbmessage.h" #include "mongo/db/jsobj.h" #include "mongo/rpc/metadata.h" #include "mongo/rpc/metadata/sharding_metadata.h" #include "mongo/s/stale_exception.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/str.h" diff --git a/src/mongo/rpc/legacy_request_builder.cpp b/src/mongo/rpc/legacy_request_builder.cpp index 07031bfe381..1a52bec654d 100644 --- a/src/mongo/rpc/legacy_request_builder.cpp +++ b/src/mongo/rpc/legacy_request_builder.cpp @@ -31,6 +31,7 @@ #include "mongo/rpc/legacy_request_builder.h" +#include <memory> #include <tuple> #include <utility> @@ -39,7 +40,6 @@ #include "mongo/db/namespace_string.h" #include "mongo/rpc/message.h" #include "mongo/rpc/metadata.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" namespace mongo { diff --git a/src/mongo/rpc/metadata/client_metadata_ismaster.cpp b/src/mongo/rpc/metadata/client_metadata_ismaster.cpp index d095fa6ed1d..15a3dc7482d 100644 --- a/src/mongo/rpc/metadata/client_metadata_ismaster.cpp +++ b/src/mongo/rpc/metadata/client_metadata_ismaster.cpp @@ -31,6 +31,7 @@ #include "mongo/rpc/metadata/client_metadata_ismaster.h" +#include <memory> #include <string> #include "mongo/base/init.h" @@ -38,7 +39,6 @@ #include "mongo/db/client.h" #include "mongo/db/operation_context.h" #include "mongo/db/service_context.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/rpc/metadata/egress_metadata_hook_list_test.cpp b/src/mongo/rpc/metadata/egress_metadata_hook_list_test.cpp index f2a70e15b40..65b9e742758 100644 --- a/src/mongo/rpc/metadata/egress_metadata_hook_list_test.cpp +++ b/src/mongo/rpc/metadata/egress_metadata_hook_list_test.cpp @@ -29,10 +29,11 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/base/status.h" #include "mongo/bson/bsonobjbuilder.h" #include "mongo/rpc/metadata/egress_metadata_hook_list.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/net/hostandport.h" @@ -99,7 +100,7 @@ TEST(EgressMetadataHookListTest, EmptyHookShouldNotFail) { TEST(EgressMetadataHookListTest, SingleHook) { ReadReplyArgs hook1Args; - auto hook1 = stdx::make_unique<TestHook>("h1", &hook1Args); + auto hook1 = std::make_unique<TestHook>("h1", &hook1Args); EgressMetadataHookList hookList; hookList.addHook(std::move(hook1)); @@ -118,12 +119,12 @@ TEST(EgressMetadataHookListTest, SingleHook) { TEST(EgressMetadataHookListTest, MultipleHooks) { ReadReplyArgs hook1Args; - auto hook1 = stdx::make_unique<TestHook>("foo", &hook1Args); + auto hook1 = std::make_unique<TestHook>("foo", &hook1Args); EgressMetadataHookList hookList; hookList.addHook(std::move(hook1)); ReadReplyArgs hook2Args; - auto hook2 = stdx::make_unique<TestHook>("bar", &hook2Args); + auto hook2 = std::make_unique<TestHook>("bar", &hook2Args); hookList.addHook(std::move(hook2)); BSONObjBuilder builder; @@ -147,12 +148,12 @@ TEST(EgressMetadataHookListTest, MultipleHooks) { TEST(EgressMetadataHookListTest, SingleBadHookShouldReturnError) { ReadReplyArgs hook1Args; - auto hook1 = stdx::make_unique<TestHook>("foo", &hook1Args); + auto hook1 = std::make_unique<TestHook>("foo", &hook1Args); EgressMetadataHookList hookList; hookList.addHook(std::move(hook1)); Status err{ErrorCodes::IllegalOperation, "intentional error by test"}; - auto hook2 = stdx::make_unique<FixedStatusTestHook>(err); + auto hook2 = std::make_unique<FixedStatusTestHook>(err); hookList.addHook(std::move(hook2)); BSONObjBuilder builder; diff --git a/src/mongo/s/append_raw_responses_test.cpp b/src/mongo/s/append_raw_responses_test.cpp index 8d7f1ba406d..1dd0d17ba0e 100644 --- a/src/mongo/s/append_raw_responses_test.cpp +++ b/src/mongo/s/append_raw_responses_test.cpp @@ -180,7 +180,7 @@ protected: const std::vector<ShardId> _shardIds; }; - return stdx::make_unique<StaticCatalogClient>(kShardIdList); + return std::make_unique<StaticCatalogClient>(kShardIdList); } const ShardId kShard1{"s1"}; diff --git a/src/mongo/s/async_requests_sender.cpp b/src/mongo/s/async_requests_sender.cpp index 86fa3af6300..494dd4edb8f 100644 --- a/src/mongo/s/async_requests_sender.cpp +++ b/src/mongo/s/async_requests_sender.cpp @@ -34,13 +34,13 @@ #include "mongo/s/async_requests_sender.h" #include <fmt/format.h> +#include <memory> #include "mongo/client/remote_command_targeter.h" #include "mongo/executor/remote_command_request.h" #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/grid.h" -#include "mongo/stdx/memory.h" #include "mongo/transport/baton.h" #include "mongo/transport/transport_layer.h" #include "mongo/util/assert_util.h" diff --git a/src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp b/src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp index f660b5cf7da..f912020f308 100644 --- a/src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp +++ b/src/mongo/s/catalog/dist_lock_catalog_impl_test.cpp @@ -29,6 +29,7 @@ #include "mongo/platform/basic.h" +#include <memory> #include <utility> #include "mongo/bson/json.h" @@ -49,7 +50,6 @@ #include "mongo/s/grid.h" #include "mongo/s/shard_server_test_fixture.h" #include "mongo/s/write_ops/batched_command_request.h" -#include "mongo/stdx/memory.h" #include "mongo/util/time_support.h" namespace mongo { @@ -72,17 +72,17 @@ const HostAndPort dummyHost("dummy", 123); class DistLockCatalogTest : public ShardServerTestFixture { protected: std::unique_ptr<DistLockCatalog> makeDistLockCatalog() override { - return stdx::make_unique<DistLockCatalogImpl>(); + return std::make_unique<DistLockCatalogImpl>(); } std::unique_ptr<DistLockManager> makeDistLockManager( std::unique_ptr<DistLockCatalog> distLockCatalog) override { - return stdx::make_unique<DistLockManagerMock>(std::move(distLockCatalog)); + return std::make_unique<DistLockManagerMock>(std::move(distLockCatalog)); } std::unique_ptr<ShardingCatalogClient> makeShardingCatalogClient( std::unique_ptr<DistLockManager> distLockManager) override { - return stdx::make_unique<ShardingCatalogClientMock>(std::move(distLockManager)); + return std::make_unique<ShardingCatalogClientMock>(std::move(distLockManager)); } std::shared_ptr<RemoteCommandTargeterMock> configTargeter() { diff --git a/src/mongo/s/catalog/replset_dist_lock_manager.cpp b/src/mongo/s/catalog/replset_dist_lock_manager.cpp index 5c24eb292b2..9a2eb86e060 100644 --- a/src/mongo/s/catalog/replset_dist_lock_manager.cpp +++ b/src/mongo/s/catalog/replset_dist_lock_manager.cpp @@ -33,6 +33,8 @@ #include "mongo/s/catalog/replset_dist_lock_manager.h" +#include <memory> + #include "mongo/base/status.h" #include "mongo/base/status_with.h" #include "mongo/db/operation_context_noop.h" @@ -43,7 +45,6 @@ #include "mongo/s/client/shard_registry.h" #include "mongo/s/grid.h" #include "mongo/stdx/chrono.h" -#include "mongo/stdx/memory.h" #include "mongo/util/concurrency/idle_thread_block.h" #include "mongo/util/concurrency/thread_name.h" #include "mongo/util/fail_point_service.h" @@ -87,7 +88,7 @@ ReplSetDistLockManager::~ReplSetDistLockManager() = default; void ReplSetDistLockManager::startUp() { if (!_execThread) { - _execThread = stdx::make_unique<stdx::thread>(&ReplSetDistLockManager::doTask, this); + _execThread = std::make_unique<stdx::thread>(&ReplSetDistLockManager::doTask, this); } } diff --git a/src/mongo/s/catalog/replset_dist_lock_manager_test.cpp b/src/mongo/s/catalog/replset_dist_lock_manager_test.cpp index 499aa102f9b..eac536aca42 100644 --- a/src/mongo/s/catalog/replset_dist_lock_manager_test.cpp +++ b/src/mongo/s/catalog/replset_dist_lock_manager_test.cpp @@ -31,6 +31,7 @@ #include <boost/optional.hpp> #include <map> +#include <memory> #include <string> #include <vector> @@ -44,7 +45,6 @@ #include "mongo/s/grid.h" #include "mongo/s/shard_server_test_fixture.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/unittest/unittest.h" #include "mongo/util/system_tick_source.h" @@ -80,20 +80,20 @@ protected: std::unique_ptr<DistLockManager> makeDistLockManager( std::unique_ptr<DistLockCatalog> distLockCatalog) override { invariant(distLockCatalog); - return stdx::make_unique<ReplSetDistLockManager>(getServiceContext(), - _processID, - std::move(distLockCatalog), - kPingInterval, - kLockExpiration); + return std::make_unique<ReplSetDistLockManager>(getServiceContext(), + _processID, + std::move(distLockCatalog), + kPingInterval, + kLockExpiration); } std::unique_ptr<ShardingCatalogClient> makeShardingCatalogClient( std::unique_ptr<DistLockManager> distLockManager) override { - return stdx::make_unique<ShardingCatalogClientMock>(std::move(distLockManager)); + return std::make_unique<ShardingCatalogClientMock>(std::move(distLockManager)); } std::unique_ptr<BalancerConfiguration> makeBalancerConfiguration() override { - return stdx::make_unique<BalancerConfiguration>(); + return std::make_unique<BalancerConfiguration>(); } /** @@ -119,7 +119,7 @@ private: class RSDistLockMgrWithMockTickSource : public ReplSetDistLockManagerFixture { protected: RSDistLockMgrWithMockTickSource() { - getServiceContext()->setTickSource(stdx::make_unique<TickSourceMock<>>()); + getServiceContext()->setTickSource(std::make_unique<TickSourceMock<>>()); } /** diff --git a/src/mongo/s/catalog/sharding_catalog_client_mock.cpp b/src/mongo/s/catalog/sharding_catalog_client_mock.cpp index abb2cd48a25..481b9448033 100644 --- a/src/mongo/s/catalog/sharding_catalog_client_mock.cpp +++ b/src/mongo/s/catalog/sharding_catalog_client_mock.cpp @@ -31,6 +31,8 @@ #include "mongo/s/catalog/sharding_catalog_client_mock.h" +#include <memory> + #include "mongo/base/status.h" #include "mongo/db/repl/optime.h" #include "mongo/s/catalog/type_chunk.h" @@ -39,7 +41,6 @@ #include "mongo/s/catalog/type_database.h" #include "mongo/s/catalog/type_shard.h" #include "mongo/s/catalog/type_tags.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp b/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp index 6ffc535bcb7..1851a41ef00 100644 --- a/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp +++ b/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp @@ -31,6 +31,7 @@ #include "mongo/platform/basic.h" +#include <memory> #include <set> #include <string> #include <vector> @@ -56,7 +57,6 @@ #include "mongo/s/sharding_router_test_fixture.h" #include "mongo/s/write_ops/batched_command_response.h" #include "mongo/stdx/future.h" -#include "mongo/stdx/memory.h" #include "mongo/util/log.h" namespace mongo { @@ -288,7 +288,7 @@ TEST_F(InsertRetryTest, DuplicateKeyErrorAfterWriteConcernFailureMatch) { response.setStatus(Status::OK()); response.setN(1); - auto wcError = stdx::make_unique<WriteConcernErrorDetail>(); + auto wcError = std::make_unique<WriteConcernErrorDetail>(); WriteConcernResult wcRes; wcRes.err = "timeout"; @@ -486,7 +486,7 @@ TEST_F(UpdateRetryTest, OperationInterruptedDueToPrimaryStepDown) { BatchedCommandResponse response; response.setStatus(Status::OK()); - auto writeErrDetail = stdx::make_unique<WriteErrorDetail>(); + auto writeErrDetail = std::make_unique<WriteErrorDetail>(); writeErrDetail->setIndex(0); writeErrDetail->setStatus( {ErrorCodes::InterruptedDueToReplStateChange, "Operation interrupted"}); @@ -538,7 +538,7 @@ TEST_F(UpdateRetryTest, WriteConcernFailure) { response.setStatus(Status::OK()); response.setNModified(1); - auto wcError = stdx::make_unique<WriteConcernErrorDetail>(); + auto wcError = std::make_unique<WriteConcernErrorDetail>(); WriteConcernResult wcRes; wcRes.err = "timeout"; diff --git a/src/mongo/s/catalog_cache.h b/src/mongo/s/catalog_cache.h index e2d67ff68cd..37543f395de 100644 --- a/src/mongo/s/catalog_cache.h +++ b/src/mongo/s/catalog_cache.h @@ -29,6 +29,8 @@ #pragma once +#include <memory> + #include "mongo/base/string_data.h" #include "mongo/platform/atomic_word.h" #include "mongo/s/catalog/type_database.h" @@ -36,7 +38,6 @@ #include "mongo/s/chunk_manager.h" #include "mongo/s/client/shard.h" #include "mongo/s/database_version_gen.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/util/concurrency/notification.h" #include "mongo/util/concurrency/with_lock.h" diff --git a/src/mongo/s/catalog_cache_loader.h b/src/mongo/s/catalog_cache_loader.h index 16276074373..91a314bbabf 100644 --- a/src/mongo/s/catalog_cache_loader.h +++ b/src/mongo/s/catalog_cache_loader.h @@ -29,6 +29,7 @@ #pragma once +#include <memory> #include <vector> #include "mongo/base/status_with.h" @@ -37,7 +38,6 @@ #include "mongo/s/catalog/type_collection.h" #include "mongo/s/catalog/type_database.h" #include "mongo/s/chunk_version.h" -#include "mongo/stdx/memory.h" #include "mongo/util/concurrency/notification.h" #include "mongo/util/uuid.h" diff --git a/src/mongo/s/catalog_cache_test_fixture.cpp b/src/mongo/s/catalog_cache_test_fixture.cpp index 1bf824c1483..a995d5549d3 100644 --- a/src/mongo/s/catalog_cache_test_fixture.cpp +++ b/src/mongo/s/catalog_cache_test_fixture.cpp @@ -31,11 +31,12 @@ #include "mongo/platform/basic.h" +#include "mongo/s/catalog_cache_test_fixture.h" + +#include <memory> #include <set> #include <vector> -#include "mongo/s/catalog_cache_test_fixture.h" - #include "mongo/client/remote_command_targeter_factory_mock.h" #include "mongo/client/remote_command_targeter_mock.h" #include "mongo/db/client.h" @@ -47,7 +48,6 @@ #include "mongo/s/catalog_cache.h" #include "mongo/s/database_version_helpers.h" #include "mongo/s/grid.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/scopeguard.h" @@ -58,7 +58,7 @@ void CatalogCacheTestFixture::setUp() { setRemote(HostAndPort("FakeRemoteClient:34567")); configTargeter()->setFindHostReturnValue(kConfigHostAndPort); - CollatorFactoryInterface::set(getServiceContext(), stdx::make_unique<CollatorFactoryMock>()); + CollatorFactoryInterface::set(getServiceContext(), std::make_unique<CollatorFactoryMock>()); } executor::NetworkTestEnv::FutureHandle<boost::optional<CachedCollectionRoutingInfo>> @@ -87,7 +87,7 @@ void CatalogCacheTestFixture::setupNShards(int numShards) { shards.emplace_back(std::move(shard)); std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); targeter->setConnectionStringReturnValue(ConnectionString(host)); targeter->setFindHostReturnValue(host); targeterFactory()->addTargeterToReturn(ConnectionString(host), std::move(targeter)); diff --git a/src/mongo/s/catalog_cache_test_fixture.h b/src/mongo/s/catalog_cache_test_fixture.h index 1a1c1f42aab..c9f0ff255aa 100644 --- a/src/mongo/s/catalog_cache_test_fixture.h +++ b/src/mongo/s/catalog_cache_test_fixture.h @@ -29,12 +29,12 @@ #pragma once +#include <memory> #include <vector> #include "mongo/db/namespace_string.h" #include "mongo/s/catalog_cache.h" #include "mongo/s/sharding_router_test_fixture.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/s/chunk_manager.cpp b/src/mongo/s/chunk_manager.cpp index 5e59e59a079..87945b5b94e 100644 --- a/src/mongo/s/chunk_manager.cpp +++ b/src/mongo/s/chunk_manager.cpp @@ -125,7 +125,7 @@ void ChunkManager::getShardIdsForQuery(OperationContext* opCtx, const BSONObj& query, const BSONObj& collation, std::set<ShardId>* shardIds) const { - auto qr = stdx::make_unique<QueryRequest>(_rt->getns()); + auto qr = std::make_unique<QueryRequest>(_rt->getns()); qr->setFilter(query); if (!collation.isEmpty()) { diff --git a/src/mongo/s/chunk_manager_index_bounds_test.cpp b/src/mongo/s/chunk_manager_index_bounds_test.cpp index bf5b9b4b827..ecb46584090 100644 --- a/src/mongo/s/chunk_manager_index_bounds_test.cpp +++ b/src/mongo/s/chunk_manager_index_bounds_test.cpp @@ -56,7 +56,7 @@ protected: std::unique_ptr<CanonicalQuery> canonicalize(const char* queryStr) { BSONObj queryObj = fromjson(queryStr); const NamespaceString nss("test.foo"); - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(queryObj); boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest()); auto statusWithCQ = diff --git a/src/mongo/s/chunk_manager_query_test.cpp b/src/mongo/s/chunk_manager_query_test.cpp index 3513a3401b4..cece84d2d03 100644 --- a/src/mongo/s/chunk_manager_query_test.cpp +++ b/src/mongo/s/chunk_manager_query_test.cpp @@ -405,7 +405,7 @@ TEST_F(ChunkManagerQueryTest, CollationStringsMultiShard) { TEST_F(ChunkManagerQueryTest, DefaultCollationStringsMultiShard) { runQueryTest( BSON("a" << 1), - stdx::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kReverseString), + std::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kReverseString), false, {BSON("a" << "x"), @@ -423,7 +423,7 @@ TEST_F(ChunkManagerQueryTest, DefaultCollationStringsMultiShard) { TEST_F(ChunkManagerQueryTest, SimpleCollationStringsMultiShard) { runQueryTest( BSON("a" << 1), - stdx::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kReverseString), + std::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kReverseString), false, {BSON("a" << "x"), @@ -441,7 +441,7 @@ TEST_F(ChunkManagerQueryTest, SimpleCollationStringsMultiShard) { TEST_F(ChunkManagerQueryTest, CollationNumbersMultiShard) { runQueryTest( BSON("a" << 1), - stdx::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kReverseString), + std::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kReverseString), false, {BSON("a" << "x"), @@ -458,7 +458,7 @@ TEST_F(ChunkManagerQueryTest, CollationNumbersMultiShard) { TEST_F(ChunkManagerQueryTest, DefaultCollationNumbersMultiShard) { runQueryTest( BSON("a" << 1), - stdx::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kReverseString), + std::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kReverseString), false, {BSON("a" << "x"), @@ -474,7 +474,7 @@ TEST_F(ChunkManagerQueryTest, DefaultCollationNumbersMultiShard) { TEST_F(ChunkManagerQueryTest, SimpleCollationNumbersMultiShard) { runQueryTest( BSON("a" << 1), - stdx::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kReverseString), + std::make_unique<CollatorInterfaceMock>(CollatorInterfaceMock::MockType::kReverseString), false, {BSON("a" << "x"), diff --git a/src/mongo/s/client/shard_connection.cpp b/src/mongo/s/client/shard_connection.cpp index 5ac9fe97bd0..e5698ef5f69 100644 --- a/src/mongo/s/client/shard_connection.cpp +++ b/src/mongo/s/client/shard_connection.cpp @@ -109,7 +109,7 @@ public: static ClientConnections* threadInstance() { if (!_perThread) { - _perThread = stdx::make_unique<ClientConnections>(); + _perThread = std::make_unique<ClientConnections>(); } return _perThread.get(); } diff --git a/src/mongo/s/client/shard_factory.cpp b/src/mongo/s/client/shard_factory.cpp index c9af0a74276..98fffbc034c 100644 --- a/src/mongo/s/client/shard_factory.cpp +++ b/src/mongo/s/client/shard_factory.cpp @@ -34,10 +34,11 @@ #include "mongo/s/client/shard_factory.h" +#include <memory> + #include "mongo/base/status_with.h" #include "mongo/client/connection_string.h" #include "mongo/client/remote_command_targeter.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" diff --git a/src/mongo/s/client/shard_local_test.cpp b/src/mongo/s/client/shard_local_test.cpp index 830ec96731a..fcc00899ecf 100644 --- a/src/mongo/s/client/shard_local_test.cpp +++ b/src/mongo/s/client/shard_local_test.cpp @@ -31,6 +31,8 @@ #include "mongo/s/client/shard_local.h" +#include <memory> + #include "mongo/client/read_preference.h" #include "mongo/db/catalog_raii.h" #include "mongo/db/client.h" @@ -41,7 +43,6 @@ #include "mongo/db/service_context_d_test_fixture.h" #include "mongo/db/write_concern_options.h" #include "mongo/s/client/shard_registry.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace { @@ -83,7 +84,7 @@ void ShardLocalTest::setUp() { ServiceContextMongoDTest::setUp(); _opCtx = getGlobalServiceContext()->makeOperationContext(&cc()); serverGlobalParams.clusterRole = ClusterRole::ConfigServer; - _shardLocal = stdx::make_unique<ShardLocal>(ShardRegistry::kConfigServerShardId); + _shardLocal = std::make_unique<ShardLocal>(ShardRegistry::kConfigServerShardId); const repl::ReplSettings replSettings = {}; repl::ReplicationCoordinator::set( getGlobalServiceContext(), diff --git a/src/mongo/s/client/shard_registry.cpp b/src/mongo/s/client/shard_registry.cpp index a24e4fd1bbb..7187eb01998 100644 --- a/src/mongo/s/client/shard_registry.cpp +++ b/src/mongo/s/client/shard_registry.cpp @@ -33,6 +33,7 @@ #include "mongo/s/client/shard_registry.h" +#include <memory> #include <set> #include "mongo/bson/bsonobj.h" @@ -55,7 +56,6 @@ #include "mongo/s/client/shard.h" #include "mongo/s/client/shard_factory.h" #include "mongo/s/grid.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/util/concurrency/with_lock.h" #include "mongo/util/log.h" @@ -217,14 +217,14 @@ void ShardRegistry::startup(OperationContext* opCtx) { // startup() must be called only once invariant(!_executor); - auto hookList = stdx::make_unique<rpc::EgressMetadataHookList>(); - hookList->addHook(stdx::make_unique<rpc::LogicalTimeMetadataHook>(opCtx->getServiceContext())); + auto hookList = std::make_unique<rpc::EgressMetadataHookList>(); + hookList->addHook(std::make_unique<rpc::LogicalTimeMetadataHook>(opCtx->getServiceContext())); // construct task executor auto net = executor::makeNetworkInterface("ShardRegistryUpdater", nullptr, std::move(hookList)); auto netPtr = net.get(); - _executor = stdx::make_unique<ThreadPoolTaskExecutor>( - stdx::make_unique<NetworkInterfaceThreadPool>(netPtr), std::move(net)); + _executor = std::make_unique<ThreadPoolTaskExecutor>( + std::make_unique<NetworkInterfaceThreadPool>(netPtr), std::move(net)); LOG(1) << "Starting up task executor for periodic reloading of ShardRegistry"; _executor->startup(); diff --git a/src/mongo/s/client/shard_registry_data_test.cpp b/src/mongo/s/client/shard_registry_data_test.cpp index 654bbf85211..d7f96320a08 100644 --- a/src/mongo/s/client/shard_registry_data_test.cpp +++ b/src/mongo/s/client/shard_registry_data_test.cpp @@ -29,6 +29,7 @@ #include "mongo/platform/basic.h" +#include <memory> #include <utility> #include "mongo/base/status.h" @@ -39,7 +40,6 @@ #include "mongo/s/client/shard_factory.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/client/shard_remote.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/time_support.h" @@ -54,18 +54,18 @@ public: private: void setUp() override { - auto targeterFactory = stdx::make_unique<RemoteCommandTargeterFactoryMock>(); + auto targeterFactory = std::make_unique<RemoteCommandTargeterFactoryMock>(); auto targeterFactoryPtr = targeterFactory.get(); ShardFactory::BuilderCallable setBuilder = [targeterFactoryPtr](const ShardId& shardId, const ConnectionString& connStr) { - return stdx::make_unique<ShardRemote>( + return std::make_unique<ShardRemote>( shardId, connStr, targeterFactoryPtr->create(connStr)); }; ShardFactory::BuilderCallable masterBuilder = [targeterFactoryPtr](const ShardId& shardId, const ConnectionString& connStr) { - return stdx::make_unique<ShardRemote>( + return std::make_unique<ShardRemote>( shardId, connStr, targeterFactoryPtr->create(connStr)); }; @@ -75,7 +75,7 @@ private: }; _shardFactory = - stdx::make_unique<ShardFactory>(std::move(buildersMap), std::move(targeterFactory)); + std::make_unique<ShardFactory>(std::move(buildersMap), std::move(targeterFactory)); } void tearDown() override {} diff --git a/src/mongo/s/client/shard_remote_test.cpp b/src/mongo/s/client/shard_remote_test.cpp index a2600a84558..311a6547aff 100644 --- a/src/mongo/s/client/shard_remote_test.cpp +++ b/src/mongo/s/client/shard_remote_test.cpp @@ -71,7 +71,7 @@ protected: shards.push_back(shardType); std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); targeter->setConnectionStringReturnValue(ConnectionString(kTestShardHosts[i])); targeter->setFindHostReturnValue(kTestShardHosts[i]); diff --git a/src/mongo/s/cluster_commands_helpers.cpp b/src/mongo/s/cluster_commands_helpers.cpp index d411f79f991..82191248f6f 100644 --- a/src/mongo/s/cluster_commands_helpers.cpp +++ b/src/mongo/s/cluster_commands_helpers.cpp @@ -96,7 +96,7 @@ std::unique_ptr<WriteConcernErrorDetail> getWriteConcernErrorDetailFromBSONObj(c } } - return stdx::make_unique<WriteConcernErrorDetail>(getWriteConcernErrorDetail(wcErrorElem)); + return std::make_unique<WriteConcernErrorDetail>(getWriteConcernErrorDetail(wcErrorElem)); } namespace { diff --git a/src/mongo/s/cluster_commands_helpers.h b/src/mongo/s/cluster_commands_helpers.h index 433013c76b6..ae3b89b842e 100644 --- a/src/mongo/s/cluster_commands_helpers.h +++ b/src/mongo/s/cluster_commands_helpers.h @@ -29,6 +29,7 @@ #pragma once +#include <memory> #include <string> #include <vector> @@ -40,7 +41,6 @@ #include "mongo/s/async_requests_sender.h" #include "mongo/s/catalog_cache.h" #include "mongo/s/commands/strategy.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/s/commands/cluster_command_test_fixture.cpp b/src/mongo/s/commands/cluster_command_test_fixture.cpp index 6da3d1810ef..504fe0602e3 100644 --- a/src/mongo/s/commands/cluster_command_test_fixture.cpp +++ b/src/mongo/s/commands/cluster_command_test_fixture.cpp @@ -53,29 +53,29 @@ void ClusterCommandTestFixture::setUp() { CatalogCacheTestFixture::setupNShards(numShards); // Set up a logical clock with an initial time. - auto logicalClock = stdx::make_unique<LogicalClock>(getServiceContext()); + auto logicalClock = std::make_unique<LogicalClock>(getServiceContext()); logicalClock->setClusterTimeFromTrustedSource(kInMemoryLogicalTime); LogicalClock::set(getServiceContext(), std::move(logicalClock)); - auto keysCollectionClient = stdx::make_unique<KeysCollectionClientSharded>( + auto keysCollectionClient = std::make_unique<KeysCollectionClientSharded>( Grid::get(operationContext())->catalogClient()); auto keyManager = std::make_shared<KeysCollectionManager>( "dummy", std::move(keysCollectionClient), Seconds(KeysRotationIntervalSec)); - auto validator = stdx::make_unique<LogicalTimeValidator>(keyManager); + auto validator = std::make_unique<LogicalTimeValidator>(keyManager); LogicalTimeValidator::set(getServiceContext(), std::move(validator)); - LogicalSessionCache::set(getServiceContext(), stdx::make_unique<LogicalSessionCacheNoop>()); + LogicalSessionCache::set(getServiceContext(), std::make_unique<LogicalSessionCacheNoop>()); // Set up a tick source for transaction metrics. - auto tickSource = stdx::make_unique<TickSourceMock<Microseconds>>(); + auto tickSource = std::make_unique<TickSourceMock<Microseconds>>(); tickSource->reset(1); getServiceContext()->setTickSource(std::move(tickSource)); loadRoutingTableWithTwoChunksAndTwoShards(kNss); - _staleVersionAndSnapshotRetriesBlock = stdx::make_unique<FailPointEnableBlock>( + _staleVersionAndSnapshotRetriesBlock = std::make_unique<FailPointEnableBlock>( "enableStaleVersionAndSnapshotRetriesWithinTransactions"); } diff --git a/src/mongo/s/commands/cluster_explain_cmd.cpp b/src/mongo/s/commands/cluster_explain_cmd.cpp index a4549e39e51..8c4ccdd9e94 100644 --- a/src/mongo/s/commands/cluster_explain_cmd.cpp +++ b/src/mongo/s/commands/cluster_explain_cmd.cpp @@ -184,7 +184,7 @@ std::unique_ptr<CommandInvocation> ClusterExplainCmd::parse(OperationContext* op explainedCommand); auto innerRequest = std::make_unique<OpMsgRequest>(OpMsg{explainedObj}); auto innerInvocation = explainedCommand->parse(opCtx, *innerRequest); - return stdx::make_unique<Invocation>( + return std::make_unique<Invocation>( this, request, std::move(verbosity), std::move(innerRequest), std::move(innerInvocation)); } diff --git a/src/mongo/s/commands/cluster_write_cmd.cpp b/src/mongo/s/commands/cluster_write_cmd.cpp index 23e8e92b48c..e3d3df7488f 100644 --- a/src/mongo/s/commands/cluster_write_cmd.cpp +++ b/src/mongo/s/commands/cluster_write_cmd.cpp @@ -76,7 +76,7 @@ void batchErrorToLastError(const BatchedCommandRequest& request, if (!response.getOk()) { // Command-level error, all writes failed - commandError = stdx::make_unique<WriteErrorDetail>(); + commandError = std::make_unique<WriteErrorDetail>(); commandError->setStatus(response.getTopLevelStatus()); lastBatchError = commandError.get(); } else if (response.isErrDetailsSet()) { @@ -257,7 +257,7 @@ bool handleWouldChangeOwningShardError(OperationContext* opCtx, } if (!response->isErrDetailsSet() || !response->getErrDetails().back()) { - auto error = stdx::make_unique<WriteErrorDetail>(); + auto error = std::make_unique<WriteErrorDetail>(); error->setIndex(0); response->addToErrDetails(error.release()); } @@ -300,7 +300,7 @@ bool handleWouldChangeOwningShardError(OperationContext* opCtx, response->setN(response->getN() + 1); if (upsertedId) { - auto upsertDetail = stdx::make_unique<BatchedUpsertDetail>(); + auto upsertDetail = std::make_unique<BatchedUpsertDetail>(); upsertDetail->setIndex(0); upsertDetail->setUpsertedID(upsertedId.get()); response->addToUpsertDetails(upsertDetail.release()); @@ -589,7 +589,7 @@ private: std::unique_ptr<CommandInvocation> parse(OperationContext* opCtx, const OpMsgRequest& request) final { - return stdx::make_unique<Invocation>( + return std::make_unique<Invocation>( this, request, BatchedCommandRequest::cloneInsertWithIds(BatchedCommandRequest::parseInsert(request))); @@ -627,7 +627,7 @@ private: "Cannot specify runtime constants option to a mongos", !parsedRequest.hasRuntimeConstants()); parsedRequest.setRuntimeConstants(Variables::generateRuntimeConstants(opCtx)); - return stdx::make_unique<Invocation>(this, request, std::move(parsedRequest)); + return std::make_unique<Invocation>(this, request, std::move(parsedRequest)); } std::string help() const override { @@ -657,7 +657,7 @@ private: std::unique_ptr<CommandInvocation> parse(OperationContext* opCtx, const OpMsgRequest& request) final { - return stdx::make_unique<Invocation>( + return std::make_unique<Invocation>( this, request, BatchedCommandRequest::parseDelete(request)); } diff --git a/src/mongo/s/config_server_catalog_cache_loader.cpp b/src/mongo/s/config_server_catalog_cache_loader.cpp index c97856075e6..202d8fdb852 100644 --- a/src/mongo/s/config_server_catalog_cache_loader.cpp +++ b/src/mongo/s/config_server_catalog_cache_loader.cpp @@ -33,12 +33,13 @@ #include "mongo/s/config_server_catalog_cache_loader.h" +#include <memory> + #include "mongo/db/client.h" #include "mongo/db/operation_context.h" #include "mongo/s/catalog/sharding_catalog_client.h" #include "mongo/s/database_version_helpers.h" #include "mongo/s/grid.h" -#include "mongo/stdx/memory.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/log.h" diff --git a/src/mongo/s/config_server_test_fixture.cpp b/src/mongo/s/config_server_test_fixture.cpp index 069a733289b..4a1c10a95f2 100644 --- a/src/mongo/s/config_server_test_fixture.cpp +++ b/src/mongo/s/config_server_test_fixture.cpp @@ -32,6 +32,7 @@ #include "mongo/s/config_server_test_fixture.h" #include <algorithm> +#include <memory> #include <vector> #include "mongo/base/status_with.h" @@ -77,7 +78,6 @@ #include "mongo/s/request_types/set_shard_version_request.h" #include "mongo/s/shard_id.h" #include "mongo/s/write_ops/batched_command_response.h" -#include "mongo/stdx/memory.h" #include "mongo/util/clock_source_mock.h" #include "mongo/util/tick_source_mock.h" @@ -113,7 +113,7 @@ void ConfigServerTestFixture::setUp() { { // The catalog manager requires a special executor used for operations during addShard. - auto specialNet(stdx::make_unique<executor::NetworkInterfaceMock>()); + auto specialNet(std::make_unique<executor::NetworkInterfaceMock>()); _mockNetworkForAddShard = specialNet.get(); auto specialExec(makeThreadPoolTestExecutor(std::move(specialNet))); @@ -123,10 +123,10 @@ void ConfigServerTestFixture::setUp() { } _addShardNetworkTestEnv = - stdx::make_unique<NetworkTestEnv>(_executorForAddShard, _mockNetworkForAddShard); + std::make_unique<NetworkTestEnv>(_executorForAddShard, _mockNetworkForAddShard); CatalogCacheLoader::set(getServiceContext(), - stdx::make_unique<ConfigServerCatalogCacheLoader>()); + std::make_unique<ConfigServerCatalogCacheLoader>()); uassertStatusOK(initializeGlobalShardingStateForMongodForTest(ConnectionString::forLocal())); } @@ -144,13 +144,13 @@ void ConfigServerTestFixture::tearDown() { } std::unique_ptr<DistLockCatalog> ConfigServerTestFixture::makeDistLockCatalog() { - return stdx::make_unique<DistLockCatalogImpl>(); + return std::make_unique<DistLockCatalogImpl>(); } std::unique_ptr<DistLockManager> ConfigServerTestFixture::makeDistLockManager( std::unique_ptr<DistLockCatalog> distLockCatalog) { invariant(distLockCatalog); - return stdx::make_unique<ReplSetDistLockManager>( + return std::make_unique<ReplSetDistLockManager>( getServiceContext(), "distLockProcessId", std::move(distLockCatalog), @@ -161,15 +161,15 @@ std::unique_ptr<DistLockManager> ConfigServerTestFixture::makeDistLockManager( std::unique_ptr<ShardingCatalogClient> ConfigServerTestFixture::makeShardingCatalogClient( std::unique_ptr<DistLockManager> distLockManager) { invariant(distLockManager); - return stdx::make_unique<ShardingCatalogClientImpl>(std::move(distLockManager)); + return std::make_unique<ShardingCatalogClientImpl>(std::move(distLockManager)); } std::unique_ptr<BalancerConfiguration> ConfigServerTestFixture::makeBalancerConfiguration() { - return stdx::make_unique<BalancerConfiguration>(); + return std::make_unique<BalancerConfiguration>(); } std::unique_ptr<ClusterCursorManager> ConfigServerTestFixture::makeClusterCursorManager() { - return stdx::make_unique<ClusterCursorManager>(getServiceContext()->getPreciseClockSource()); + return std::make_unique<ClusterCursorManager>(getServiceContext()->getPreciseClockSource()); } executor::NetworkInterfaceMock* ConfigServerTestFixture::networkForAddShard() const { diff --git a/src/mongo/s/grid.h b/src/mongo/s/grid.h index db9a3fbad89..2356b01b029 100644 --- a/src/mongo/s/grid.h +++ b/src/mongo/s/grid.h @@ -30,12 +30,12 @@ #pragma once #include <functional> +#include <memory> #include "mongo/db/repl/optime.h" #include "mongo/s/catalog/sharding_catalog_client.h" #include "mongo/s/catalog_cache.h" #include "mongo/s/client/shard_registry.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" namespace mongo { diff --git a/src/mongo/s/query/async_results_merger_test.cpp b/src/mongo/s/query/async_results_merger_test.cpp index 30d3a182c42..44d0dc30030 100644 --- a/src/mongo/s/query/async_results_merger_test.cpp +++ b/src/mongo/s/query/async_results_merger_test.cpp @@ -31,6 +31,8 @@ #include "mongo/s/query/async_results_merger.h" +#include <memory> + #include "mongo/db/json.h" #include "mongo/db/pipeline/change_stream_constants.h" #include "mongo/db/pipeline/resume_token.h" @@ -40,7 +42,6 @@ #include "mongo/executor/task_executor.h" #include "mongo/s/client/shard_registry.h" #include "mongo/s/query/results_merger_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/unittest.h" @@ -1362,7 +1363,7 @@ DEATH_TEST_F(AsyncResultsMergerTest, params.setTailableMode(TailableModeEnum::kTailableAndAwaitData); params.setSort(change_stream_constants::kSortSpec); auto arm = - stdx::make_unique<AsyncResultsMerger>(operationContext(), executor(), std::move(params)); + std::make_unique<AsyncResultsMerger>(operationContext(), executor(), std::move(params)); auto readyEvent = unittest::assertGet(arm->nextEvent()); ASSERT_FALSE(arm->ready()); @@ -1394,7 +1395,7 @@ DEATH_TEST_F(AsyncResultsMergerTest, params.setTailableMode(TailableModeEnum::kTailableAndAwaitData); params.setSort(change_stream_constants::kSortSpec); auto arm = - stdx::make_unique<AsyncResultsMerger>(operationContext(), executor(), std::move(params)); + std::make_unique<AsyncResultsMerger>(operationContext(), executor(), std::move(params)); auto readyEvent = unittest::assertGet(arm->nextEvent()); ASSERT_TRUE(arm->ready()); @@ -1429,7 +1430,7 @@ TEST_F(AsyncResultsMergerTest, SortedTailableCursorNotReadyIfRemoteHasLowerPostB params.setTailableMode(TailableModeEnum::kTailableAndAwaitData); params.setSort(change_stream_constants::kSortSpec); auto arm = - stdx::make_unique<AsyncResultsMerger>(operationContext(), executor(), std::move(params)); + std::make_unique<AsyncResultsMerger>(operationContext(), executor(), std::move(params)); auto readyEvent = unittest::assertGet(arm->nextEvent()); @@ -1465,7 +1466,7 @@ DEATH_TEST_F(AsyncResultsMergerTest, params.setTailableMode(TailableModeEnum::kTailableAndAwaitData); params.setSort(change_stream_constants::kSortSpec); auto arm = - stdx::make_unique<AsyncResultsMerger>(operationContext(), executor(), std::move(params)); + std::make_unique<AsyncResultsMerger>(operationContext(), executor(), std::move(params)); auto readyEvent = unittest::assertGet(arm->nextEvent()); ASSERT_TRUE(arm->ready()); @@ -1505,7 +1506,7 @@ TEST_F(AsyncResultsMergerTest, SortedTailableCursorIgnoresOplogTimestamp) { params.setTailableMode(TailableModeEnum::kTailableAndAwaitData); params.setSort(change_stream_constants::kSortSpec); auto arm = - stdx::make_unique<AsyncResultsMerger>(operationContext(), executor(), std::move(params)); + std::make_unique<AsyncResultsMerger>(operationContext(), executor(), std::move(params)); auto readyEvent = unittest::assertGet(arm->nextEvent()); @@ -1531,7 +1532,7 @@ TEST_F(AsyncResultsMergerTest, SortedTailableCursorNewShardOrderedAfterExisting) params.setTailableMode(TailableModeEnum::kTailableAndAwaitData); params.setSort(change_stream_constants::kSortSpec); auto arm = - stdx::make_unique<AsyncResultsMerger>(operationContext(), executor(), std::move(params)); + std::make_unique<AsyncResultsMerger>(operationContext(), executor(), std::move(params)); auto readyEvent = unittest::assertGet(arm->nextEvent()); @@ -1613,7 +1614,7 @@ TEST_F(AsyncResultsMergerTest, SortedTailableCursorNewShardOrderedBeforeExisting params.setTailableMode(TailableModeEnum::kTailableAndAwaitData); params.setSort(change_stream_constants::kSortSpec); auto arm = - stdx::make_unique<AsyncResultsMerger>(operationContext(), executor(), std::move(params)); + std::make_unique<AsyncResultsMerger>(operationContext(), executor(), std::move(params)); auto readyEvent = unittest::assertGet(arm->nextEvent()); @@ -1708,7 +1709,7 @@ TEST_F(AsyncResultsMergerTest, SortedTailableCursorReturnsHighWaterMarkSortKey) params.setTailableMode(TailableModeEnum::kTailableAndAwaitData); params.setSort(change_stream_constants::kSortSpec); auto arm = - stdx::make_unique<AsyncResultsMerger>(operationContext(), executor(), std::move(params)); + std::make_unique<AsyncResultsMerger>(operationContext(), executor(), std::move(params)); // We have no results to return, so the ARM is not ready. auto readyEvent = unittest::assertGet(arm->nextEvent()); @@ -1943,7 +1944,7 @@ DEATH_TEST_F(AsyncResultsMergerTest, // This should trigger an invariant. ASSERT_FALSE( - stdx::make_unique<AsyncResultsMerger>(operationContext(), executor(), std::move(params))); + std::make_unique<AsyncResultsMerger>(operationContext(), executor(), std::move(params))); } DEATH_TEST_F(AsyncResultsMergerTest, diff --git a/src/mongo/s/query/cluster_client_cursor_impl.cpp b/src/mongo/s/query/cluster_client_cursor_impl.cpp index 9644abfc432..3db2225e1ae 100644 --- a/src/mongo/s/query/cluster_client_cursor_impl.cpp +++ b/src/mongo/s/query/cluster_client_cursor_impl.cpp @@ -31,11 +31,12 @@ #include "mongo/s/query/cluster_client_cursor_impl.h" +#include <memory> + #include "mongo/s/query/router_stage_limit.h" #include "mongo/s/query/router_stage_merge.h" #include "mongo/s/query/router_stage_remove_metadata_fields.h" #include "mongo/s/query/router_stage_skip.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -230,17 +231,17 @@ std::unique_ptr<RouterExecStage> ClusterClientCursorImpl::buildMergerPlan( std::make_unique<RouterStageMerge>(opCtx, executor, params->extractARMParams()); if (skip) { - root = stdx::make_unique<RouterStageSkip>(opCtx, std::move(root), *skip); + root = std::make_unique<RouterStageSkip>(opCtx, std::move(root), *skip); } if (limit) { - root = stdx::make_unique<RouterStageLimit>(opCtx, std::move(root), *limit); + root = std::make_unique<RouterStageLimit>(opCtx, std::move(root), *limit); } const bool hasSort = !params->sort.isEmpty(); if (hasSort) { // Strip out the sort key after sorting. - root = stdx::make_unique<RouterStageRemoveMetadataFields>( + root = std::make_unique<RouterStageRemoveMetadataFields>( opCtx, std::move(root), std::vector<StringData>{AsyncResultsMerger::kSortKeyField}); } diff --git a/src/mongo/s/query/cluster_client_cursor_impl_test.cpp b/src/mongo/s/query/cluster_client_cursor_impl_test.cpp index fb90fdb1478..215ac79365e 100644 --- a/src/mongo/s/query/cluster_client_cursor_impl_test.cpp +++ b/src/mongo/s/query/cluster_client_cursor_impl_test.cpp @@ -31,11 +31,12 @@ #include "mongo/s/query/cluster_client_cursor_impl.h" +#include <memory> + #include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/service_context_test_fixture.h" #include "mongo/s/query/router_stage_mock.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -50,7 +51,7 @@ protected: }; TEST_F(ClusterClientCursorImplTest, NumReturnedSoFar) { - auto mockStage = stdx::make_unique<RouterStageMock>(_opCtx.get()); + auto mockStage = std::make_unique<RouterStageMock>(_opCtx.get()); for (int i = 1; i < 10; ++i) { mockStage->queueResult(BSON("a" << i)); } @@ -76,7 +77,7 @@ TEST_F(ClusterClientCursorImplTest, NumReturnedSoFar) { } TEST_F(ClusterClientCursorImplTest, QueueResult) { - auto mockStage = stdx::make_unique<RouterStageMock>(_opCtx.get()); + auto mockStage = std::make_unique<RouterStageMock>(_opCtx.get()); mockStage->queueResult(BSON("a" << 1)); mockStage->queueResult(BSON("a" << 4)); @@ -116,7 +117,7 @@ TEST_F(ClusterClientCursorImplTest, QueueResult) { } TEST_F(ClusterClientCursorImplTest, RemotesExhausted) { - auto mockStage = stdx::make_unique<RouterStageMock>(_opCtx.get()); + auto mockStage = std::make_unique<RouterStageMock>(_opCtx.get()); mockStage->queueResult(BSON("a" << 1)); mockStage->queueResult(BSON("a" << 2)); mockStage->markRemotesExhausted(); @@ -148,7 +149,7 @@ TEST_F(ClusterClientCursorImplTest, RemotesExhausted) { } TEST_F(ClusterClientCursorImplTest, ForwardsAwaitDataTimeout) { - auto mockStage = stdx::make_unique<RouterStageMock>(_opCtx.get()); + auto mockStage = std::make_unique<RouterStageMock>(_opCtx.get()); auto mockStagePtr = mockStage.get(); ASSERT_NOT_OK(mockStage->getAwaitDataTimeout().getStatus()); @@ -164,7 +165,7 @@ TEST_F(ClusterClientCursorImplTest, ForwardsAwaitDataTimeout) { } TEST_F(ClusterClientCursorImplTest, ChecksForInterrupt) { - auto mockStage = stdx::make_unique<RouterStageMock>(nullptr); + auto mockStage = std::make_unique<RouterStageMock>(nullptr); for (int i = 1; i < 2; ++i) { mockStage->queueResult(BSON("a" << i)); } @@ -193,14 +194,14 @@ TEST_F(ClusterClientCursorImplTest, ChecksForInterrupt) { TEST_F(ClusterClientCursorImplTest, LogicalSessionIdsOnCursors) { // Make a cursor with no lsid - auto mockStage = stdx::make_unique<RouterStageMock>(_opCtx.get()); + auto mockStage = std::make_unique<RouterStageMock>(_opCtx.get()); ClusterClientCursorParams params(NamespaceString("test"), {}); ClusterClientCursorImpl cursor{ _opCtx.get(), std::move(mockStage), std::move(params), boost::none}; ASSERT(!cursor.getLsid()); // Make a cursor with an lsid - auto mockStage2 = stdx::make_unique<RouterStageMock>(_opCtx.get()); + auto mockStage2 = std::make_unique<RouterStageMock>(_opCtx.get()); ClusterClientCursorParams params2(NamespaceString("test"), {}); auto lsid = makeLogicalSessionIdForTest(); ClusterClientCursorImpl cursor2{_opCtx.get(), std::move(mockStage2), std::move(params2), lsid}; diff --git a/src/mongo/s/query/cluster_cursor_manager_test.cpp b/src/mongo/s/query/cluster_cursor_manager_test.cpp index 8f589a2ea5d..ddd2adaa516 100644 --- a/src/mongo/s/query/cluster_cursor_manager_test.cpp +++ b/src/mongo/s/query/cluster_cursor_manager_test.cpp @@ -31,6 +31,7 @@ #include "mongo/s/query/cluster_cursor_manager.h" +#include <memory> #include <vector> #include "mongo/db/logical_session_cache.h" @@ -38,7 +39,6 @@ #include "mongo/db/operation_context.h" #include "mongo/db/service_context_test_fixture.h" #include "mongo/s/query/cluster_client_cursor_mock.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/clock_source_mock.h" @@ -52,7 +52,7 @@ const NamespaceString nss("test.collection"); class ClusterCursorManagerTest : public ServiceContextTest { protected: ClusterCursorManagerTest() : _opCtx(makeOperationContext()), _manager(&_clockSourceMock) { - LogicalSessionCache::set(getServiceContext(), stdx::make_unique<LogicalSessionCacheNoop>()); + LogicalSessionCache::set(getServiceContext(), std::make_unique<LogicalSessionCacheNoop>()); } ~ClusterCursorManagerTest() { @@ -97,7 +97,7 @@ protected: // (std::list<>::push_back() does not invalidate references, and our list outlives the // manager). bool& killedFlag = _cursorKilledFlags.back(); - return stdx::make_unique<ClusterClientCursorMock>( + return std::make_unique<ClusterClientCursorMock>( std::move(lsid), std::move(txnNumber), [&killedFlag]() { killedFlag = true; }); } diff --git a/src/mongo/s/query/cluster_find.cpp b/src/mongo/s/query/cluster_find.cpp index a41d5a789d7..a60cfb7ddfc 100644 --- a/src/mongo/s/query/cluster_find.cpp +++ b/src/mongo/s/query/cluster_find.cpp @@ -33,6 +33,7 @@ #include "mongo/s/query/cluster_find.h" +#include <memory> #include <set> #include <vector> @@ -62,7 +63,6 @@ #include "mongo/s/query/store_possible_cursor.h" #include "mongo/s/stale_exception.h" #include "mongo/s/transaction_router.h" -#include "mongo/stdx/memory.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/log.h" #include "mongo/util/scopeguard.h" @@ -156,7 +156,7 @@ StatusWith<std::unique_ptr<QueryRequest>> transformQueryForShards( newProjection = projectionBuilder.obj(); } - auto newQR = stdx::make_unique<QueryRequest>(qr); + auto newQR = std::make_unique<QueryRequest>(qr); newQR->setProj(newProjection); newQR->setSkip(boost::none); newQR->setLimit(newLimit); diff --git a/src/mongo/s/query/document_source_merge_cursors.cpp b/src/mongo/s/query/document_source_merge_cursors.cpp index 79634ac15c5..0959e8f6efb 100644 --- a/src/mongo/s/query/document_source_merge_cursors.cpp +++ b/src/mongo/s/query/document_source_merge_cursors.cpp @@ -92,7 +92,7 @@ void DocumentSourceMergeCursors::populateMerger() { std::unique_ptr<RouterStageMerge> DocumentSourceMergeCursors::convertToRouterStage() { invariant(!_blockingResultsMerger, "Expected conversion to happen before execution"); - return stdx::make_unique<RouterStageMerge>(pExpCtx->opCtx, _executor, std::move(*_armParams)); + return std::make_unique<RouterStageMerge>(pExpCtx->opCtx, _executor, std::move(*_armParams)); } DocumentSource::GetNextResult DocumentSourceMergeCursors::getNext() { diff --git a/src/mongo/s/query/establish_cursors_test.cpp b/src/mongo/s/query/establish_cursors_test.cpp index 675cb6dd4cb..c94ed902268 100644 --- a/src/mongo/s/query/establish_cursors_test.cpp +++ b/src/mongo/s/query/establish_cursors_test.cpp @@ -29,6 +29,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/client/remote_command_targeter_factory_mock.h" #include "mongo/client/remote_command_targeter_mock.h" #include "mongo/db/json.h" @@ -37,7 +39,6 @@ #include "mongo/s/client/shard_registry.h" #include "mongo/s/query/establish_cursors.h" #include "mongo/s/sharding_router_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -73,7 +74,7 @@ public: shards.push_back(shardType); std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); targeter->setConnectionStringReturnValue(ConnectionString(kTestShardHosts[i])); targeter->setFindHostReturnValue(kTestShardHosts[i]); diff --git a/src/mongo/s/query/results_merger_test_fixture.cpp b/src/mongo/s/query/results_merger_test_fixture.cpp index e5b29450b92..a9931d32809 100644 --- a/src/mongo/s/query/results_merger_test_fixture.cpp +++ b/src/mongo/s/query/results_merger_test_fixture.cpp @@ -63,7 +63,7 @@ void ResultsMergerTestFixture::setUp() { shards.push_back(shardType); std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); targeter->setConnectionStringReturnValue(ConnectionString(kTestShardHosts[i])); targeter->setFindHostReturnValue(kTestShardHosts[i]); diff --git a/src/mongo/s/query/results_merger_test_fixture.h b/src/mongo/s/query/results_merger_test_fixture.h index 62f504a3ea1..911ab99a1e1 100644 --- a/src/mongo/s/query/results_merger_test_fixture.h +++ b/src/mongo/s/query/results_merger_test_fixture.h @@ -115,7 +115,7 @@ protected: boost::optional<BSONObj> findCmd = boost::none, boost::optional<std::int64_t> getMoreBatchSize = boost::none) { - return stdx::make_unique<AsyncResultsMerger>( + return std::make_unique<AsyncResultsMerger>( operationContext(), executor(), makeARMParamsFromExistingCursors(std::move(remoteCursors), findCmd, getMoreBatchSize)); diff --git a/src/mongo/s/query/router_stage_limit_test.cpp b/src/mongo/s/query/router_stage_limit_test.cpp index 559748d021c..5016e7e52a3 100644 --- a/src/mongo/s/query/router_stage_limit_test.cpp +++ b/src/mongo/s/query/router_stage_limit_test.cpp @@ -31,10 +31,11 @@ #include "mongo/s/query/router_stage_limit.h" +#include <memory> + #include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonobjbuilder.h" #include "mongo/s/query/router_stage_mock.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -46,12 +47,12 @@ namespace { OperationContext* opCtx = nullptr; TEST(RouterStageLimitTest, LimitIsOne) { - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); mockStage->queueResult({BSON("a" << 1)}); mockStage->queueResult({BSON("a" << 2)}); mockStage->queueResult({BSON("a" << 3)}); - auto limitStage = stdx::make_unique<RouterStageLimit>(opCtx, std::move(mockStage), 1); + auto limitStage = std::make_unique<RouterStageLimit>(opCtx, std::move(mockStage), 1); auto firstResult = limitStage->next(RouterExecStage::ExecContext::kInitialFind); ASSERT_OK(firstResult.getStatus()); @@ -69,12 +70,12 @@ TEST(RouterStageLimitTest, LimitIsOne) { } TEST(RouterStageLimitTest, LimitIsTwo) { - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); mockStage->queueResult(BSON("a" << 1)); mockStage->queueResult(BSON("a" << 2)); mockStage->queueError(Status(ErrorCodes::BadValue, "bad thing happened")); - auto limitStage = stdx::make_unique<RouterStageLimit>(opCtx, std::move(mockStage), 2); + auto limitStage = std::make_unique<RouterStageLimit>(opCtx, std::move(mockStage), 2); auto firstResult = limitStage->next(RouterExecStage::ExecContext::kInitialFind); ASSERT_OK(firstResult.getStatus()); @@ -92,13 +93,13 @@ TEST(RouterStageLimitTest, LimitIsTwo) { } TEST(RouterStageLimitTest, LimitStagePropagatesError) { - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); mockStage->queueResult(BSON("a" << 1)); mockStage->queueError(Status(ErrorCodes::BadValue, "bad thing happened")); mockStage->queueResult(BSON("a" << 2)); mockStage->queueResult(BSON("a" << 3)); - auto limitStage = stdx::make_unique<RouterStageLimit>(opCtx, std::move(mockStage), 3); + auto limitStage = std::make_unique<RouterStageLimit>(opCtx, std::move(mockStage), 3); auto firstResult = limitStage->next(RouterExecStage::ExecContext::kInitialFind); ASSERT_OK(firstResult.getStatus()); @@ -115,13 +116,13 @@ TEST(RouterStageLimitTest, LimitStageToleratesMidStreamEOF) { // Here we're mocking the tailable case, where there may be a boost::none returned before the // remote cursor is closed. Our goal is to make sure that the limit stage handles this properly, // not counting boost::none towards the limit. - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); mockStage->queueResult(BSON("a" << 1)); mockStage->queueEOF(); mockStage->queueResult(BSON("a" << 2)); mockStage->queueResult(BSON("a" << 3)); - auto limitStage = stdx::make_unique<RouterStageLimit>(opCtx, std::move(mockStage), 2); + auto limitStage = std::make_unique<RouterStageLimit>(opCtx, std::move(mockStage), 2); auto firstResult = limitStage->next(RouterExecStage::ExecContext::kInitialFind); ASSERT_OK(firstResult.getStatus()); @@ -143,12 +144,12 @@ TEST(RouterStageLimitTest, LimitStageToleratesMidStreamEOF) { } TEST(RouterStageLimitTest, LimitStageRemotesExhausted) { - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); mockStage->queueResult(BSON("a" << 1)); mockStage->queueResult(BSON("a" << 2)); mockStage->markRemotesExhausted(); - auto limitStage = stdx::make_unique<RouterStageLimit>(opCtx, std::move(mockStage), 100); + auto limitStage = std::make_unique<RouterStageLimit>(opCtx, std::move(mockStage), 100); ASSERT_TRUE(limitStage->remotesExhausted()); auto firstResult = limitStage->next(RouterExecStage::ExecContext::kInitialFind); @@ -170,11 +171,11 @@ TEST(RouterStageLimitTest, LimitStageRemotesExhausted) { } TEST(RouterStageLimitTest, ForwardsAwaitDataTimeout) { - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); auto mockStagePtr = mockStage.get(); ASSERT_NOT_OK(mockStage->getAwaitDataTimeout().getStatus()); - auto limitStage = stdx::make_unique<RouterStageLimit>(opCtx, std::move(mockStage), 100); + auto limitStage = std::make_unique<RouterStageLimit>(opCtx, std::move(mockStage), 100); ASSERT_OK(limitStage->setAwaitDataTimeout(Milliseconds(789))); auto awaitDataTimeout = mockStagePtr->getAwaitDataTimeout(); diff --git a/src/mongo/s/query/router_stage_remove_metadata_fields_test.cpp b/src/mongo/s/query/router_stage_remove_metadata_fields_test.cpp index c66f4d6e3d0..abedcbb6122 100644 --- a/src/mongo/s/query/router_stage_remove_metadata_fields_test.cpp +++ b/src/mongo/s/query/router_stage_remove_metadata_fields_test.cpp @@ -31,11 +31,12 @@ #include "mongo/s/query/router_stage_remove_metadata_fields.h" +#include <memory> + #include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/pipeline/document.h" #include "mongo/s/query/router_stage_mock.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -47,7 +48,7 @@ namespace { OperationContext* opCtx = nullptr; TEST(RouterStageRemoveMetadataFieldsTest, RemovesMetaDataFields) { - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); mockStage->queueResult(BSON("a" << 4 << "$sortKey" << 1 << "b" << 3)); mockStage->queueResult(BSON("$sortKey" << BSON("" << 3) << "c" << BSON("d" << "foo"))); @@ -58,7 +59,7 @@ TEST(RouterStageRemoveMetadataFieldsTest, RemovesMetaDataFields) { mockStage->queueResult(BSON("$textScore" << 2)); mockStage->queueResult(BSONObj()); - auto sortKeyStage = stdx::make_unique<RouterStageRemoveMetadataFields>( + auto sortKeyStage = std::make_unique<RouterStageRemoveMetadataFields>( opCtx, std::move(mockStage), Document::allMetadataFieldNames); auto firstResult = sortKeyStage->next(RouterExecStage::ExecContext::kInitialFind); @@ -104,11 +105,11 @@ TEST(RouterStageRemoveMetadataFieldsTest, RemovesMetaDataFields) { } TEST(RouterStageRemoveMetadataFieldsTest, PropagatesError) { - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); mockStage->queueResult(BSON("$sortKey" << 1)); mockStage->queueError(Status(ErrorCodes::BadValue, "bad thing happened")); - auto sortKeyStage = stdx::make_unique<RouterStageRemoveMetadataFields>( + auto sortKeyStage = std::make_unique<RouterStageRemoveMetadataFields>( opCtx, std::move(mockStage), std::vector<StringData>{"$sortKey"_sd}); auto firstResult = sortKeyStage->next(RouterExecStage::ExecContext::kInitialFind); @@ -123,12 +124,12 @@ TEST(RouterStageRemoveMetadataFieldsTest, PropagatesError) { } TEST(RouterStageRemoveMetadataFieldsTest, ToleratesMidStreamEOF) { - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); mockStage->queueResult(BSON("a" << 1 << "$sortKey" << 1 << "b" << 1)); mockStage->queueEOF(); mockStage->queueResult(BSON("a" << 2 << "$sortKey" << 1 << "b" << 2)); - auto sortKeyStage = stdx::make_unique<RouterStageRemoveMetadataFields>( + auto sortKeyStage = std::make_unique<RouterStageRemoveMetadataFields>( opCtx, std::move(mockStage), std::vector<StringData>{"$sortKey"_sd}); auto firstResult = sortKeyStage->next(RouterExecStage::ExecContext::kInitialFind); @@ -151,12 +152,12 @@ TEST(RouterStageRemoveMetadataFieldsTest, ToleratesMidStreamEOF) { } TEST(RouterStageRemoveMetadataFieldsTest, RemotesExhausted) { - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); mockStage->queueResult(BSON("a" << 1 << "$sortKey" << 1 << "b" << 1)); mockStage->queueResult(BSON("a" << 2 << "$sortKey" << 1 << "b" << 2)); mockStage->markRemotesExhausted(); - auto sortKeyStage = stdx::make_unique<RouterStageRemoveMetadataFields>( + auto sortKeyStage = std::make_unique<RouterStageRemoveMetadataFields>( opCtx, std::move(mockStage), std::vector<StringData>{"$sortKey"_sd}); ASSERT_TRUE(sortKeyStage->remotesExhausted()); @@ -179,11 +180,11 @@ TEST(RouterStageRemoveMetadataFieldsTest, RemotesExhausted) { } TEST(RouterStageRemoveMetadataFieldsTest, ForwardsAwaitDataTimeout) { - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); auto mockStagePtr = mockStage.get(); ASSERT_NOT_OK(mockStage->getAwaitDataTimeout().getStatus()); - auto sortKeyStage = stdx::make_unique<RouterStageRemoveMetadataFields>( + auto sortKeyStage = std::make_unique<RouterStageRemoveMetadataFields>( opCtx, std::move(mockStage), std::vector<StringData>{"$sortKey"_sd}); ASSERT_OK(sortKeyStage->setAwaitDataTimeout(Milliseconds(789))); diff --git a/src/mongo/s/query/router_stage_skip_test.cpp b/src/mongo/s/query/router_stage_skip_test.cpp index 38c4cb9fefe..ff6b83aa3ab 100644 --- a/src/mongo/s/query/router_stage_skip_test.cpp +++ b/src/mongo/s/query/router_stage_skip_test.cpp @@ -31,10 +31,11 @@ #include "mongo/s/query/router_stage_skip.h" +#include <memory> + #include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonobjbuilder.h" #include "mongo/s/query/router_stage_mock.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -46,12 +47,12 @@ namespace { OperationContext* opCtx = nullptr; TEST(RouterStageSkipTest, SkipIsOne) { - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); mockStage->queueResult(BSON("a" << 1)); mockStage->queueResult(BSON("a" << 2)); mockStage->queueResult(BSON("a" << 3)); - auto skipStage = stdx::make_unique<RouterStageSkip>(opCtx, std::move(mockStage), 1); + auto skipStage = std::make_unique<RouterStageSkip>(opCtx, std::move(mockStage), 1); auto firstResult = skipStage->next(RouterExecStage::ExecContext::kInitialFind); ASSERT_OK(firstResult.getStatus()); @@ -74,13 +75,13 @@ TEST(RouterStageSkipTest, SkipIsOne) { } TEST(RouterStageSkipTest, SkipIsThree) { - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); mockStage->queueResult(BSON("a" << 1)); mockStage->queueResult(BSON("a" << 2)); mockStage->queueResult(BSON("a" << 3)); mockStage->queueResult(BSON("a" << 4)); - auto skipStage = stdx::make_unique<RouterStageSkip>(opCtx, std::move(mockStage), 3); + auto skipStage = std::make_unique<RouterStageSkip>(opCtx, std::move(mockStage), 3); auto firstResult = skipStage->next(RouterExecStage::ExecContext::kInitialFind); ASSERT_OK(firstResult.getStatus()); @@ -93,12 +94,12 @@ TEST(RouterStageSkipTest, SkipIsThree) { } TEST(RouterStageSkipTest, SkipEqualToResultSetSize) { - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); mockStage->queueResult(BSON("a" << 1)); mockStage->queueResult(BSON("a" << 2)); mockStage->queueResult(BSON("a" << 3)); - auto skipStage = stdx::make_unique<RouterStageSkip>(opCtx, std::move(mockStage), 3); + auto skipStage = std::make_unique<RouterStageSkip>(opCtx, std::move(mockStage), 3); auto firstResult = skipStage->next(RouterExecStage::ExecContext::kInitialFind); ASSERT_OK(firstResult.getStatus()); @@ -106,12 +107,12 @@ TEST(RouterStageSkipTest, SkipEqualToResultSetSize) { } TEST(RouterStageSkipTest, SkipExceedsResultSetSize) { - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); mockStage->queueResult(BSON("a" << 1)); mockStage->queueResult(BSON("a" << 2)); mockStage->queueResult(BSON("a" << 3)); - auto skipStage = stdx::make_unique<RouterStageSkip>(opCtx, std::move(mockStage), 100); + auto skipStage = std::make_unique<RouterStageSkip>(opCtx, std::move(mockStage), 100); auto firstResult = skipStage->next(RouterExecStage::ExecContext::kInitialFind); ASSERT_OK(firstResult.getStatus()); @@ -119,13 +120,13 @@ TEST(RouterStageSkipTest, SkipExceedsResultSetSize) { } TEST(RouterStageSkipTest, ErrorWhileSkippingResults) { - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); mockStage->queueResult(BSON("a" << 1)); mockStage->queueError(Status(ErrorCodes::BadValue, "bad thing happened")); mockStage->queueResult(BSON("a" << 2)); mockStage->queueResult(BSON("a" << 3)); - auto skipStage = stdx::make_unique<RouterStageSkip>(opCtx, std::move(mockStage), 2); + auto skipStage = std::make_unique<RouterStageSkip>(opCtx, std::move(mockStage), 2); auto firstResult = skipStage->next(RouterExecStage::ExecContext::kInitialFind); ASSERT_NOT_OK(firstResult.getStatus()); @@ -134,13 +135,13 @@ TEST(RouterStageSkipTest, ErrorWhileSkippingResults) { } TEST(RouterStageSkipTest, ErrorAfterSkippingResults) { - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); mockStage->queueResult(BSON("a" << 1)); mockStage->queueResult(BSON("a" << 2)); mockStage->queueResult(BSON("a" << 3)); mockStage->queueError(Status(ErrorCodes::BadValue, "bad thing happened")); - auto skipStage = stdx::make_unique<RouterStageSkip>(opCtx, std::move(mockStage), 2); + auto skipStage = std::make_unique<RouterStageSkip>(opCtx, std::move(mockStage), 2); auto firstResult = skipStage->next(RouterExecStage::ExecContext::kInitialFind); ASSERT_OK(firstResult.getStatus()); @@ -155,13 +156,13 @@ TEST(RouterStageSkipTest, ErrorAfterSkippingResults) { TEST(RouterStageSkipTest, SkipStageToleratesMidStreamEOF) { // Skip stage must propagate a boost::none, but not count it towards the skip value. - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); mockStage->queueResult(BSON("a" << 1)); mockStage->queueEOF(); mockStage->queueResult(BSON("a" << 2)); mockStage->queueResult(BSON("a" << 3)); - auto skipStage = stdx::make_unique<RouterStageSkip>(opCtx, std::move(mockStage), 2); + auto skipStage = std::make_unique<RouterStageSkip>(opCtx, std::move(mockStage), 2); auto firstResult = skipStage->next(RouterExecStage::ExecContext::kInitialFind); ASSERT_OK(firstResult.getStatus()); @@ -178,13 +179,13 @@ TEST(RouterStageSkipTest, SkipStageToleratesMidStreamEOF) { } TEST(RouterStageSkipTest, SkipStageRemotesExhausted) { - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); mockStage->queueResult(BSON("a" << 1)); mockStage->queueResult(BSON("a" << 2)); mockStage->queueResult(BSON("a" << 3)); mockStage->markRemotesExhausted(); - auto skipStage = stdx::make_unique<RouterStageSkip>(opCtx, std::move(mockStage), 1); + auto skipStage = std::make_unique<RouterStageSkip>(opCtx, std::move(mockStage), 1); ASSERT_TRUE(skipStage->remotesExhausted()); auto firstResult = skipStage->next(RouterExecStage::ExecContext::kInitialFind); @@ -206,11 +207,11 @@ TEST(RouterStageSkipTest, SkipStageRemotesExhausted) { } TEST(RouterStageSkipTest, ForwardsAwaitDataTimeout) { - auto mockStage = stdx::make_unique<RouterStageMock>(opCtx); + auto mockStage = std::make_unique<RouterStageMock>(opCtx); auto mockStagePtr = mockStage.get(); ASSERT_NOT_OK(mockStage->getAwaitDataTimeout().getStatus()); - auto skipStage = stdx::make_unique<RouterStageSkip>(opCtx, std::move(mockStage), 3); + auto skipStage = std::make_unique<RouterStageSkip>(opCtx, std::move(mockStage), 3); ASSERT_OK(skipStage->setAwaitDataTimeout(Milliseconds(789))); auto awaitDataTimeout = mockStagePtr->getAwaitDataTimeout(); diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp index 53293c690a5..0a4a7fb2cbf 100644 --- a/src/mongo/s/server.cpp +++ b/src/mongo/s/server.cpp @@ -32,6 +32,7 @@ #include "mongo/platform/basic.h" #include <boost/optional.hpp> +#include <memory> #include "mongo/base/init.h" #include "mongo/base/initializer.h" @@ -90,7 +91,6 @@ #include "mongo/s/sharding_initialization.h" #include "mongo/s/sharding_uptime_reporter.h" #include "mongo/s/version_mongos.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/transport/transport_layer_manager.h" #include "mongo/util/admin_access.h" @@ -277,20 +277,18 @@ void cleanupTask(ServiceContext* serviceContext) { } Status initializeSharding(OperationContext* opCtx) { - auto targeterFactory = stdx::make_unique<RemoteCommandTargeterFactoryImpl>(); + auto targeterFactory = std::make_unique<RemoteCommandTargeterFactoryImpl>(); auto targeterFactoryPtr = targeterFactory.get(); - ShardFactory::BuilderCallable setBuilder = - [targeterFactoryPtr](const ShardId& shardId, const ConnectionString& connStr) { - return stdx::make_unique<ShardRemote>( - shardId, connStr, targeterFactoryPtr->create(connStr)); - }; + ShardFactory::BuilderCallable setBuilder = [targeterFactoryPtr]( + const ShardId& shardId, const ConnectionString& connStr) { + return std::make_unique<ShardRemote>(shardId, connStr, targeterFactoryPtr->create(connStr)); + }; - ShardFactory::BuilderCallable masterBuilder = - [targeterFactoryPtr](const ShardId& shardId, const ConnectionString& connStr) { - return stdx::make_unique<ShardRemote>( - shardId, connStr, targeterFactoryPtr->create(connStr)); - }; + ShardFactory::BuilderCallable masterBuilder = [targeterFactoryPtr]( + const ShardId& shardId, const ConnectionString& connStr) { + return std::make_unique<ShardRemote>(shardId, connStr, targeterFactoryPtr->create(connStr)); + }; ShardFactory::BuildersMap buildersMap{ {ConnectionString::SET, std::move(setBuilder)}, @@ -298,24 +296,24 @@ Status initializeSharding(OperationContext* opCtx) { }; auto shardFactory = - stdx::make_unique<ShardFactory>(std::move(buildersMap), std::move(targeterFactory)); + std::make_unique<ShardFactory>(std::move(buildersMap), std::move(targeterFactory)); CatalogCacheLoader::set(opCtx->getServiceContext(), - stdx::make_unique<ConfigServerCatalogCacheLoader>()); + std::make_unique<ConfigServerCatalogCacheLoader>()); Status status = initializeGlobalShardingState( opCtx, mongosGlobalParams.configdbs, generateDistLockProcessId(opCtx), std::move(shardFactory), - stdx::make_unique<CatalogCache>(CatalogCacheLoader::get(opCtx)), + std::make_unique<CatalogCache>(CatalogCacheLoader::get(opCtx)), [opCtx]() { - auto hookList = stdx::make_unique<rpc::EgressMetadataHookList>(); + auto hookList = std::make_unique<rpc::EgressMetadataHookList>(); hookList->addHook( - stdx::make_unique<rpc::LogicalTimeMetadataHook>(opCtx->getServiceContext())); + std::make_unique<rpc::LogicalTimeMetadataHook>(opCtx->getServiceContext())); hookList->addHook( - stdx::make_unique<rpc::CommittedOpTimeMetadataHook>(opCtx->getServiceContext())); - hookList->addHook(stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>( + std::make_unique<rpc::CommittedOpTimeMetadataHook>(opCtx->getServiceContext())); + hookList->addHook(std::make_unique<rpc::ShardingEgressMetadataHookForMongos>( opCtx->getServiceContext())); return hookList; }, @@ -403,8 +401,7 @@ ExitCode runMongosServer(ServiceContext* serviceContext) { initWireSpec(); - serviceContext->setServiceEntryPoint( - stdx::make_unique<ServiceEntryPointMongos>(serviceContext)); + serviceContext->setServiceEntryPoint(std::make_unique<ServiceEntryPointMongos>(serviceContext)); auto tl = transport::TransportLayerManager::createWithConfig(&serverGlobalParams, serviceContext); @@ -415,23 +412,23 @@ ExitCode runMongosServer(ServiceContext* serviceContext) { } serviceContext->setTransportLayer(std::move(tl)); - auto unshardedHookList = stdx::make_unique<rpc::EgressMetadataHookList>(); - unshardedHookList->addHook(stdx::make_unique<rpc::LogicalTimeMetadataHook>(serviceContext)); + auto unshardedHookList = std::make_unique<rpc::EgressMetadataHookList>(); + unshardedHookList->addHook(std::make_unique<rpc::LogicalTimeMetadataHook>(serviceContext)); unshardedHookList->addHook( - stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>(serviceContext)); + std::make_unique<rpc::ShardingEgressMetadataHookForMongos>(serviceContext)); // TODO SERVER-33053: readReplyMetadata is not called on hooks added through // ShardingConnectionHook with _shardedConnections=false, so this hook will not run for // connections using globalConnPool. - unshardedHookList->addHook(stdx::make_unique<rpc::CommittedOpTimeMetadataHook>(serviceContext)); + unshardedHookList->addHook(std::make_unique<rpc::CommittedOpTimeMetadataHook>(serviceContext)); // Add sharding hooks to both connection pools - ShardingConnectionHook includes auth hooks globalConnPool.addHook(new ShardingConnectionHook(false, std::move(unshardedHookList))); - auto shardedHookList = stdx::make_unique<rpc::EgressMetadataHookList>(); - shardedHookList->addHook(stdx::make_unique<rpc::LogicalTimeMetadataHook>(serviceContext)); + auto shardedHookList = std::make_unique<rpc::EgressMetadataHookList>(); + shardedHookList->addHook(std::make_unique<rpc::LogicalTimeMetadataHook>(serviceContext)); shardedHookList->addHook( - stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>(serviceContext)); - shardedHookList->addHook(stdx::make_unique<rpc::CommittedOpTimeMetadataHook>(serviceContext)); + std::make_unique<rpc::ShardingEgressMetadataHookForMongos>(serviceContext)); + shardedHookList->addHook(std::make_unique<rpc::CommittedOpTimeMetadataHook>(serviceContext)); shardConnectionPool.addHook(new ShardingConnectionHook(true, std::move(shardedHookList))); @@ -449,7 +446,7 @@ ExitCode runMongosServer(ServiceContext* serviceContext) { quickExit(EXIT_BADOPTIONS); } - LogicalClock::set(serviceContext, stdx::make_unique<LogicalClock>(serviceContext)); + LogicalClock::set(serviceContext, std::make_unique<LogicalClock>(serviceContext)); auto opCtxHolder = tc->makeOperationContext(); auto const opCtx = opCtxHolder.get(); @@ -505,9 +502,9 @@ ExitCode runMongosServer(ServiceContext* serviceContext) { LogicalSessionCache::set( serviceContext, - stdx::make_unique<LogicalSessionCacheImpl>(stdx::make_unique<ServiceLiaisonMongos>(), - stdx::make_unique<SessionsCollectionSharded>(), - RouterSessionCatalog::reapSessionsOlderThan)); + std::make_unique<LogicalSessionCacheImpl>(std::make_unique<ServiceLiaisonMongos>(), + std::make_unique<SessionsCollectionSharded>(), + RouterSessionCatalog::reapSessionsOlderThan)); status = serviceContext->getServiceExecutor()->start(); if (!status.isOK()) { @@ -563,7 +560,7 @@ void startupConfigActions(const std::vector<std::string>& argv) { } std::unique_ptr<AuthzManagerExternalState> createAuthzManagerExternalStateMongos() { - return stdx::make_unique<AuthzManagerExternalStateMongos>(); + return std::make_unique<AuthzManagerExternalStateMongos>(); } ExitCode main(ServiceContext* serviceContext) { diff --git a/src/mongo/s/shard_key_pattern.cpp b/src/mongo/s/shard_key_pattern.cpp index 9be98ba15b6..554845fc4b5 100644 --- a/src/mongo/s/shard_key_pattern.cpp +++ b/src/mongo/s/shard_key_pattern.cpp @@ -65,7 +65,7 @@ std::vector<std::unique_ptr<FieldRef>> parseShardKeyPattern(const BSONObj& keyPa std::vector<std::unique_ptr<FieldRef>> parsedPaths; for (const auto& patternEl : keyPattern) { - auto newFieldRef(stdx::make_unique<FieldRef>(patternEl.fieldNameStringData())); + auto newFieldRef(std::make_unique<FieldRef>(patternEl.fieldNameStringData())); // Empty path uassert(ErrorCodes::BadValue, @@ -293,7 +293,7 @@ std::vector<StringData> ShardKeyPattern::findMissingShardKeyFieldsFromDoc(const StatusWith<BSONObj> ShardKeyPattern::extractShardKeyFromQuery(OperationContext* opCtx, const BSONObj& basicQuery) const { - auto qr = stdx::make_unique<QueryRequest>(NamespaceString("")); + auto qr = std::make_unique<QueryRequest>(NamespaceString("")); qr->setFilter(basicQuery); const boost::intrusive_ptr<ExpressionContext> expCtx; diff --git a/src/mongo/s/shard_server_test_fixture.cpp b/src/mongo/s/shard_server_test_fixture.cpp index 3bd13f06948..bd42dc5be66 100644 --- a/src/mongo/s/shard_server_test_fixture.cpp +++ b/src/mongo/s/shard_server_test_fixture.cpp @@ -31,6 +31,8 @@ #include "mongo/s/shard_server_test_fixture.h" +#include <memory> + #include "mongo/client/remote_command_targeter_mock.h" #include "mongo/db/commands.h" #include "mongo/db/repl/replication_coordinator_mock.h" @@ -41,7 +43,6 @@ #include "mongo/s/catalog/sharding_catalog_client_impl.h" #include "mongo/s/catalog_cache.h" #include "mongo/s/config_server_catalog_cache_loader.h" -#include "mongo/stdx/memory.h" namespace mongo { namespace { @@ -71,8 +72,8 @@ void ShardServerTestFixture::setUp() { ShardingState::get(getServiceContext())->setInitialized(_myShardName, _clusterId); CatalogCacheLoader::set(getServiceContext(), - stdx::make_unique<ShardServerCatalogCacheLoader>( - stdx::make_unique<ConfigServerCatalogCacheLoader>())); + std::make_unique<ShardServerCatalogCacheLoader>( + std::make_unique<ConfigServerCatalogCacheLoader>())); uassertStatusOK( initializeGlobalShardingStateForMongodForTest(ConnectionString(kConfigHostAndPort))); @@ -89,19 +90,19 @@ void ShardServerTestFixture::tearDown() { } std::unique_ptr<DistLockCatalog> ShardServerTestFixture::makeDistLockCatalog() { - return stdx::make_unique<DistLockCatalogMock>(); + return std::make_unique<DistLockCatalogMock>(); } std::unique_ptr<DistLockManager> ShardServerTestFixture::makeDistLockManager( std::unique_ptr<DistLockCatalog> distLockCatalog) { invariant(distLockCatalog); - return stdx::make_unique<DistLockManagerMock>(std::move(distLockCatalog)); + return std::make_unique<DistLockManagerMock>(std::move(distLockCatalog)); } std::unique_ptr<ShardingCatalogClient> ShardServerTestFixture::makeShardingCatalogClient( std::unique_ptr<DistLockManager> distLockManager) { invariant(distLockManager); - return stdx::make_unique<ShardingCatalogClientImpl>(std::move(distLockManager)); + return std::make_unique<ShardingCatalogClientImpl>(std::move(distLockManager)); } } // namespace mongo diff --git a/src/mongo/s/sharding_initialization.cpp b/src/mongo/s/sharding_initialization.cpp index 6982c7a4687..83fd96367c8 100644 --- a/src/mongo/s/sharding_initialization.cpp +++ b/src/mongo/s/sharding_initialization.cpp @@ -33,6 +33,7 @@ #include "mongo/s/sharding_initialization.h" +#include <memory> #include <string> #include "mongo/base/status.h" @@ -65,7 +66,6 @@ #include "mongo/s/query/cluster_cursor_manager.h" #include "mongo/s/sharding_task_executor.h" #include "mongo/s/sharding_task_executor_pool_gen.h" -#include "mongo/stdx/memory.h" #include "mongo/util/concurrency/thread_pool.h" #include "mongo/util/exit.h" #include "mongo/util/log.h" @@ -86,30 +86,30 @@ static constexpr auto kRetryInterval = Seconds{2}; std::unique_ptr<ShardingCatalogClient> makeCatalogClient(ServiceContext* service, StringData distLockProcessId) { - auto distLockCatalog = stdx::make_unique<DistLockCatalogImpl>(); + auto distLockCatalog = std::make_unique<DistLockCatalogImpl>(); auto distLockManager = - stdx::make_unique<ReplSetDistLockManager>(service, - distLockProcessId, - std::move(distLockCatalog), - ReplSetDistLockManager::kDistLockPingInterval, - ReplSetDistLockManager::kDistLockExpirationTime); + std::make_unique<ReplSetDistLockManager>(service, + distLockProcessId, + std::move(distLockCatalog), + ReplSetDistLockManager::kDistLockPingInterval, + ReplSetDistLockManager::kDistLockExpirationTime); - return stdx::make_unique<ShardingCatalogClientImpl>(std::move(distLockManager)); + return std::make_unique<ShardingCatalogClientImpl>(std::move(distLockManager)); } std::unique_ptr<executor::TaskExecutor> makeShardingFixedTaskExecutor( std::unique_ptr<NetworkInterface> net) { auto executor = - stdx::make_unique<ThreadPoolTaskExecutor>(stdx::make_unique<ThreadPool>([] { - ThreadPool::Options opts; - opts.poolName = "Sharding-Fixed"; - opts.maxThreads = - ThreadPool::Options::kUnlimited; - return opts; - }()), - std::move(net)); - - return stdx::make_unique<executor::ShardingTaskExecutor>(std::move(executor)); + std::make_unique<ThreadPoolTaskExecutor>(std::make_unique<ThreadPool>([] { + ThreadPool::Options opts; + opts.poolName = "Sharding-Fixed"; + opts.maxThreads = + ThreadPool::Options::kUnlimited; + return opts; + }()), + std::move(net)); + + return std::make_unique<executor::ShardingTaskExecutor>(std::move(executor)); } std::unique_ptr<TaskExecutorPool> makeShardingTaskExecutorPool( @@ -124,7 +124,7 @@ std::unique_ptr<TaskExecutorPool> makeShardingTaskExecutorPool( for (size_t i = 0; i < poolSize; ++i) { auto exec = makeShardingTaskExecutor( executor::makeNetworkInterface("TaskExecutorPool-" + std::to_string(i), - stdx::make_unique<ShardingNetworkConnectionHook>(), + std::make_unique<ShardingNetworkConnectionHook>(), metadataHookBuilder(), connPoolOptions)); @@ -134,7 +134,7 @@ std::unique_ptr<TaskExecutorPool> makeShardingTaskExecutorPool( // Add executor used to perform non-performance critical work. auto fixedExec = makeShardingFixedTaskExecutor(std::move(fixedNet)); - auto executorPool = stdx::make_unique<TaskExecutorPool>(); + auto executorPool = std::make_unique<TaskExecutorPool>(); executorPool->addExecutors(std::move(executors), std::move(fixedExec)); return executorPool; } @@ -144,10 +144,10 @@ std::unique_ptr<TaskExecutorPool> makeShardingTaskExecutorPool( std::unique_ptr<executor::TaskExecutor> makeShardingTaskExecutor( std::unique_ptr<NetworkInterface> net) { auto netPtr = net.get(); - auto executor = stdx::make_unique<ThreadPoolTaskExecutor>( - stdx::make_unique<NetworkInterfaceThreadPool>(netPtr), std::move(net)); + auto executor = std::make_unique<ThreadPoolTaskExecutor>( + std::make_unique<NetworkInterfaceThreadPool>(netPtr), std::move(net)); - return stdx::make_unique<executor::ShardingTaskExecutor>(std::move(executor)); + return std::make_unique<executor::ShardingTaskExecutor>(std::move(executor)); } std::string generateDistLockProcessId(OperationContext* opCtx) { @@ -213,11 +213,10 @@ Status initializeGlobalShardingState(OperationContext* opCtx, connPoolOptions.hostTimeout = newHostTimeout; } - auto network = - executor::makeNetworkInterface("ShardRegistry", - stdx::make_unique<ShardingNetworkConnectionHook>(), - hookBuilder(), - connPoolOptions); + auto network = executor::makeNetworkInterface("ShardRegistry", + std::make_unique<ShardingNetworkConnectionHook>(), + hookBuilder(), + connPoolOptions); auto networkPtr = network.get(); auto executorPool = makeShardingTaskExecutorPool( std::move(network), hookBuilder, connPoolOptions, taskExecutorPoolSize); @@ -228,9 +227,9 @@ Status initializeGlobalShardingState(OperationContext* opCtx, grid->init(makeCatalogClient(service, distLockProcessId), std::move(catalogCache), - stdx::make_unique<ShardRegistry>(std::move(shardFactory), configCS), - stdx::make_unique<ClusterCursorManager>(service->getPreciseClockSource()), - stdx::make_unique<BalancerConfiguration>(), + std::make_unique<ShardRegistry>(std::move(shardFactory), configCS), + std::make_unique<ClusterCursorManager>(service->getPreciseClockSource()), + std::make_unique<BalancerConfiguration>(), std::move(executorPool), networkPtr); @@ -241,14 +240,14 @@ Status initializeGlobalShardingState(OperationContext* opCtx, grid->catalogClient()->startup(); auto keysCollectionClient = - stdx::make_unique<KeysCollectionClientSharded>(grid->catalogClient()); + std::make_unique<KeysCollectionClientSharded>(grid->catalogClient()); auto keyManager = std::make_shared<KeysCollectionManager>(KeysCollectionManager::kKeyManagerPurposeString, std::move(keysCollectionClient), Seconds(KeysRotationIntervalSec)); keyManager->startMonitoring(service); - LogicalTimeValidator::set(service, stdx::make_unique<LogicalTimeValidator>(keyManager)); + LogicalTimeValidator::set(service, std::make_unique<LogicalTimeValidator>(keyManager)); return Status::OK(); } diff --git a/src/mongo/s/sharding_initialization.h b/src/mongo/s/sharding_initialization.h index 2121c119007..0a7575b404f 100644 --- a/src/mongo/s/sharding_initialization.h +++ b/src/mongo/s/sharding_initialization.h @@ -31,10 +31,10 @@ #include <boost/optional.hpp> #include <functional> +#include <memory> #include "mongo/base/string_data.h" #include "mongo/bson/oid.h" -#include "mongo/stdx/memory.h" namespace mongo { diff --git a/src/mongo/s/sharding_mongod_test_fixture.cpp b/src/mongo/s/sharding_mongod_test_fixture.cpp index 06081591f0c..7080a938399 100644 --- a/src/mongo/s/sharding_mongod_test_fixture.cpp +++ b/src/mongo/s/sharding_mongod_test_fixture.cpp @@ -32,6 +32,7 @@ #include "mongo/s/sharding_mongod_test_fixture.h" #include <algorithm> +#include <memory> #include <vector> #include "mongo/base/checked_cast.h" @@ -77,7 +78,6 @@ #include "mongo/s/grid.h" #include "mongo/s/query/cluster_cursor_manager.h" #include "mongo/s/request_types/set_shard_version_request.h" -#include "mongo/stdx/memory.h" #include "mongo/util/clock_source_mock.h" #include "mongo/util/tick_source_mock.h" @@ -122,25 +122,25 @@ void ShardingMongodTestFixture::setUp() { repl::ReplicationCoordinator::set(service, std::move(replCoordPtr)); - auto storagePtr = stdx::make_unique<repl::StorageInterfaceMock>(); + auto storagePtr = std::make_unique<repl::StorageInterfaceMock>(); repl::DropPendingCollectionReaper::set( - service, stdx::make_unique<repl::DropPendingCollectionReaper>(storagePtr.get())); + service, std::make_unique<repl::DropPendingCollectionReaper>(storagePtr.get())); repl::ReplicationProcess::set(service, - stdx::make_unique<repl::ReplicationProcess>( + std::make_unique<repl::ReplicationProcess>( storagePtr.get(), - stdx::make_unique<repl::ReplicationConsistencyMarkersMock>(), - stdx::make_unique<repl::ReplicationRecoveryMock>())); + std::make_unique<repl::ReplicationConsistencyMarkersMock>(), + std::make_unique<repl::ReplicationRecoveryMock>())); ASSERT_OK(repl::ReplicationProcess::get(_opCtx.get())->initializeRollbackID(_opCtx.get())); repl::StorageInterface::set(service, std::move(storagePtr)); auto opObserver = checked_cast<OpObserverRegistry*>(service->getOpObserver()); - opObserver->addObserver(stdx::make_unique<OpObserverShardingImpl>()); - opObserver->addObserver(stdx::make_unique<ConfigServerOpObserver>()); - opObserver->addObserver(stdx::make_unique<ShardServerOpObserver>()); + opObserver->addObserver(std::make_unique<OpObserverShardingImpl>()); + opObserver->addObserver(std::make_unique<ConfigServerOpObserver>()); + opObserver->addObserver(std::make_unique<ShardServerOpObserver>()); repl::setOplogCollectionName(service); repl::createOplog(_opCtx.get()); @@ -154,7 +154,7 @@ void ShardingMongodTestFixture::setUp() { std::unique_ptr<ReplicationCoordinatorMock> ShardingMongodTestFixture::makeReplicationCoordinator( ReplSettings replSettings) { auto coordinator = - stdx::make_unique<repl::ReplicationCoordinatorMock>(getServiceContext(), replSettings); + std::make_unique<repl::ReplicationCoordinatorMock>(getServiceContext(), replSettings); ASSERT_OK(coordinator->setFollowerMode(repl::MemberState::RS_PRIMARY)); return coordinator; } @@ -163,7 +163,7 @@ std::unique_ptr<executor::TaskExecutorPool> ShardingMongodTestFixture::makeTaskE // Set up a NetworkInterfaceMock. Note, unlike NetworkInterfaceASIO, which has its own pool of // threads, tasks in the NetworkInterfaceMock must be carried out synchronously by the (single) // thread the unit test is running on. - auto netForFixedTaskExecutor = stdx::make_unique<executor::NetworkInterfaceMock>(); + auto netForFixedTaskExecutor = std::make_unique<executor::NetworkInterfaceMock>(); _mockNetwork = netForFixedTaskExecutor.get(); // Set up a ThreadPoolTaskExecutor. Note, for local tasks this TaskExecutor uses a @@ -172,15 +172,15 @@ std::unique_ptr<executor::TaskExecutorPool> ShardingMongodTestFixture::makeTaskE // again just the (single) thread the unit test is running on. Therefore, all tasks, local and // remote, must be carried out synchronously by the test thread. auto fixedTaskExecutor = makeThreadPoolTestExecutor(std::move(netForFixedTaskExecutor)); - _networkTestEnv = stdx::make_unique<NetworkTestEnv>(fixedTaskExecutor.get(), _mockNetwork); + _networkTestEnv = std::make_unique<NetworkTestEnv>(fixedTaskExecutor.get(), _mockNetwork); // Set up (one) TaskExecutor for the set of arbitrary TaskExecutors. std::vector<std::unique_ptr<executor::TaskExecutor>> arbitraryExecutorsForExecutorPool; arbitraryExecutorsForExecutorPool.emplace_back( - makeThreadPoolTestExecutor(stdx::make_unique<executor::NetworkInterfaceMock>())); + makeThreadPoolTestExecutor(std::make_unique<executor::NetworkInterfaceMock>())); // Set up the TaskExecutorPool with the fixed TaskExecutor and set of arbitrary TaskExecutors. - auto executorPool = stdx::make_unique<executor::TaskExecutorPool>(); + auto executorPool = std::make_unique<executor::TaskExecutorPool>(); executorPool->addExecutors(std::move(arbitraryExecutorsForExecutorPool), std::move(fixedTaskExecutor)); @@ -189,21 +189,19 @@ std::unique_ptr<executor::TaskExecutorPool> ShardingMongodTestFixture::makeTaskE std::unique_ptr<ShardRegistry> ShardingMongodTestFixture::makeShardRegistry( ConnectionString configConnStr) { - auto targeterFactory(stdx::make_unique<RemoteCommandTargeterFactoryMock>()); + auto targeterFactory(std::make_unique<RemoteCommandTargeterFactoryMock>()); auto targeterFactoryPtr = targeterFactory.get(); _targeterFactory = targeterFactoryPtr; - ShardFactory::BuilderCallable setBuilder = - [targeterFactoryPtr](const ShardId& shardId, const ConnectionString& connStr) { - return stdx::make_unique<ShardRemote>( - shardId, connStr, targeterFactoryPtr->create(connStr)); - }; + ShardFactory::BuilderCallable setBuilder = [targeterFactoryPtr]( + const ShardId& shardId, const ConnectionString& connStr) { + return std::make_unique<ShardRemote>(shardId, connStr, targeterFactoryPtr->create(connStr)); + }; - ShardFactory::BuilderCallable masterBuilder = - [targeterFactoryPtr](const ShardId& shardId, const ConnectionString& connStr) { - return stdx::make_unique<ShardRemote>( - shardId, connStr, targeterFactoryPtr->create(connStr)); - }; + ShardFactory::BuilderCallable masterBuilder = [targeterFactoryPtr]( + const ShardId& shardId, const ConnectionString& connStr) { + return std::make_unique<ShardRemote>(shardId, connStr, targeterFactoryPtr->create(connStr)); + }; ShardFactory::BuildersMap buildersMap{{ConnectionString::SET, std::move(setBuilder)}, {ConnectionString::MASTER, std::move(masterBuilder)}}; @@ -212,7 +210,7 @@ std::unique_ptr<ShardRegistry> ShardingMongodTestFixture::makeShardRegistry( if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer) { ShardFactory::BuilderCallable localBuilder = [](const ShardId& shardId, const ConnectionString& connStr) { - return stdx::make_unique<ShardLocal>(shardId); + return std::make_unique<ShardLocal>(shardId); }; buildersMap.insert( std::pair<ConnectionString::ConnectionType, ShardFactory::BuilderCallable>( @@ -220,9 +218,9 @@ std::unique_ptr<ShardRegistry> ShardingMongodTestFixture::makeShardRegistry( } auto shardFactory = - stdx::make_unique<ShardFactory>(std::move(buildersMap), std::move(targeterFactory)); + std::make_unique<ShardFactory>(std::move(buildersMap), std::move(targeterFactory)); - return stdx::make_unique<ShardRegistry>(std::move(shardFactory), configConnStr); + return std::make_unique<ShardRegistry>(std::move(shardFactory), configConnStr); } std::unique_ptr<DistLockCatalog> ShardingMongodTestFixture::makeDistLockCatalog() { @@ -268,7 +266,7 @@ Status ShardingMongodTestFixture::initializeGlobalShardingStateForMongodForTest( auto const grid = Grid::get(operationContext()); grid->init(makeShardingCatalogClient(std::move(distLockManagerPtr)), - stdx::make_unique<CatalogCache>(CatalogCacheLoader::get(getServiceContext())), + std::make_unique<CatalogCache>(CatalogCacheLoader::get(getServiceContext())), makeShardRegistry(configConnStr), makeClusterCursorManager(), makeBalancerConfiguration(), diff --git a/src/mongo/s/sharding_router_test_fixture.cpp b/src/mongo/s/sharding_router_test_fixture.cpp index 83b050d4295..63ff2cdb67d 100644 --- a/src/mongo/s/sharding_router_test_fixture.cpp +++ b/src/mongo/s/sharding_router_test_fixture.cpp @@ -32,6 +32,7 @@ #include "mongo/s/sharding_router_test_fixture.h" #include <algorithm> +#include <memory> #include <vector> #include "mongo/bson/simple_bsonobj_comparator.h" @@ -69,7 +70,6 @@ #include "mongo/s/sharding_egress_metadata_hook_for_mongos.h" #include "mongo/s/sharding_task_executor.h" #include "mongo/s/write_ops/batched_command_response.h" -#include "mongo/stdx/memory.h" #include "mongo/transport/mock_session.h" #include "mongo/transport/transport_layer_mock.h" #include "mongo/util/clock_source_mock.h" @@ -89,7 +89,7 @@ namespace { std::unique_ptr<ShardingTaskExecutor> makeShardingTestExecutor( std::unique_ptr<NetworkInterfaceMock> net) { auto testExecutor = makeThreadPoolTestExecutor(std::move(net)); - return stdx::make_unique<ShardingTaskExecutor>(std::move(testExecutor)); + return std::make_unique<ShardingTaskExecutor>(std::move(testExecutor)); } } // namespace @@ -98,71 +98,69 @@ ShardingTestFixture::ShardingTestFixture() { auto const service = getServiceContext(); // Configure the service context - service->setFastClockSource(stdx::make_unique<ClockSourceMock>()); - service->setPreciseClockSource(stdx::make_unique<ClockSourceMock>()); - service->setTickSource(stdx::make_unique<TickSourceMock<>>()); + service->setFastClockSource(std::make_unique<ClockSourceMock>()); + service->setPreciseClockSource(std::make_unique<ClockSourceMock>()); + service->setTickSource(std::make_unique<TickSourceMock<>>()); - CollatorFactoryInterface::set(service, stdx::make_unique<CollatorFactoryMock>()); + CollatorFactoryInterface::set(service, std::make_unique<CollatorFactoryMock>()); _transportSession = transport::MockSession::create(nullptr); _opCtx = makeOperationContext(); // Set up executor pool used for most operations. auto makeMetadataHookList = [&] { - auto hookList = stdx::make_unique<rpc::EgressMetadataHookList>(); - hookList->addHook(stdx::make_unique<rpc::LogicalTimeMetadataHook>(service)); - hookList->addHook(stdx::make_unique<rpc::CommittedOpTimeMetadataHook>(service)); - hookList->addHook(stdx::make_unique<rpc::ShardingEgressMetadataHookForMongos>(service)); + auto hookList = std::make_unique<rpc::EgressMetadataHookList>(); + hookList->addHook(std::make_unique<rpc::LogicalTimeMetadataHook>(service)); + hookList->addHook(std::make_unique<rpc::CommittedOpTimeMetadataHook>(service)); + hookList->addHook(std::make_unique<rpc::ShardingEgressMetadataHookForMongos>(service)); return hookList; }; - auto fixedNet = stdx::make_unique<executor::NetworkInterfaceMock>(); + auto fixedNet = std::make_unique<executor::NetworkInterfaceMock>(); fixedNet->setEgressMetadataHook(makeMetadataHookList()); _mockNetwork = fixedNet.get(); auto fixedExec = makeShardingTestExecutor(std::move(fixedNet)); - _networkTestEnv = stdx::make_unique<NetworkTestEnv>(fixedExec.get(), _mockNetwork); + _networkTestEnv = std::make_unique<NetworkTestEnv>(fixedExec.get(), _mockNetwork); _executor = fixedExec.get(); - auto netForPool = stdx::make_unique<executor::NetworkInterfaceMock>(); + auto netForPool = std::make_unique<executor::NetworkInterfaceMock>(); netForPool->setEgressMetadataHook(makeMetadataHookList()); auto _mockNetworkForPool = netForPool.get(); auto execForPool = makeShardingTestExecutor(std::move(netForPool)); _networkTestEnvForPool = - stdx::make_unique<NetworkTestEnv>(execForPool.get(), _mockNetworkForPool); + std::make_unique<NetworkTestEnv>(execForPool.get(), _mockNetworkForPool); std::vector<std::unique_ptr<executor::TaskExecutor>> executorsForPool; executorsForPool.emplace_back(std::move(execForPool)); - auto executorPool = stdx::make_unique<executor::TaskExecutorPool>(); + auto executorPool = std::make_unique<executor::TaskExecutorPool>(); executorPool->addExecutors(std::move(executorsForPool), std::move(fixedExec)); - auto uniqueDistLockManager = stdx::make_unique<DistLockManagerMock>(nullptr); + auto uniqueDistLockManager = std::make_unique<DistLockManagerMock>(nullptr); _distLockManager = uniqueDistLockManager.get(); std::unique_ptr<ShardingCatalogClientImpl> catalogClient( - stdx::make_unique<ShardingCatalogClientImpl>(std::move(uniqueDistLockManager))); + std::make_unique<ShardingCatalogClientImpl>(std::move(uniqueDistLockManager))); catalogClient->startup(); ConnectionString configCS = ConnectionString::forReplicaSet( "configRS", {HostAndPort{"TestHost1"}, HostAndPort{"TestHost2"}}); - auto targeterFactory(stdx::make_unique<RemoteCommandTargeterFactoryMock>()); + auto targeterFactory(std::make_unique<RemoteCommandTargeterFactoryMock>()); auto targeterFactoryPtr = targeterFactory.get(); _targeterFactory = targeterFactoryPtr; - auto configTargeter(stdx::make_unique<RemoteCommandTargeterMock>()); + auto configTargeter(std::make_unique<RemoteCommandTargeterMock>()); _configTargeter = configTargeter.get(); _targeterFactory->addTargeterToReturn(configCS, std::move(configTargeter)); - ShardFactory::BuilderCallable setBuilder = - [targeterFactoryPtr](const ShardId& shardId, const ConnectionString& connStr) { - return stdx::make_unique<ShardRemote>( - shardId, connStr, targeterFactoryPtr->create(connStr)); - }; + ShardFactory::BuilderCallable setBuilder = [targeterFactoryPtr]( + const ShardId& shardId, const ConnectionString& connStr) { + return std::make_unique<ShardRemote>(shardId, connStr, targeterFactoryPtr->create(connStr)); + }; - ShardFactory::BuilderCallable masterBuilder = - [targeterFactoryPtr](const ShardId& shardId, const ConnectionString& connStr) { - return stdx::make_unique<ShardRemote>( - shardId, connStr, targeterFactoryPtr->create(connStr)); - }; + ShardFactory::BuilderCallable masterBuilder = [targeterFactoryPtr]( + const ShardId& shardId, const ConnectionString& connStr) { + return std::make_unique<ShardRemote>(shardId, connStr, targeterFactoryPtr->create(connStr)); + }; ShardFactory::BuildersMap buildersMap{ {ConnectionString::SET, std::move(setBuilder)}, @@ -170,21 +168,21 @@ ShardingTestFixture::ShardingTestFixture() { }; auto shardFactory = - stdx::make_unique<ShardFactory>(std::move(buildersMap), std::move(targeterFactory)); + std::make_unique<ShardFactory>(std::move(buildersMap), std::move(targeterFactory)); - auto shardRegistry(stdx::make_unique<ShardRegistry>(std::move(shardFactory), configCS)); + auto shardRegistry(std::make_unique<ShardRegistry>(std::move(shardFactory), configCS)); executorPool->startup(); - CatalogCacheLoader::set(service, stdx::make_unique<ConfigServerCatalogCacheLoader>()); + CatalogCacheLoader::set(service, std::make_unique<ConfigServerCatalogCacheLoader>()); // For now initialize the global grid object. All sharding objects will be accessible from there // until we get rid of it. Grid::get(operationContext()) ->init(std::move(catalogClient), - stdx::make_unique<CatalogCache>(CatalogCacheLoader::get(service)), + std::make_unique<CatalogCache>(CatalogCacheLoader::get(service)), std::move(shardRegistry), - stdx::make_unique<ClusterCursorManager>(service->getPreciseClockSource()), - stdx::make_unique<BalancerConfiguration>(), + std::make_unique<ClusterCursorManager>(service->getPreciseClockSource()), + std::make_unique<BalancerConfiguration>(), std::move(executorPool), _mockNetwork); } @@ -252,7 +250,7 @@ void ShardingTestFixture::addRemoteShards( shards.push_back(shardType); std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); targeter->setConnectionStringReturnValue(ConnectionString(std::get<1>(shard))); targeter->setFindHostReturnValue(std::get<1>(shard)); diff --git a/src/mongo/s/transaction_router_test.cpp b/src/mongo/s/transaction_router_test.cpp index 1555f11972f..01d8223a425 100644 --- a/src/mongo/s/transaction_router_test.cpp +++ b/src/mongo/s/transaction_router_test.cpp @@ -114,16 +114,16 @@ protected: repl::ReadConcernArgs(repl::ReadConcernLevel::kSnapshotReadConcern); // Set up a logical clock with an initial time. - auto logicalClock = stdx::make_unique<LogicalClock>(getServiceContext()); + auto logicalClock = std::make_unique<LogicalClock>(getServiceContext()); logicalClock->setClusterTimeFromTrustedSource(kInMemoryLogicalTime); LogicalClock::set(getServiceContext(), std::move(logicalClock)); // Set up a tick source for transaction metrics. - auto tickSource = stdx::make_unique<TickSourceMock<Microseconds>>(); + auto tickSource = std::make_unique<TickSourceMock<Microseconds>>(); tickSource->reset(1); getServiceContext()->setTickSource(std::move(tickSource)); - _staleVersionAndSnapshotRetriesBlock = stdx::make_unique<FailPointEnableBlock>( + _staleVersionAndSnapshotRetriesBlock = std::make_unique<FailPointEnableBlock>( "enableStaleVersionAndSnapshotRetriesWithinTransactions"); } diff --git a/src/mongo/s/write_ops/batch_write_exec_test.cpp b/src/mongo/s/write_ops/batch_write_exec_test.cpp index aaaaf2eb7fe..d0c2434c13c 100644 --- a/src/mongo/s/write_ops/batch_write_exec_test.cpp +++ b/src/mongo/s/write_ops/batch_write_exec_test.cpp @@ -116,7 +116,7 @@ public: // Add a RemoteCommandTargeter for the data shard. std::unique_ptr<RemoteCommandTargeterMock> targeter( - stdx::make_unique<RemoteCommandTargeterMock>()); + std::make_unique<RemoteCommandTargeterMock>()); targeter->setConnectionStringReturnValue(ConnectionString(kTestShardHost)); targeter->setFindHostReturnValue(kTestShardHost); targeterFactory()->addTargeterToReturn(ConnectionString(kTestShardHost), @@ -633,7 +633,7 @@ public: repl::ReadConcernArgs::get(operationContext()) = repl::ReadConcernArgs(repl::ReadConcernLevel::kSnapshotReadConcern); - auto logicalClock = stdx::make_unique<LogicalClock>(getServiceContext()); + auto logicalClock = std::make_unique<LogicalClock>(getServiceContext()); logicalClock->setClusterTimeFromTrustedSource(kInMemoryLogicalTime); LogicalClock::set(getServiceContext(), std::move(logicalClock)); diff --git a/src/mongo/s/write_ops/batch_write_op.cpp b/src/mongo/s/write_ops/batch_write_op.cpp index 7c877882186..79abd418faf 100644 --- a/src/mongo/s/write_ops/batch_write_op.cpp +++ b/src/mongo/s/write_ops/batch_write_op.cpp @@ -31,13 +31,13 @@ #include "mongo/s/write_ops/batch_write_op.h" +#include <memory> #include <numeric> #include "mongo/base/error_codes.h" #include "mongo/db/operation_context.h" #include "mongo/db/ops/write_ops_parsers.h" #include "mongo/s/transaction_router.h" -#include "mongo/stdx/memory.h" #include "mongo/util/transitional_tools_do_not_use/vector_spooling.h" namespace mongo { @@ -643,7 +643,7 @@ void BatchWriteOp::noteBatchResponse(const TargetedWriteBatch& targetedBatch, int batchIndex = targetedBatch.getWrites()[childBatchIndex]->writeOpRef.first; // Push the upserted id with the correct index into the batch upserted ids - auto upsertedId = stdx::make_unique<BatchedUpsertDetail>(); + auto upsertedId = std::make_unique<BatchedUpsertDetail>(); upsertedId->setIndex(batchIndex); upsertedId->setUpsertedID(childUpsertedId->getUpsertedID()); _upsertedIds.push_back(std::move(upsertedId)); @@ -662,7 +662,7 @@ void BatchWriteOp::noteBatchError(const TargetedWriteBatch& targetedBatch, _clientRequest.getWriteCommandBase().getOrdered() ? 1 : targetedBatch.getWrites().size(); for (int i = 0; i < numErrors; i++) { - auto errorClone(stdx::make_unique<WriteErrorDetail>()); + auto errorClone(std::make_unique<WriteErrorDetail>()); error.cloneTo(errorClone.get()); errorClone->setIndex(i); emulatedResponse.addToErrDetails(errorClone.release()); diff --git a/src/mongo/s/write_ops/batched_command_request.h b/src/mongo/s/write_ops/batched_command_request.h index b49e893e5aa..7b7700b5df4 100644 --- a/src/mongo/s/write_ops/batched_command_request.h +++ b/src/mongo/s/write_ops/batched_command_request.h @@ -30,11 +30,11 @@ #pragma once #include <boost/optional.hpp> +#include <memory> #include "mongo/db/ops/write_ops.h" #include "mongo/rpc/op_msg.h" #include "mongo/s/chunk_version.h" -#include "mongo/stdx/memory.h" namespace mongo { @@ -48,15 +48,15 @@ public: BatchedCommandRequest(write_ops::Insert insertOp) : _batchType(BatchType_Insert), - _insertReq(stdx::make_unique<write_ops::Insert>(std::move(insertOp))) {} + _insertReq(std::make_unique<write_ops::Insert>(std::move(insertOp))) {} BatchedCommandRequest(write_ops::Update updateOp) : _batchType(BatchType_Update), - _updateReq(stdx::make_unique<write_ops::Update>(std::move(updateOp))) {} + _updateReq(std::make_unique<write_ops::Update>(std::move(updateOp))) {} BatchedCommandRequest(write_ops::Delete deleteOp) : _batchType(BatchType_Delete), - _deleteReq(stdx::make_unique<write_ops::Delete>(std::move(deleteOp))) {} + _deleteReq(std::make_unique<write_ops::Delete>(std::move(deleteOp))) {} BatchedCommandRequest(BatchedCommandRequest&&) = default; diff --git a/src/mongo/s/write_ops/batched_command_request_test.cpp b/src/mongo/s/write_ops/batched_command_request_test.cpp index 079960cf320..46de1d76efb 100644 --- a/src/mongo/s/write_ops/batched_command_request_test.cpp +++ b/src/mongo/s/write_ops/batched_command_request_test.cpp @@ -29,10 +29,11 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/bson/json.h" #include "mongo/db/ops/write_ops_parsers_test_helpers.h" #include "mongo/s/write_ops/batched_command_request.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { diff --git a/src/mongo/s/write_ops/batched_command_response_test.cpp b/src/mongo/s/write_ops/batched_command_response_test.cpp index 09e2b7d0eed..b34f8cb7770 100644 --- a/src/mongo/s/write_ops/batched_command_response_test.cpp +++ b/src/mongo/s/write_ops/batched_command_response_test.cpp @@ -29,12 +29,12 @@ #include "mongo/platform/basic.h" +#include <memory> #include <string> #include "mongo/db/jsobj.h" #include "mongo/s/write_ops/batched_command_response.h" #include "mongo/s/write_ops/write_error_detail.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { @@ -88,7 +88,7 @@ TEST(BatchedCommandResponse, TooManySmallErrors) { const auto bigstr = std::string(1024, 'x'); for (int i = 0; i < 100'000; i++) { - auto errDetail = stdx::make_unique<WriteErrorDetail>(); + auto errDetail = std::make_unique<WriteErrorDetail>(); errDetail->setIndex(i); errDetail->setStatus({ErrorCodes::BadValue, bigstr}); response.addToErrDetails(errDetail.release()); @@ -120,7 +120,7 @@ TEST(BatchedCommandResponse, TooManyBigErrors) { const auto smallstr = std::string(10, 'x'); for (int i = 0; i < 100'000; i++) { - auto errDetail = stdx::make_unique<WriteErrorDetail>(); + auto errDetail = std::make_unique<WriteErrorDetail>(); errDetail->setIndex(i); errDetail->setStatus({ErrorCodes::BadValue, // i < 10 ? bigstr : smallstr}); // Don't waste too much RAM. diff --git a/src/mongo/s/write_ops/chunk_manager_targeter.cpp b/src/mongo/s/write_ops/chunk_manager_targeter.cpp index 91f0d94505d..22c4a0fcde9 100644 --- a/src/mongo/s/write_ops/chunk_manager_targeter.cpp +++ b/src/mongo/s/write_ops/chunk_manager_targeter.cpp @@ -194,7 +194,7 @@ bool isExactIdQuery(OperationContext* opCtx, const BSONObj query, const BSONObj collation, ChunkManager* manager) { - auto qr = stdx::make_unique<QueryRequest>(nss); + auto qr = std::make_unique<QueryRequest>(nss); qr->setFilter(query); if (!collation.isEmpty()) { qr->setCollation(collation); @@ -541,7 +541,7 @@ StatusWith<std::vector<ShardEndpoint>> ChunkManagerTargeter::targetDelete( // We failed to target a single shard. // Parse delete query. - auto qr = stdx::make_unique<QueryRequest>(getNS()); + auto qr = std::make_unique<QueryRequest>(getNS()); qr->setFilter(deleteDoc.getQ()); if (!collation.isEmpty()) { qr->setCollation(collation); diff --git a/src/mongo/s/write_ops/mock_ns_targeter.h b/src/mongo/s/write_ops/mock_ns_targeter.h index 2e4263a00f0..61380771d2a 100644 --- a/src/mongo/s/write_ops/mock_ns_targeter.h +++ b/src/mongo/s/write_ops/mock_ns_targeter.h @@ -29,11 +29,12 @@ #pragma once +#include <memory> + #include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonobjbuilder.h" #include "mongo/s/catalog/type_chunk.h" #include "mongo/s/ns_targeter.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" namespace mongo { diff --git a/src/mongo/scripting/mozjs/code.cpp b/src/mongo/scripting/mozjs/code.cpp index 957a6e5feb9..ed34739c07e 100644 --- a/src/mongo/scripting/mozjs/code.cpp +++ b/src/mongo/scripting/mozjs/code.cpp @@ -31,12 +31,13 @@ #include "mongo/scripting/mozjs/code.h" +#include <memory> + #include "mongo/scripting/mozjs/implscope.h" #include "mongo/scripting/mozjs/objectwrapper.h" #include "mongo/scripting/mozjs/valuereader.h" #include "mongo/scripting/mozjs/valuewriter.h" #include "mongo/scripting/mozjs/wrapconstrainedmethod.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { diff --git a/src/mongo/scripting/mozjs/implscope.cpp b/src/mongo/scripting/mozjs/implscope.cpp index 4bf7815e924..33ea1308953 100644 --- a/src/mongo/scripting/mozjs/implscope.cpp +++ b/src/mongo/scripting/mozjs/implscope.cpp @@ -33,6 +33,8 @@ #include "mongo/scripting/mozjs/implscope.h" +#include <memory> + #include <js/CharacterEncoding.h> #include <jscustomallocator.h> #include <jsfriendapi.h> @@ -45,7 +47,6 @@ #include "mongo/scripting/mozjs/objectwrapper.h" #include "mongo/scripting/mozjs/valuereader.h" #include "mongo/scripting/mozjs/valuewriter.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" diff --git a/src/mongo/scripting/mozjs/jsthread.cpp b/src/mongo/scripting/mozjs/jsthread.cpp index a46e60c9fe1..a52e3398529 100644 --- a/src/mongo/scripting/mozjs/jsthread.cpp +++ b/src/mongo/scripting/mozjs/jsthread.cpp @@ -33,15 +33,15 @@ #include "mongo/scripting/mozjs/jsthread.h" -#include "vm/PosixNSPR.h" #include <cstdio> +#include <memory> +#include <vm/PosixNSPR.h> #include "mongo/db/jsobj.h" #include "mongo/scripting/mozjs/implscope.h" #include "mongo/scripting/mozjs/valuereader.h" #include "mongo/scripting/mozjs/valuewriter.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/util/log.h" diff --git a/src/mongo/scripting/mozjs/mongo.cpp b/src/mongo/scripting/mozjs/mongo.cpp index 6d23852be71..a2ef99c93f7 100644 --- a/src/mongo/scripting/mozjs/mongo.cpp +++ b/src/mongo/scripting/mozjs/mongo.cpp @@ -31,6 +31,8 @@ #include "mongo/scripting/mozjs/mongo.h" +#include <memory> + #include "mongo/bson/simple_bsonelement_comparator.h" #include "mongo/client/dbclient_base.h" #include "mongo/client/dbclient_rs.h" @@ -53,7 +55,6 @@ #include "mongo/scripting/mozjs/valuereader.h" #include "mongo/scripting/mozjs/valuewriter.h" #include "mongo/scripting/mozjs/wrapconstrainedmethod.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/quick_exit.h" @@ -590,7 +591,7 @@ void MongoBase::Functions::cursorFromId::call(JSContext* cx, JS::CallArgs args) long long cursorId = NumberLongInfo::ToNumberLong(cx, args.get(1)); // The shell only calls this method when it wants to test OP_GETMORE. - auto cursor = stdx::make_unique<DBClientCursor>( + auto cursor = std::make_unique<DBClientCursor>( conn, NamespaceString(ns), cursorId, 0, DBClientCursor::QueryOptionLocal_forceOpQuery); if (args.get(2).isNumber()) diff --git a/src/mongo/scripting/mozjs/oid.cpp b/src/mongo/scripting/mozjs/oid.cpp index f70d92265f5..edbc56990ed 100644 --- a/src/mongo/scripting/mozjs/oid.cpp +++ b/src/mongo/scripting/mozjs/oid.cpp @@ -31,12 +31,13 @@ #include "mongo/scripting/mozjs/oid.h" +#include <memory> + #include "mongo/scripting/mozjs/implscope.h" #include "mongo/scripting/mozjs/objectwrapper.h" #include "mongo/scripting/mozjs/valuereader.h" #include "mongo/scripting/mozjs/valuewriter.h" #include "mongo/scripting/mozjs/wrapconstrainedmethod.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { diff --git a/src/mongo/scripting/mozjs/uri.cpp b/src/mongo/scripting/mozjs/uri.cpp index f381eae9298..f0bacecb92e 100644 --- a/src/mongo/scripting/mozjs/uri.cpp +++ b/src/mongo/scripting/mozjs/uri.cpp @@ -33,6 +33,7 @@ #include <algorithm> #include <iterator> +#include <memory> #include "mongo/client/mongo_uri.h" #include "mongo/scripting/mozjs/implscope.h" @@ -40,7 +41,6 @@ #include "mongo/scripting/mozjs/valuereader.h" #include "mongo/scripting/mozjs/valuewriter.h" #include "mongo/scripting/mozjs/wrapconstrainedmethod.h" -#include "mongo/stdx/memory.h" #include "mongo/util/str.h" namespace mongo { diff --git a/src/mongo/shell/bench.cpp b/src/mongo/shell/bench.cpp index 9d8cea8639f..cc523d8ac77 100644 --- a/src/mongo/shell/bench.cpp +++ b/src/mongo/shell/bench.cpp @@ -290,7 +290,7 @@ void doNothing(const BSONObj&) {} Timestamp getLatestClusterTime(DBClientBase* conn) { // Sort by descending 'ts' in the query to the oplog collection. The first entry will have the // latest cluster time. - auto qr = stdx::make_unique<QueryRequest>(NamespaceString("local.oplog.rs")); + auto qr = std::make_unique<QueryRequest>(NamespaceString("local.oplog.rs")); qr->setSort(BSON("$natural" << -1)); qr->setLimit(1LL); qr->setWantMore(false); @@ -983,7 +983,7 @@ void BenchRunOp::executeOnce(DBClientBase* conn, BSONObj fixedQuery = fixQuery(this->query, *state->bsonTemplateEvaluator); BSONObj result; if (this->useReadCmd) { - auto qr = stdx::make_unique<QueryRequest>(NamespaceString(this->ns)); + auto qr = std::make_unique<QueryRequest>(NamespaceString(this->ns)); qr->setFilter(fixedQuery); qr->setProj(this->projection); qr->setLimit(1LL); @@ -1066,7 +1066,7 @@ void BenchRunOp::executeOnce(DBClientBase* conn, "cannot use 'options' in combination with read commands", !this->options); - auto qr = stdx::make_unique<QueryRequest>(NamespaceString(this->ns)); + auto qr = std::make_unique<QueryRequest>(NamespaceString(this->ns)); qr->setFilter(fixedQuery); qr->setProj(this->projection); if (this->skip) { @@ -1403,7 +1403,7 @@ void BenchRunner::start() { // Make a unique random seed for the worker. const int64_t seed = _config->randomSeed + i; - auto worker = stdx::make_unique<BenchRunWorker>(i, _config.get(), _brState, seed); + auto worker = std::make_unique<BenchRunWorker>(i, _config.get(), _brState, seed); worker->start(); _workers.push_back(std::move(worker)); diff --git a/src/mongo/shell/shell_utils_launcher.cpp b/src/mongo/shell/shell_utils_launcher.cpp index 736232614b0..9de90513851 100644 --- a/src/mongo/shell/shell_utils_launcher.cpp +++ b/src/mongo/shell/shell_utils_launcher.cpp @@ -44,6 +44,7 @@ #include <iostream> #include <iterator> #include <map> +#include <memory> #include <signal.h> #include <vector> @@ -64,7 +65,6 @@ #include "mongo/scripting/engine.h" #include "mongo/shell/shell_options.h" #include "mongo/shell/shell_utils.h" -#include "mongo/stdx/memory.h" #include "mongo/util/destructor_guard.h" #include "mongo/util/exit.h" #include "mongo/util/log.h" @@ -587,7 +587,7 @@ void ProgramRunner::launchProcess(int child_stdout) { // Reserve space for the final NULL character which terminates the environment block environmentBlockSize += 1; - auto lpEnvironment = stdx::make_unique<wchar_t[]>(environmentBlockSize); + auto lpEnvironment = std::make_unique<wchar_t[]>(environmentBlockSize); size_t environmentOffset = 0; for (const std::wstring& envKeyValue : nativeEnvStrings) { // Ensure there is enough room to write the string, the string's NULL byte, and the block's diff --git a/src/mongo/stdx/memory.h b/src/mongo/stdx/memory.h deleted file mode 100644 index e0f5849b978..00000000000 --- a/src/mongo/stdx/memory.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * <http://www.mongodb.com/licensing/server-side-public-license>. - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the Server Side Public License in all respects for - * all of the code used other than as permitted herein. If you modify file(s) - * with this exception, you may extend this exception to your version of the - * file(s), but you are not obligated to do so. If you do not wish to do so, - * delete this exception statement from your version. If you delete this - * exception statement from all source files in the program, then also delete - * it in the license file. - */ - -#pragma once - -#include "mongo/config.h" - -#if defined(MONGO_CONFIG_HAVE_STD_MAKE_UNIQUE) - -#include <memory> - -namespace mongo { -namespace stdx { - -using ::std::make_unique; // NOLINT - -} // namespace stdx -} // namespace mongo - -#else - -#include <boost/smart_ptr/make_unique.hpp> - -namespace mongo { -namespace stdx { - -using boost::make_unique; // NOLINT - -} // namespace stdx -} // namespace mongo - -#endif diff --git a/src/mongo/tools/bridge.cpp b/src/mongo/tools/bridge.cpp index b3908037c4b..6f965e01760 100644 --- a/src/mongo/tools/bridge.cpp +++ b/src/mongo/tools/bridge.cpp @@ -33,6 +33,7 @@ #include <boost/optional.hpp> #include <cstdint> +#include <memory> #include "mongo/base/init.h" #include "mongo/base/initializer.h" @@ -44,7 +45,6 @@ #include "mongo/rpc/factory.h" #include "mongo/rpc/message.h" #include "mongo/rpc/reply_builder_interface.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/tools/bridge_commands.h" diff --git a/src/mongo/transport/message_compressor_manager_test.cpp b/src/mongo/transport/message_compressor_manager_test.cpp index bffde5f9c29..7e0868ff2c2 100644 --- a/src/mongo/transport/message_compressor_manager_test.cpp +++ b/src/mongo/transport/message_compressor_manager_test.cpp @@ -31,9 +31,12 @@ #include "mongo/platform/basic.h" +#include <memory> +#include <string> +#include <vector> + #include "mongo/bson/bsonobjbuilder.h" #include "mongo/rpc/message.h" -#include "mongo/stdx/memory.h" #include "mongo/transport/message_compressor_manager.h" #include "mongo/transport/message_compressor_noop.h" #include "mongo/transport/message_compressor_registry.h" @@ -43,9 +46,6 @@ #include "mongo/unittest/unittest.h" #include "mongo/util/log.h" -#include <string> -#include <vector> - namespace mongo { namespace { @@ -56,7 +56,7 @@ const auto assertOk = [](auto&& sw) { MessageCompressorRegistry buildRegistry() { MessageCompressorRegistry ret; - auto compressor = stdx::make_unique<NoopMessageCompressor>(); + auto compressor = std::make_unique<NoopMessageCompressor>(); std::vector<std::string> compressorList = {compressor->getName()}; ret.setSupportedCompressors(std::move(compressorList)); @@ -222,34 +222,34 @@ TEST(MessageCompressorManager, FullNormalCompression) { TEST(NoopMessageCompressor, Fidelity) { auto testMessage = buildMessage(); - checkFidelity(testMessage, stdx::make_unique<NoopMessageCompressor>()); + checkFidelity(testMessage, std::make_unique<NoopMessageCompressor>()); } TEST(SnappyMessageCompressor, Fidelity) { auto testMessage = buildMessage(); - checkFidelity(testMessage, stdx::make_unique<SnappyMessageCompressor>()); + checkFidelity(testMessage, std::make_unique<SnappyMessageCompressor>()); } TEST(ZlibMessageCompressor, Fidelity) { auto testMessage = buildMessage(); - checkFidelity(testMessage, stdx::make_unique<ZlibMessageCompressor>()); + checkFidelity(testMessage, std::make_unique<ZlibMessageCompressor>()); } TEST(ZstdMessageCompressor, Fidelity) { auto testMessage = buildMessage(); - checkFidelity(testMessage, stdx::make_unique<ZstdMessageCompressor>()); + checkFidelity(testMessage, std::make_unique<ZstdMessageCompressor>()); } TEST(SnappyMessageCompressor, Overflow) { - checkOverflow(stdx::make_unique<SnappyMessageCompressor>()); + checkOverflow(std::make_unique<SnappyMessageCompressor>()); } TEST(ZlibMessageCompressor, Overflow) { - checkOverflow(stdx::make_unique<ZlibMessageCompressor>()); + checkOverflow(std::make_unique<ZlibMessageCompressor>()); } TEST(ZstdMessageCompressor, Overflow) { - checkOverflow(stdx::make_unique<ZstdMessageCompressor>()); + checkOverflow(std::make_unique<ZstdMessageCompressor>()); } TEST(MessageCompressorManager, SERVER_28008) { @@ -258,15 +258,15 @@ TEST(MessageCompressorManager, SERVER_28008) { // but with a different ordering for the preferred compressor. std::unique_ptr<MessageCompressorBase> zstdCompressor = - stdx::make_unique<ZstdMessageCompressor>(); + std::make_unique<ZstdMessageCompressor>(); const auto zstdId = zstdCompressor->getId(); std::unique_ptr<MessageCompressorBase> zlibCompressor = - stdx::make_unique<ZlibMessageCompressor>(); + std::make_unique<ZlibMessageCompressor>(); const auto zlibId = zlibCompressor->getId(); std::unique_ptr<MessageCompressorBase> snappyCompressor = - stdx::make_unique<SnappyMessageCompressor>(); + std::make_unique<SnappyMessageCompressor>(); const auto snappyId = snappyCompressor->getId(); MessageCompressorRegistry registry; diff --git a/src/mongo/transport/message_compressor_registry.cpp b/src/mongo/transport/message_compressor_registry.cpp index 50b5bc70e48..90a89855048 100644 --- a/src/mongo/transport/message_compressor_registry.cpp +++ b/src/mongo/transport/message_compressor_registry.cpp @@ -31,17 +31,17 @@ #include "mongo/transport/message_compressor_registry.h" +#include <boost/algorithm/string/classification.hpp> +#include <boost/algorithm/string/split.hpp> +#include <memory> + #include "mongo/base/init.h" -#include "mongo/stdx/memory.h" #include "mongo/transport/message_compressor_noop.h" #include "mongo/transport/message_compressor_snappy.h" #include "mongo/transport/message_compressor_zlib.h" #include "mongo/transport/message_compressor_zstd.h" #include "mongo/util/options_parser/option_section.h" -#include <boost/algorithm/string/classification.hpp> -#include <boost/algorithm/string/split.hpp> - namespace mongo { namespace { constexpr auto kDisabledConfigValue = "disabled"_sd; @@ -133,7 +133,7 @@ MONGO_INITIALIZER_GENERAL(NoopMessageCompressorInit, ("AllCompressorsRegistered")) (InitializerContext* context) { auto& compressorRegistry = MessageCompressorRegistry::get(); - compressorRegistry.registerImplementation(stdx::make_unique<NoopMessageCompressor>()); + compressorRegistry.registerImplementation(std::make_unique<NoopMessageCompressor>()); return Status::OK(); } diff --git a/src/mongo/transport/message_compressor_registry_test.cpp b/src/mongo/transport/message_compressor_registry_test.cpp index d1fe3e62a6d..84b78fe877b 100644 --- a/src/mongo/transport/message_compressor_registry_test.cpp +++ b/src/mongo/transport/message_compressor_registry_test.cpp @@ -29,7 +29,8 @@ #include "mongo/platform/basic.h" -#include "mongo/stdx/memory.h" +#include <memory> + #include "mongo/transport/message_compressor_noop.h" #include "mongo/transport/message_compressor_registry.h" #include "mongo/unittest/unittest.h" @@ -46,7 +47,7 @@ namespace mongo { namespace { TEST(MessageCompressorRegistry, RegularTest) { MessageCompressorRegistry registry; - auto compressor = stdx::make_unique<NoopMessageCompressor>(); + auto compressor = std::make_unique<NoopMessageCompressor>(); auto compressorPtr = compressor.get(); std::vector<std::string> compressorList = {compressorPtr->getName()}; @@ -73,7 +74,7 @@ TEST(MessageCompressorRegistry, NothingRegistered) { TEST(MessageCompressorRegistry, SetSupported) { MessageCompressorRegistry registry; - auto compressor = stdx::make_unique<NoopMessageCompressor>(); + auto compressor = std::make_unique<NoopMessageCompressor>(); auto compressorId = compressor->getId(); auto compressorName = compressor->getName(); diff --git a/src/mongo/transport/message_compressor_snappy.cpp b/src/mongo/transport/message_compressor_snappy.cpp index 70e9644e218..58712aee596 100644 --- a/src/mongo/transport/message_compressor_snappy.cpp +++ b/src/mongo/transport/message_compressor_snappy.cpp @@ -31,9 +31,10 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/base/data_range_cursor.h" #include "mongo/base/init.h" -#include "mongo/stdx/memory.h" #include "mongo/transport/message_compressor_registry.h" #include "mongo/transport/message_compressor_snappy.h" @@ -82,7 +83,7 @@ MONGO_INITIALIZER_GENERAL(SnappyMessageCompressorInit, ("AllCompressorsRegistered")) (InitializerContext* context) { auto& compressorRegistry = MessageCompressorRegistry::get(); - compressorRegistry.registerImplementation(stdx::make_unique<SnappyMessageCompressor>()); + compressorRegistry.registerImplementation(std::make_unique<SnappyMessageCompressor>()); return Status::OK(); } } // namespace mongo diff --git a/src/mongo/transport/message_compressor_zlib.cpp b/src/mongo/transport/message_compressor_zlib.cpp index e67358c2fa5..8676c03eacc 100644 --- a/src/mongo/transport/message_compressor_zlib.cpp +++ b/src/mongo/transport/message_compressor_zlib.cpp @@ -31,8 +31,9 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/base/init.h" -#include "mongo/stdx/memory.h" #include "mongo/transport/message_compressor_registry.h" #include "mongo/transport/message_compressor_zlib.h" @@ -84,7 +85,7 @@ MONGO_INITIALIZER_GENERAL(ZlibMessageCompressorInit, ("AllCompressorsRegistered")) (InitializerContext* context) { auto& compressorRegistry = MessageCompressorRegistry::get(); - compressorRegistry.registerImplementation(stdx::make_unique<ZlibMessageCompressor>()); + compressorRegistry.registerImplementation(std::make_unique<ZlibMessageCompressor>()); return Status::OK(); } } // namespace mongo diff --git a/src/mongo/transport/message_compressor_zstd.cpp b/src/mongo/transport/message_compressor_zstd.cpp index 88e165f92d7..b98b4835fba 100644 --- a/src/mongo/transport/message_compressor_zstd.cpp +++ b/src/mongo/transport/message_compressor_zstd.cpp @@ -31,10 +31,11 @@ #include "mongo/platform/basic.h" +#include <memory> + #include <zstd.h> #include "mongo/base/init.h" -#include "mongo/stdx/memory.h" #include "mongo/transport/message_compressor_registry.h" #include "mongo/transport/message_compressor_zstd.h" @@ -82,7 +83,7 @@ MONGO_INITIALIZER_GENERAL(ZstdMessageCompressorInit, ("AllCompressorsRegistered")) (InitializerContext* context) { auto& compressorRegistry = MessageCompressorRegistry::get(); - compressorRegistry.registerImplementation(stdx::make_unique<ZstdMessageCompressor>()); + compressorRegistry.registerImplementation(std::make_unique<ZstdMessageCompressor>()); return Status::OK(); } } // namespace mongo diff --git a/src/mongo/transport/service_entry_point_impl.cpp b/src/mongo/transport/service_entry_point_impl.cpp index a01401f936d..64d4cef9c80 100644 --- a/src/mongo/transport/service_entry_point_impl.cpp +++ b/src/mongo/transport/service_entry_point_impl.cpp @@ -124,7 +124,7 @@ void ServiceEntryPointImpl::startSession(transport::SessionHandle session) { const auto& remoteAddr = session->remoteAddr(); const auto& localAddr = session->localAddr(); invariant(remoteAddr.isValid() && localAddr.isValid()); - auto restrictionEnvironment = stdx::make_unique<RestrictionEnvironment>(remoteAddr, localAddr); + auto restrictionEnvironment = std::make_unique<RestrictionEnvironment>(remoteAddr, localAddr); RestrictionEnvironment::set(session, std::move(restrictionEnvironment)); SSMListIterator ssmIt; diff --git a/src/mongo/transport/service_entry_point_utils.cpp b/src/mongo/transport/service_entry_point_utils.cpp index ab30f3c9563..73b71beafc7 100644 --- a/src/mongo/transport/service_entry_point_utils.cpp +++ b/src/mongo/transport/service_entry_point_utils.cpp @@ -34,8 +34,8 @@ #include "mongo/transport/service_entry_point_utils.h" #include <functional> +#include <memory> -#include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/util/assert_util.h" #include "mongo/util/debug_util.h" @@ -91,7 +91,7 @@ Status launchServiceWorkerThread(std::function<void()> task) { } pthread_t thread; - auto ctx = stdx::make_unique<std::function<void()>>(std::move(task)); + auto ctx = std::make_unique<std::function<void()>>(std::move(task)); int failed = pthread_create(&thread, &attrs, runFunc, ctx.get()); pthread_attr_destroy(&attrs); diff --git a/src/mongo/transport/service_executor_adaptive.cpp b/src/mongo/transport/service_executor_adaptive.cpp index a62f057e7b3..e6f79d50b09 100644 --- a/src/mongo/transport/service_executor_adaptive.cpp +++ b/src/mongo/transport/service_executor_adaptive.cpp @@ -125,8 +125,8 @@ thread_local ServiceExecutorAdaptive::ThreadState* ServiceExecutorAdaptive::_loc nullptr; ServiceExecutorAdaptive::ServiceExecutorAdaptive(ServiceContext* ctx, ReactorHandle reactor) - : ServiceExecutorAdaptive( - ctx, std::move(reactor), stdx::make_unique<ServerParameterOptions>()) {} + : ServiceExecutorAdaptive(ctx, std::move(reactor), std::make_unique<ServerParameterOptions>()) { +} ServiceExecutorAdaptive::ServiceExecutorAdaptive(ServiceContext* ctx, ReactorHandle reactor, diff --git a/src/mongo/transport/service_executor_adaptive_test.cpp b/src/mongo/transport/service_executor_adaptive_test.cpp index b2a7c471bbe..70d234ad356 100644 --- a/src/mongo/transport/service_executor_adaptive_test.cpp +++ b/src/mongo/transport/service_executor_adaptive_test.cpp @@ -140,9 +140,9 @@ protected: template <class Options> std::unique_ptr<ServiceExecutorAdaptive> makeAndStartExecutor() { - auto configOwned = stdx::make_unique<Options>(); + auto configOwned = std::make_unique<Options>(); config = configOwned.get(); - auto exec = stdx::make_unique<ServiceExecutorAdaptive>( + auto exec = std::make_unique<ServiceExecutorAdaptive>( getGlobalServiceContext(), asioIoCtx, std::move(configOwned)); ASSERT_OK(exec->start()); diff --git a/src/mongo/transport/service_executor_test.cpp b/src/mongo/transport/service_executor_test.cpp index 2c52deafb69..b6674f6b2c7 100644 --- a/src/mongo/transport/service_executor_test.cpp +++ b/src/mongo/transport/service_executor_test.cpp @@ -153,9 +153,9 @@ protected: auto scOwned = ServiceContext::make(); setGlobalServiceContext(std::move(scOwned)); - auto configOwned = stdx::make_unique<TestOptions>(); + auto configOwned = std::make_unique<TestOptions>(); executorConfig = configOwned.get(); - executor = stdx::make_unique<ServiceExecutorAdaptive>( + executor = std::make_unique<ServiceExecutorAdaptive>( getGlobalServiceContext(), std::make_shared<ASIOReactor>(), std::move(configOwned)); } @@ -170,7 +170,7 @@ protected: auto scOwned = ServiceContext::make(); setGlobalServiceContext(std::move(scOwned)); - executor = stdx::make_unique<ServiceExecutorSynchronous>(getGlobalServiceContext()); + executor = std::make_unique<ServiceExecutorSynchronous>(getGlobalServiceContext()); } std::unique_ptr<ServiceExecutorSynchronous> executor; diff --git a/src/mongo/transport/service_state_machine.cpp b/src/mongo/transport/service_state_machine.cpp index 47467d871ff..4e073280d00 100644 --- a/src/mongo/transport/service_state_machine.cpp +++ b/src/mongo/transport/service_state_machine.cpp @@ -33,6 +33,8 @@ #include "mongo/transport/service_state_machine.h" +#include <memory> + #include "mongo/config.h" #include "mongo/db/client.h" #include "mongo/db/dbmessage.h" @@ -40,7 +42,6 @@ #include "mongo/db/traffic_recorder.h" #include "mongo/rpc/message.h" #include "mongo/rpc/op_msg.h" -#include "mongo/stdx/memory.h" #include "mongo/transport/message_compressor_manager.h" #include "mongo/transport/service_entry_point.h" #include "mongo/transport/service_executor_task_names.h" diff --git a/src/mongo/transport/service_state_machine.h b/src/mongo/transport/service_state_machine.h index 59b8dbd2823..08e6ee15ee6 100644 --- a/src/mongo/transport/service_state_machine.h +++ b/src/mongo/transport/service_state_machine.h @@ -31,12 +31,12 @@ #include <atomic> #include <functional> +#include <memory> #include "mongo/base/status.h" #include "mongo/config.h" #include "mongo/db/service_context.h" #include "mongo/platform/atomic_word.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/transport/message_compressor_base.h" diff --git a/src/mongo/transport/service_state_machine_test.cpp b/src/mongo/transport/service_state_machine_test.cpp index 12f9120074a..c132d39d548 100644 --- a/src/mongo/transport/service_state_machine_test.cpp +++ b/src/mongo/transport/service_state_machine_test.cpp @@ -31,6 +31,8 @@ #include "mongo/platform/basic.h" +#include <memory> + #include "mongo/base/checked_cast.h" #include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonobjbuilder.h" @@ -38,7 +40,6 @@ #include "mongo/db/dbmessage.h" #include "mongo/db/service_context.h" #include "mongo/rpc/op_msg.h" -#include "mongo/stdx/memory.h" #include "mongo/transport/mock_session.h" #include "mongo/transport/service_entry_point.h" #include "mongo/transport/service_executor.h" @@ -296,18 +297,18 @@ protected: auto sc = scOwned.get(); setGlobalServiceContext(std::move(scOwned)); - sc->setTickSource(stdx::make_unique<TickSourceMock<>>()); - sc->setFastClockSource(stdx::make_unique<ClockSourceMock>()); + sc->setTickSource(std::make_unique<TickSourceMock<>>()); + sc->setFastClockSource(std::make_unique<ClockSourceMock>()); - auto sep = stdx::make_unique<MockSEP>(); + auto sep = std::make_unique<MockSEP>(); _sep = sep.get(); sc->setServiceEntryPoint(std::move(sep)); - auto se = stdx::make_unique<MockServiceExecutor>(sc); + auto se = std::make_unique<MockServiceExecutor>(sc); _sexec = se.get(); sc->setServiceExecutor(std::move(se)); - auto tl = stdx::make_unique<MockTL>(); + auto tl = std::make_unique<MockTL>(); _tl = tl.get(); sc->setTransportLayer(std::move(tl)); _tl->start().transitional_ignore(); diff --git a/src/mongo/transport/transport_layer_asio.cpp b/src/mongo/transport/transport_layer_asio.cpp index 3a17975ea85..41f00e9b677 100644 --- a/src/mongo/transport/transport_layer_asio.cpp +++ b/src/mongo/transport/transport_layer_asio.cpp @@ -751,7 +751,7 @@ Status TransportLayerASIO::setup() { const auto& sslParams = getSSLGlobalParams(); if (_sslMode() != SSLParams::SSLMode_disabled && _listenerOptions.isIngress()) { - _ingressSSLContext = stdx::make_unique<asio::ssl::context>(asio::ssl::context::sslv23); + _ingressSSLContext = std::make_unique<asio::ssl::context>(asio::ssl::context::sslv23); Status status = getSSLManager()->initSSLContext(_ingressSSLContext->native_handle(), @@ -763,7 +763,7 @@ Status TransportLayerASIO::setup() { } if (_listenerOptions.isEgress() && getSSLManager()) { - _egressSSLContext = stdx::make_unique<asio::ssl::context>(asio::ssl::context::sslv23); + _egressSSLContext = std::make_unique<asio::ssl::context>(asio::ssl::context::sslv23); Status status = getSSLManager()->initSSLContext(_egressSSLContext->native_handle(), sslParams, diff --git a/src/mongo/transport/transport_layer_asio.h b/src/mongo/transport/transport_layer_asio.h index e37f72c40aa..c0e14452adf 100644 --- a/src/mongo/transport/transport_layer_asio.h +++ b/src/mongo/transport/transport_layer_asio.h @@ -30,13 +30,13 @@ #pragma once #include <functional> +#include <memory> #include <string> #include "mongo/base/status_with.h" #include "mongo/config.h" #include "mongo/db/server_options.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/transport/transport_layer.h" diff --git a/src/mongo/transport/transport_layer_manager.cpp b/src/mongo/transport/transport_layer_manager.cpp index 97a44e104f4..dcc91cf3e3d 100644 --- a/src/mongo/transport/transport_layer_manager.cpp +++ b/src/mongo/transport/transport_layer_manager.cpp @@ -31,19 +31,19 @@ #include "mongo/transport/transport_layer_manager.h" +#include <iostream> +#include <limits> +#include <memory> + #include "mongo/base/status.h" #include "mongo/db/server_options.h" #include "mongo/db/service_context.h" -#include "mongo/stdx/memory.h" #include "mongo/transport/service_executor_adaptive.h" #include "mongo/transport/service_executor_synchronous.h" #include "mongo/transport/session.h" #include "mongo/transport/transport_layer_asio.h" #include "mongo/util/net/ssl_types.h" #include "mongo/util/time_support.h" -#include <limits> - -#include <iostream> namespace mongo { namespace transport { @@ -122,7 +122,7 @@ std::unique_ptr<TransportLayer> TransportLayerManager::makeAndStartDefaultEgress opts.mode = transport::TransportLayerASIO::Options::kEgress; opts.ipList.clear(); - auto ret = stdx::make_unique<transport::TransportLayerASIO>(opts, nullptr); + auto ret = std::make_unique<transport::TransportLayerASIO>(opts, nullptr); uassertStatusOK(ret->setup()); uassertStatusOK(ret->start()); return std::unique_ptr<TransportLayer>(std::move(ret)); @@ -142,20 +142,19 @@ std::unique_ptr<TransportLayer> TransportLayerManager::createWithConfig( MONGO_UNREACHABLE; } - auto transportLayerASIO = stdx::make_unique<transport::TransportLayerASIO>(opts, sep); + auto transportLayerASIO = std::make_unique<transport::TransportLayerASIO>(opts, sep); if (config->serviceExecutor == "adaptive") { auto reactor = transportLayerASIO->getReactor(TransportLayer::kIngress); - ctx->setServiceExecutor( - stdx::make_unique<ServiceExecutorAdaptive>(ctx, std::move(reactor))); + ctx->setServiceExecutor(std::make_unique<ServiceExecutorAdaptive>(ctx, std::move(reactor))); } else if (config->serviceExecutor == "synchronous") { - ctx->setServiceExecutor(stdx::make_unique<ServiceExecutorSynchronous>(ctx)); + ctx->setServiceExecutor(std::make_unique<ServiceExecutorSynchronous>(ctx)); } transportLayer = std::move(transportLayerASIO); std::vector<std::unique_ptr<TransportLayer>> retVector; retVector.emplace_back(std::move(transportLayer)); - return stdx::make_unique<TransportLayerManager>(std::move(retVector)); + return std::make_unique<TransportLayerManager>(std::move(retVector)); } } // namespace transport diff --git a/src/mongo/transport/transport_layer_mock.cpp b/src/mongo/transport/transport_layer_mock.cpp index ed3365a67e7..bbc61010991 100644 --- a/src/mongo/transport/transport_layer_mock.cpp +++ b/src/mongo/transport/transport_layer_mock.cpp @@ -31,8 +31,9 @@ #include "mongo/transport/transport_layer_mock.h" +#include <memory> + #include "mongo/base/status.h" -#include "mongo/stdx/memory.h" #include "mongo/transport/mock_session.h" #include "mongo/transport/transport_layer.h" #include "mongo/util/time_support.h" diff --git a/src/mongo/unittest/death_test.h b/src/mongo/unittest/death_test.h index df468c26ee5..0f1516f6968 100644 --- a/src/mongo/unittest/death_test.h +++ b/src/mongo/unittest/death_test.h @@ -32,7 +32,6 @@ #include <memory> #include <string> -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" /** @@ -108,7 +107,7 @@ public: template <typename... Args> DeathTest(Args&&... args) - : DeathTestImpl([args...]() { return stdx::make_unique<T>(args...); }) {} + : DeathTestImpl([args...]() { return std::make_unique<T>(args...); }) {} private: std::string getPattern() override { diff --git a/src/mongo/unittest/unittest.cpp b/src/mongo/unittest/unittest.cpp index 72ee87d30c6..764be0908d0 100644 --- a/src/mongo/unittest/unittest.cpp +++ b/src/mongo/unittest/unittest.cpp @@ -36,6 +36,7 @@ #include <functional> #include <iostream> #include <map> +#include <memory> #include "mongo/base/checked_cast.h" #include "mongo/base/init.h" @@ -45,7 +46,6 @@ #include "mongo/logger/logger.h" #include "mongo/logger/message_event_utf8_encoder.h" #include "mongo/logger/message_log_domain.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" diff --git a/src/mongo/util/background_thread_clock_source.cpp b/src/mongo/util/background_thread_clock_source.cpp index e7612a66037..36eb958f7b8 100644 --- a/src/mongo/util/background_thread_clock_source.cpp +++ b/src/mongo/util/background_thread_clock_source.cpp @@ -34,9 +34,9 @@ #include "mongo/util/background_thread_clock_source.h" #include <chrono> +#include <memory> #include <thread> -#include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/util/concurrency/idle_thread_block.h" #include "mongo/util/log.h" diff --git a/src/mongo/util/background_thread_clock_source.h b/src/mongo/util/background_thread_clock_source.h index 4b2d13324c2..4d106780601 100644 --- a/src/mongo/util/background_thread_clock_source.h +++ b/src/mongo/util/background_thread_clock_source.h @@ -30,11 +30,11 @@ #pragma once #include <chrono> +#include <memory> #include <thread> #include "mongo/platform/atomic_word.h" #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/util/clock_source.h" diff --git a/src/mongo/util/background_thread_clock_source_test.cpp b/src/mongo/util/background_thread_clock_source_test.cpp index 8ffc2791979..72a089b2134 100644 --- a/src/mongo/util/background_thread_clock_source_test.cpp +++ b/src/mongo/util/background_thread_clock_source_test.cpp @@ -29,9 +29,11 @@ #include "mongo/platform/basic.h" -#include "mongo/stdx/memory.h" -#include "mongo/unittest/unittest.h" #include "mongo/util/background_thread_clock_source.h" + +#include <memory> + +#include "mongo/unittest/unittest.h" #include "mongo/util/clock_source.h" #include "mongo/util/clock_source_mock.h" #include "mongo/util/system_clock_source.h" @@ -46,12 +48,12 @@ public: void setUpClocks(Milliseconds granularity) { auto csMock = std::make_unique<ClockSourceMock>(); _csMock = csMock.get(); - _btcs = stdx::make_unique<BackgroundThreadClockSource>(std::move(csMock), granularity); + _btcs = std::make_unique<BackgroundThreadClockSource>(std::move(csMock), granularity); } void setUpRealClocks(Milliseconds granularity) { - _btcs = stdx::make_unique<BackgroundThreadClockSource>( - std::make_unique<SystemClockSource>(), granularity); + _btcs = std::make_unique<BackgroundThreadClockSource>(std::make_unique<SystemClockSource>(), + granularity); } void tearDown() override { diff --git a/src/mongo/util/concurrency/thread_pool_test.cpp b/src/mongo/util/concurrency/thread_pool_test.cpp index b4a650c54bb..1d85b8b95df 100644 --- a/src/mongo/util/concurrency/thread_pool_test.cpp +++ b/src/mongo/util/concurrency/thread_pool_test.cpp @@ -52,7 +52,7 @@ using namespace mongo; MONGO_INITIALIZER(ThreadPoolCommonTests)(InitializerContext*) { addTestsForThreadPool("ThreadPoolCommon", - []() { return stdx::make_unique<ThreadPool>(ThreadPool::Options()); }); + []() { return std::make_unique<ThreadPool>(ThreadPool::Options()); }); return Status::OK(); } diff --git a/src/mongo/util/concurrency/thread_pool_test_common.cpp b/src/mongo/util/concurrency/thread_pool_test_common.cpp index 2a2e1cacd3d..5f32e649c65 100644 --- a/src/mongo/util/concurrency/thread_pool_test_common.cpp +++ b/src/mongo/util/concurrency/thread_pool_test_common.cpp @@ -33,8 +33,9 @@ #include "mongo/util/concurrency/thread_pool_test_common.h" +#include <memory> + #include "mongo/stdx/condition_variable.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/unittest/death_test.h" #include "mongo/util/assert_util.h" @@ -97,44 +98,44 @@ public: fassertFailed(34356); } entry = [makeTest](ThreadPoolFactory makeThreadPool) { - return stdx::make_unique<::mongo::unittest::DeathTest<T>>(std::move(makeThreadPool)); + return std::make_unique<::mongo::unittest::DeathTest<T>>(std::move(makeThreadPool)); }; } }; -#define COMMON_THREAD_POOL_TEST(TEST_NAME) \ - class TPT_##TEST_NAME : public CommonThreadPoolTestFixture { \ - public: \ - TPT_##TEST_NAME(ThreadPoolFactory makeThreadPool) \ - : CommonThreadPoolTestFixture(std::move(makeThreadPool)) {} \ - \ - private: \ - void _doTest() override; \ - static const TptRegistrationAgent _agent; \ - }; \ - const TptRegistrationAgent TPT_##TEST_NAME::_agent( \ - #TEST_NAME, [](ThreadPoolFactory makeThreadPool) { \ - return stdx::make_unique<TPT_##TEST_NAME>(std::move(makeThreadPool)); \ - }); \ +#define COMMON_THREAD_POOL_TEST(TEST_NAME) \ + class TPT_##TEST_NAME : public CommonThreadPoolTestFixture { \ + public: \ + TPT_##TEST_NAME(ThreadPoolFactory makeThreadPool) \ + : CommonThreadPoolTestFixture(std::move(makeThreadPool)) {} \ + \ + private: \ + void _doTest() override; \ + static const TptRegistrationAgent _agent; \ + }; \ + const TptRegistrationAgent TPT_##TEST_NAME::_agent( \ + #TEST_NAME, [](ThreadPoolFactory makeThreadPool) { \ + return std::make_unique<TPT_##TEST_NAME>(std::move(makeThreadPool)); \ + }); \ void TPT_##TEST_NAME::_doTest() -#define COMMON_THREAD_POOL_DEATH_TEST(TEST_NAME, MATCH_EXPR) \ - class TPT_##TEST_NAME : public CommonThreadPoolTestFixture { \ - public: \ - TPT_##TEST_NAME(ThreadPoolFactory makeThreadPool) \ - : CommonThreadPoolTestFixture(std::move(makeThreadPool)) {} \ - \ - private: \ - void _doTest() override; \ - static const TptDeathRegistrationAgent<TPT_##TEST_NAME> _agent; \ - }; \ - const TptDeathRegistrationAgent<TPT_##TEST_NAME> TPT_##TEST_NAME::_agent( \ - #TEST_NAME, [](ThreadPoolFactory makeThreadPool) { \ - return stdx::make_unique<TPT_##TEST_NAME>(std::move(makeThreadPool)); \ - }); \ - std::string getDeathTestPattern(TPT_##TEST_NAME*) { \ - return MATCH_EXPR; \ - } \ +#define COMMON_THREAD_POOL_DEATH_TEST(TEST_NAME, MATCH_EXPR) \ + class TPT_##TEST_NAME : public CommonThreadPoolTestFixture { \ + public: \ + TPT_##TEST_NAME(ThreadPoolFactory makeThreadPool) \ + : CommonThreadPoolTestFixture(std::move(makeThreadPool)) {} \ + \ + private: \ + void _doTest() override; \ + static const TptDeathRegistrationAgent<TPT_##TEST_NAME> _agent; \ + }; \ + const TptDeathRegistrationAgent<TPT_##TEST_NAME> TPT_##TEST_NAME::_agent( \ + #TEST_NAME, [](ThreadPoolFactory makeThreadPool) { \ + return std::make_unique<TPT_##TEST_NAME>(std::move(makeThreadPool)); \ + }); \ + std::string getDeathTestPattern(TPT_##TEST_NAME*) { \ + return MATCH_EXPR; \ + } \ void TPT_##TEST_NAME::_doTest() COMMON_THREAD_POOL_TEST(UnusedPool) { diff --git a/src/mongo/util/fail_point.cpp b/src/mongo/util/fail_point.cpp index a23a680c327..9582a0e4939 100644 --- a/src/mongo/util/fail_point.cpp +++ b/src/mongo/util/fail_point.cpp @@ -31,9 +31,10 @@ #include "mongo/util/fail_point.h" +#include <memory> + #include "mongo/bson/util/bson_extract.h" #include "mongo/platform/random.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/thread.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/log.h" @@ -60,7 +61,7 @@ public: static FailPointPRNG* current() { if (!_failPointPrng) - _failPointPrng = stdx::make_unique<FailPointPRNG>(); + _failPointPrng = std::make_unique<FailPointPRNG>(); return _failPointPrng.get(); } diff --git a/src/mongo/util/fast_clock_source_factory.cpp b/src/mongo/util/fast_clock_source_factory.cpp index d62da029e44..3f3e44efe05 100644 --- a/src/mongo/util/fast_clock_source_factory.cpp +++ b/src/mongo/util/fast_clock_source_factory.cpp @@ -33,7 +33,6 @@ #include <memory> -#include "mongo/stdx/memory.h" #include "mongo/util/background_thread_clock_source.h" #include "mongo/util/system_clock_source.h" @@ -43,8 +42,8 @@ std::unique_ptr<ClockSource> FastClockSourceFactory::create(Milliseconds granula // TODO: Create the fastest to read wall clock available on the system. // For now, assume there is no built-in fast wall clock so instead // create a background-thread-based timer. - return stdx::make_unique<BackgroundThreadClockSource>(stdx::make_unique<SystemClockSource>(), - granularity); + return std::make_unique<BackgroundThreadClockSource>(std::make_unique<SystemClockSource>(), + granularity); } } // namespace mongo diff --git a/src/mongo/util/net/ssl_manager_apple.cpp b/src/mongo/util/net/ssl_manager_apple.cpp index 9ba948100e9..c6b828125e8 100644 --- a/src/mongo/util/net/ssl_manager_apple.cpp +++ b/src/mongo/util/net/ssl_manager_apple.cpp @@ -33,6 +33,7 @@ #include <boost/optional/optional.hpp> #include <fstream> +#include <memory> #include <stdlib.h> #include "mongo/base/checked_cast.h" @@ -43,7 +44,6 @@ #include "mongo/crypto/sha1_block.h" #include "mongo/crypto/sha256_block.h" #include "mongo/platform/random.h" -#include "mongo/stdx/memory.h" #include "mongo/util/base64.h" #include "mongo/util/concurrency/mutex.h" #include "mongo/util/log.h" @@ -1676,7 +1676,7 @@ extern SSLManagerInterface* theSSLManager; std::unique_ptr<SSLManagerInterface> SSLManagerInterface::create(const SSLParams& params, bool isServer) { - return stdx::make_unique<SSLManagerApple>(params, isServer); + return std::make_unique<SSLManagerApple>(params, isServer); } MONGO_INITIALIZER_WITH_PREREQUISITES(SSLManager, ("EndStartupOptionHandling")) diff --git a/src/mongo/util/net/ssl_manager_openssl.cpp b/src/mongo/util/net/ssl_manager_openssl.cpp index 4bdc9e2aa72..ae59c671058 100644 --- a/src/mongo/util/net/ssl_manager_openssl.cpp +++ b/src/mongo/util/net/ssl_manager_openssl.cpp @@ -37,6 +37,7 @@ #include <boost/date_time/posix_time/posix_time.hpp> #include <fstream> #include <iostream> +#include <memory> #include <sstream> #include <stack> #include <string> @@ -48,7 +49,6 @@ #include "mongo/bson/bsonobjbuilder.h" #include "mongo/config.h" #include "mongo/platform/atomic_word.h" -#include "mongo/stdx/memory.h" #include "mongo/transport/session.h" #include "mongo/util/concurrency/mutex.h" #include "mongo/util/debug_util.h" @@ -318,7 +318,7 @@ public: CRYPTO_set_locking_callback(&SSLThreadInfo::lockingCallback); while ((int)_mutex.size() < CRYPTO_num_locks()) { - _mutex.emplace_back(stdx::make_unique<stdx::recursive_mutex>()); + _mutex.emplace_back(std::make_unique<stdx::recursive_mutex>()); } } @@ -635,7 +635,7 @@ MONGO_INITIALIZER_WITH_PREREQUISITES(SSLManager, ("SetupOpenSSL", "EndStartupOpt std::unique_ptr<SSLManagerInterface> SSLManagerInterface::create(const SSLParams& params, bool isServer) { - return stdx::make_unique<SSLManagerOpenSSL>(params, isServer); + return std::make_unique<SSLManagerOpenSSL>(params, isServer); } SSLX509Name getCertificateSubjectX509Name(X509* cert) { @@ -1427,7 +1427,7 @@ bool SSLManagerOpenSSL::_doneWithSSLOp(SSLConnectionOpenSSL* conn, int status) { SSLConnectionInterface* SSLManagerOpenSSL::connect(Socket* socket) { std::unique_ptr<SSLConnectionOpenSSL> sslConn = - stdx::make_unique<SSLConnectionOpenSSL>(_clientContext.get(), socket, (const char*)NULL, 0); + std::make_unique<SSLConnectionOpenSSL>(_clientContext.get(), socket, (const char*)NULL, 0); const auto undotted = removeFQDNRoot(socket->remoteAddr().hostOrIp()); int ret = ::SSL_set_tlsext_host_name(sslConn->ssl, undotted.c_str()); @@ -1448,7 +1448,7 @@ SSLConnectionInterface* SSLManagerOpenSSL::accept(Socket* socket, const char* initialBytes, int len) { std::unique_ptr<SSLConnectionOpenSSL> sslConn = - stdx::make_unique<SSLConnectionOpenSSL>(_serverContext.get(), socket, initialBytes, len); + std::make_unique<SSLConnectionOpenSSL>(_serverContext.get(), socket, initialBytes, len); int ret; do { diff --git a/src/mongo/util/net/ssl_manager_windows.cpp b/src/mongo/util/net/ssl_manager_windows.cpp index db9816d2683..514d39094f6 100644 --- a/src/mongo/util/net/ssl_manager_windows.cpp +++ b/src/mongo/util/net/ssl_manager_windows.cpp @@ -36,6 +36,7 @@ #include <asio.hpp> #include <boost/algorithm/string/replace.hpp> #include <fstream> +#include <memory> #include <string> #include <tuple> #include <vector> @@ -47,7 +48,6 @@ #include "mongo/config.h" #include "mongo/db/server_options.h" #include "mongo/platform/atomic_word.h" -#include "mongo/stdx/memory.h" #include "mongo/util/concurrency/mutex.h" #include "mongo/util/debug_util.h" #include "mongo/util/exit.h" @@ -388,7 +388,7 @@ bool isSSLServer = false; std::unique_ptr<SSLManagerInterface> SSLManagerInterface::create(const SSLParams& params, bool isServer) { - return stdx::make_unique<SSLManagerWindows>(params, isServer); + return std::make_unique<SSLManagerWindows>(params, isServer); } namespace { @@ -1340,7 +1340,7 @@ Status SSLManagerWindows::initSSLContext(SCHANNEL_CRED* cred, SSLConnectionInterface* SSLManagerWindows::connect(Socket* socket) { std::unique_ptr<SSLConnectionWindows> sslConn = - stdx::make_unique<SSLConnectionWindows>(&_clientCred, socket, nullptr, 0); + std::make_unique<SSLConnectionWindows>(&_clientCred, socket, nullptr, 0); _handshake(sslConn.get(), true); return sslConn.release(); @@ -1350,7 +1350,7 @@ SSLConnectionInterface* SSLManagerWindows::accept(Socket* socket, const char* initialBytes, int len) { std::unique_ptr<SSLConnectionWindows> sslConn = - stdx::make_unique<SSLConnectionWindows>(&_serverCred, socket, initialBytes, len); + std::make_unique<SSLConnectionWindows>(&_serverCred, socket, initialBytes, len); _handshake(sslConn.get(), false); diff --git a/src/mongo/util/perfctr_collect.cpp b/src/mongo/util/perfctr_collect.cpp index 5ff3ed41e8b..c70f50fae3f 100644 --- a/src/mongo/util/perfctr_collect.cpp +++ b/src/mongo/util/perfctr_collect.cpp @@ -244,7 +244,7 @@ StatusWith<PerfCounterCollector::CounterInfo> PerfCounterCollector::addCounter(S return {ErrorCodes::WindowsPdhError, formatFunctionCallError("PdhGetCounterInfoW", status)}; } - auto buf = stdx::make_unique<char[]>(bufferSize); + auto buf = std::make_unique<char[]>(bufferSize); auto counterInfo = reinterpret_cast<PPDH_COUNTER_INFO>(buf.get()); status = PdhGetCounterInfoW(counter, false, &bufferSize, counterInfo); @@ -301,7 +301,7 @@ StatusWith<std::vector<PerfCounterCollector::CounterInfo>> PerfCounterCollector: << "'"}; } - auto buf = stdx::make_unique<wchar_t[]>(pathListLength); + auto buf = std::make_unique<wchar_t[]>(pathListLength); status = PdhExpandCounterPathW(pathWide.c_str(), buf.get(), &pathListLength); diff --git a/src/mongo/util/perfctr_collect.h b/src/mongo/util/perfctr_collect.h index 95d9222b434..3d1b45b0f81 100644 --- a/src/mongo/util/perfctr_collect.h +++ b/src/mongo/util/perfctr_collect.h @@ -39,7 +39,6 @@ #include "mongo/base/status.h" #include "mongo/base/status_with.h" #include "mongo/base/string_data.h" -#include "mongo/stdx/memory.h" #include "mongo/stdx/unordered_map.h" namespace mongo { diff --git a/src/mongo/util/periodic_runner_impl_test.cpp b/src/mongo/util/periodic_runner_impl_test.cpp index 58c4b568adc..fde21f4dd86 100644 --- a/src/mongo/util/periodic_runner_impl_test.cpp +++ b/src/mongo/util/periodic_runner_impl_test.cpp @@ -48,7 +48,7 @@ class PeriodicRunnerImplTestNoSetup : public ServiceContextTest { public: void setUp() override { _clockSource = std::make_unique<ClockSourceMock>(); - _runner = stdx::make_unique<PeriodicRunnerImpl>(getServiceContext(), _clockSource.get()); + _runner = std::make_unique<PeriodicRunnerImpl>(getServiceContext(), _clockSource.get()); } void tearDown() override { diff --git a/src/mongo/util/stacktrace_windows.cpp b/src/mongo/util/stacktrace_windows.cpp index bf98e1f0646..6552e70bad6 100644 --- a/src/mongo/util/stacktrace_windows.cpp +++ b/src/mongo/util/stacktrace_windows.cpp @@ -44,12 +44,12 @@ #include <cstdio> #include <cstdlib> #include <iostream> +#include <memory> #include <sstream> #include <string> #include <vector> #include "mongo/base/init.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/concurrency/mutex.h" #include "mongo/util/log.h" diff --git a/src/mongo/util/system_clock_source.cpp b/src/mongo/util/system_clock_source.cpp index 4bc0b69e759..ef93caf9e28 100644 --- a/src/mongo/util/system_clock_source.cpp +++ b/src/mongo/util/system_clock_source.cpp @@ -31,7 +31,8 @@ #include "mongo/util/system_clock_source.h" -#include "mongo/stdx/memory.h" +#include <memory> + #include "mongo/util/time_support.h" namespace mongo { @@ -41,7 +42,7 @@ Date_t SystemClockSource::now() { } SystemClockSource* SystemClockSource::get() { - static const auto globalSystemClockSource = stdx::make_unique<SystemClockSource>(); + static const auto globalSystemClockSource = std::make_unique<SystemClockSource>(); return globalSystemClockSource.get(); } diff --git a/src/mongo/util/system_tick_source.cpp b/src/mongo/util/system_tick_source.cpp index 0defb2d0450..12defed767c 100644 --- a/src/mongo/util/system_tick_source.cpp +++ b/src/mongo/util/system_tick_source.cpp @@ -38,9 +38,9 @@ #if defined(MONGO_CONFIG_HAVE_HEADER_UNISTD_H) #include <unistd.h> #endif +#include <memory> #include "mongo/base/init.h" -#include "mongo/stdx/memory.h" #include "mongo/util/assert_util.h" #include "mongo/util/tick_source.h" #include "mongo/util/time_support.h" @@ -154,7 +154,7 @@ TickSource::Tick SystemTickSource::getTicksPerSecond() { } SystemTickSource* SystemTickSource::get() { - static const auto globalSystemTickSource = stdx::make_unique<SystemTickSource>(); + static const auto globalSystemTickSource = std::make_unique<SystemTickSource>(); return globalSystemTickSource.get(); } diff --git a/src/mongo/watchdog/watchdog.cpp b/src/mongo/watchdog/watchdog.cpp index ea1d53b2219..05b9a7f23fb 100644 --- a/src/mongo/watchdog/watchdog.cpp +++ b/src/mongo/watchdog/watchdog.cpp @@ -372,7 +372,7 @@ void checkFile(OperationContext* opCtx, const boost::filesystem::path& file) { } DWORD bytesRead; - auto readBuffer = stdx::make_unique<char[]>(nowStr.size()); + auto readBuffer = std::make_unique<char[]>(nowStr.size()); if (!ReadFile(hFile, readBuffer.get(), nowStr.size(), &bytesRead, NULL)) { std::uint32_t gle = ::GetLastError(); severe() << "ReadFile failed for '" << file.generic_string() @@ -458,7 +458,7 @@ void checkFile(OperationContext* opCtx, const boost::filesystem::path& file) { fassertNoTrace(4082, err == 0); } - auto readBuffer = stdx::make_unique<char[]>(nowStr.size()); + auto readBuffer = std::make_unique<char[]>(nowStr.size()); size_t bytesReadTotal = 0; while (bytesReadTotal < nowStr.size()) { ssize_t bytesReadInRead = pread( diff --git a/src/mongo/watchdog/watchdog_mongod.cpp b/src/mongo/watchdog/watchdog_mongod.cpp index c223e9fc24d..e01f693662f 100644 --- a/src/mongo/watchdog/watchdog_mongod.cpp +++ b/src/mongo/watchdog/watchdog_mongod.cpp @@ -34,6 +34,7 @@ #include "mongo/watchdog/watchdog_mongod.h" #include <boost/filesystem.hpp> +#include <memory> #include "mongo/base/init.h" #include "mongo/config.h" @@ -42,7 +43,6 @@ #include "mongo/db/server_options.h" #include "mongo/db/service_context.h" #include "mongo/db/storage/storage_options.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/unittest.h" #include "mongo/util/clock_source.h" #include "mongo/util/clock_source_mock.h" @@ -148,7 +148,7 @@ void startWatchdog() { std::vector<std::unique_ptr<WatchdogCheck>> checks; auto dataCheck = - stdx::make_unique<DirectoryCheck>(boost::filesystem::path(storageGlobalParams.dbpath)); + std::make_unique<DirectoryCheck>(boost::filesystem::path(storageGlobalParams.dbpath)); checks.push_back(std::move(dataCheck)); @@ -158,7 +158,7 @@ void startWatchdog() { journalDirectory /= "journal"; if (boost::filesystem::exists(journalDirectory)) { - auto journalCheck = stdx::make_unique<DirectoryCheck>(journalDirectory); + auto journalCheck = std::make_unique<DirectoryCheck>(journalDirectory); checks.push_back(std::move(journalCheck)); } else { @@ -175,7 +175,7 @@ void startWatchdog() { boost::filesystem::path logFile(serverGlobalParams.logpath); auto logPath = logFile.parent_path(); - auto logCheck = stdx::make_unique<DirectoryCheck>(logPath); + auto logCheck = std::make_unique<DirectoryCheck>(logPath); checks.push_back(std::move(logCheck)); } @@ -183,11 +183,11 @@ void startWatchdog() { // This may be redudant with the dbpath check but there is not easy way to confirm they are // duplicate. for (auto&& path : getWatchdogPaths()) { - auto auditCheck = stdx::make_unique<DirectoryCheck>(path); + auto auditCheck = std::make_unique<DirectoryCheck>(path); checks.push_back(std::move(auditCheck)); } - auto monitor = stdx::make_unique<WatchdogMonitor>( + auto monitor = std::make_unique<WatchdogMonitor>( std::move(checks), watchdogCheckPeriod, period, watchdogTerminate); // Install the new WatchdogMonitor diff --git a/src/mongo/watchdog/watchdog_test.cpp b/src/mongo/watchdog/watchdog_test.cpp index fd3b34602c9..390877b734a 100644 --- a/src/mongo/watchdog/watchdog_test.cpp +++ b/src/mongo/watchdog/watchdog_test.cpp @@ -33,10 +33,11 @@ #include "mongo/watchdog/watchdog.h" +#include <memory> + #include "mongo/db/client.h" #include "mongo/db/service_context.h" #include "mongo/db/service_context_test_fixture.h" -#include "mongo/stdx/memory.h" #include "mongo/unittest/death_test.h" #include "mongo/unittest/temp_dir.h" #include "mongo/unittest/unittest.h" @@ -242,7 +243,7 @@ class WatchdogCheckThreadTest : public ServiceContextTest {}; // Positive: Make sure check thread runs at least N times and stops correctly TEST_F(WatchdogCheckThreadTest, Basic) { - auto counterCheck = stdx::make_unique<TestCounterCheck>(); + auto counterCheck = std::make_unique<TestCounterCheck>(); auto counterCheckPtr = counterCheck.get(); std::vector<std::unique_ptr<WatchdogCheck>> checks; @@ -303,7 +304,7 @@ TEST_F(WatchdogMonitorThreadTest, Basic) { deathEvent.set(); }; - auto counterCheck = stdx::make_unique<TestCounterCheck>(); + auto counterCheck = std::make_unique<TestCounterCheck>(); std::vector<std::unique_ptr<WatchdogCheck>> checks; checks.push_back(std::move(counterCheck)); @@ -348,7 +349,7 @@ TEST_F(WatchdogMonitorThreadTest, SleepyHungCheck) { deathEvent.set(); }; - auto sleepyCheck = stdx::make_unique<SleepyCheck>(); + auto sleepyCheck = std::make_unique<SleepyCheck>(); std::vector<std::unique_ptr<WatchdogCheck>> checks; checks.push_back(std::move(sleepyCheck)); @@ -381,7 +382,7 @@ TEST_F(WatchdogMonitorTest, SleepyHungCheck) { deathEvent.set(); }; - auto sleepyCheck = stdx::make_unique<SleepyCheck>(); + auto sleepyCheck = std::make_unique<SleepyCheck>(); std::vector<std::unique_ptr<WatchdogCheck>> checks; checks.push_back(std::move(sleepyCheck)); @@ -397,7 +398,7 @@ TEST_F(WatchdogMonitorTest, SleepyHungCheck) { // Positive: Make sure watchdog monitor terminates the process if a check is unresponsive DEATH_TEST(WatchdogMonitorTest, Death, "") { - auto sleepyCheck = stdx::make_unique<SleepyCheck>(); + auto sleepyCheck = std::make_unique<SleepyCheck>(); std::vector<std::unique_ptr<WatchdogCheck>> checks; checks.push_back(std::move(sleepyCheck)); @@ -418,7 +419,7 @@ TEST_F(WatchdogMonitorTest, PauseAndResume) { invariant(false); }; - auto counterCheck = stdx::make_unique<TestCounterCheck>(); + auto counterCheck = std::make_unique<TestCounterCheck>(); auto counterCheckPtr = counterCheck.get(); std::vector<std::unique_ptr<WatchdogCheck>> checks; |