diff options
author | ADAM David Alan Martin <adam.martin@10gen.com> | 2019-06-10 01:21:01 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2019-06-10 01:59:35 -0400 |
commit | c36f9ecb91e49da7e637863889804fc4e6c6c05e (patch) | |
tree | 64d8aadb6d29042d4f4e7366bc1457e4e0612383 /src/mongo/db | |
parent | c9548e729c8fecd9d7a9a5dd341da0433194ac73 (diff) | |
download | mongo-c36f9ecb91e49da7e637863889804fc4e6c6c05e.tar.gz |
SERVER-39339 Remove `stdx/memory.h`
Diffstat (limited to 'src/mongo/db')
437 files changed, 1706 insertions, 1656 deletions
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 { |