From d7d1fdb75966c684e9a42150e6e9b69c4a10ee08 Mon Sep 17 00:00:00 2001 From: Andrew Morrow Date: Wed, 10 Jun 2015 18:08:48 -0400 Subject: SERVER-17308 Replace boost::scoped_ptr with std::unique_ptr --- .../db/auth/authz_manager_external_state_mock.cpp | 2 +- .../db/auth/native_sasl_authentication_session.cpp | 5 +- .../db/auth/native_sasl_authentication_session.h | 3 +- src/mongo/db/auth/role_name.h | 5 +- src/mongo/db/auth/sasl_commands.cpp | 1 - .../db/auth/sasl_scramsha1_server_conversation.cpp | 5 +- .../db/auth/sasl_scramsha1_server_conversation.h | 1 - src/mongo/db/auth/user_document_parser_test.cpp | 11 +- src/mongo/db/auth/user_name.h | 6 +- src/mongo/db/auth/user_set_test.cpp | 8 +- src/mongo/db/catalog/capped_utils.cpp | 2 +- src/mongo/db/catalog/collection.cpp | 7 +- src/mongo/db/catalog/collection_info_cache.h | 5 +- src/mongo/db/catalog/cursor_manager.cpp | 6 +- src/mongo/db/catalog/cursor_manager.h | 3 +- src/mongo/db/catalog/index_catalog_entry.cpp | 2 +- src/mongo/db/catalog/index_catalog_entry.h | 2 +- src/mongo/db/catalog/index_create.cpp | 5 +- src/mongo/db/client.h | 1 - src/mongo/db/client_basic.h | 1 - src/mongo/db/clientcursor.h | 3 +- src/mongo/db/clientlistplugin.cpp | 5 +- src/mongo/db/cloner.cpp | 7 +- src/mongo/db/commands/authentication_commands.cpp | 3 +- src/mongo/db/commands/collection_to_capped.cpp | 3 +- src/mongo/db/commands/count_cmd.cpp | 7 +- src/mongo/db/commands/dbhash.cpp | 3 +- src/mongo/db/commands/geo_near_cmd.cpp | 5 +- src/mongo/db/commands/group.cpp | 7 +- src/mongo/db/commands/index_filter_commands.cpp | 9 +- .../db/commands/index_filter_commands_test.cpp | 9 +- src/mongo/db/commands/list_collections.cpp | 5 +- src/mongo/db/commands/mr.cpp | 15 +- src/mongo/db/commands/mr.h | 11 +- src/mongo/db/commands/pipeline_command.cpp | 5 +- src/mongo/db/commands/plan_cache_commands.cpp | 11 +- src/mongo/db/commands/plan_cache_commands_test.cpp | 15 +- src/mongo/db/commands/test_commands.cpp | 2 +- .../db/commands/write_commands/batch_executor.cpp | 7 +- .../db/commands/write_commands/batch_executor.h | 3 +- .../db/commands/write_commands/write_commands.cpp | 4 +- src/mongo/db/concurrency/d_concurrency.h | 1 - src/mongo/db/concurrency/lock_manager_test.cpp | 2 +- src/mongo/db/concurrency/lock_stats.cpp | 10 +- src/mongo/db/dbcommands.cpp | 7 +- src/mongo/db/dbeval.cpp | 4 +- src/mongo/db/dbwebserver.h | 2 +- src/mongo/db/exec/and_hash.h | 1 - src/mongo/db/exec/count.h | 3 +- src/mongo/db/exec/count_scan.h | 1 - src/mongo/db/exec/delete.h | 3 +- src/mongo/db/exec/distinct_scan.h | 1 - src/mongo/db/exec/geo_near.cpp | 17 ++- src/mongo/db/exec/geo_near.h | 5 +- src/mongo/db/exec/group.h | 3 +- src/mongo/db/exec/index_scan.h | 3 +- src/mongo/db/exec/keep_mutations.h | 3 +- src/mongo/db/exec/limit.h | 3 +- src/mongo/db/exec/multi_plan.h | 3 +- src/mongo/db/exec/near.h | 7 +- src/mongo/db/exec/oplogstart.h | 3 +- src/mongo/db/exec/plan_stats.h | 3 +- src/mongo/db/exec/projection.h | 5 +- src/mongo/db/exec/shard_filter.h | 3 +- src/mongo/db/exec/skip.h | 3 +- src/mongo/db/exec/sort.h | 13 +- src/mongo/db/exec/stagedebug_cmd.cpp | 2 +- src/mongo/db/exec/subplan.cpp | 2 +- src/mongo/db/exec/subplan.h | 9 +- src/mongo/db/exec/update.h | 5 +- src/mongo/db/exec/working_set.h | 3 +- src/mongo/db/exec/working_set_test.cpp | 3 +- src/mongo/db/geo/big_polygon.cpp | 3 +- src/mongo/db/geo/big_polygon.h | 7 +- src/mongo/db/geo/geometry_container.h | 23 ++-- src/mongo/db/geo/r2_region_coverer.h | 5 +- src/mongo/db/geo/shapes.h | 11 +- src/mongo/db/hasher.cpp | 5 +- src/mongo/db/index/btree_access_method.h | 3 +- src/mongo/db/index/btree_key_generator_test.cpp | 5 +- src/mongo/db/index/haystack_access_method.cpp | 5 +- src/mongo/db/instance.cpp | 13 +- src/mongo/db/introspect.cpp | 4 +- src/mongo/db/matcher/expression.h | 3 +- src/mongo/db/matcher/expression_array.h | 2 +- src/mongo/db/matcher/expression_geo.cpp | 2 +- src/mongo/db/matcher/expression_geo.h | 4 +- src/mongo/db/matcher/expression_leaf.h | 3 +- .../db/matcher/expression_parser_array_test.cpp | 2 +- .../db/matcher/expression_parser_geo_test.cpp | 4 +- .../db/matcher/expression_parser_leaf_test.cpp | 50 +++---- .../db/matcher/expression_parser_text_test.cpp | 6 +- src/mongo/db/matcher/expression_tree.h | 1 - src/mongo/db/matcher/match_details.h | 5 +- src/mongo/db/matcher/matcher.h | 3 +- src/mongo/db/matcher/path.h | 7 +- src/mongo/db/operation_context_impl.h | 1 - src/mongo/db/operation_context_noop.h | 3 +- src/mongo/db/ops/delete.cpp | 2 +- src/mongo/db/ops/modifier_add_to_set.h | 3 +- src/mongo/db/ops/modifier_bit.h | 3 +- src/mongo/db/ops/modifier_compare.h | 3 +- src/mongo/db/ops/modifier_current_date.h | 3 +- src/mongo/db/ops/modifier_inc.h | 3 +- src/mongo/db/ops/modifier_object_replace.h | 3 +- src/mongo/db/ops/modifier_pop.h | 3 +- src/mongo/db/ops/modifier_pull.h | 5 +- src/mongo/db/ops/modifier_pull_all.h | 3 +- src/mongo/db/ops/modifier_push.h | 3 +- src/mongo/db/ops/modifier_rename.h | 3 +- src/mongo/db/ops/modifier_set.h | 3 +- src/mongo/db/ops/modifier_unset.h | 3 +- src/mongo/db/ops/update.cpp | 2 +- src/mongo/db/ops/update_driver.cpp | 9 +- src/mongo/db/ops/update_driver_test.cpp | 5 +- src/mongo/db/pipeline/document_source.h | 23 ++-- src/mongo/db/pipeline/document_source_sort.cpp | 5 +- src/mongo/db/query/canonical_query.h | 7 +- src/mongo/db/query/explain.cpp | 7 +- src/mongo/db/query/find.cpp | 11 +- src/mongo/db/query/get_executor.cpp | 4 +- src/mongo/db/query/lite_parsed_query_test.cpp | 33 +++-- src/mongo/db/query/parsed_projection_test.cpp | 8 +- src/mongo/db/query/plan_cache.h | 13 +- src/mongo/db/query/plan_cache_test.cpp | 7 +- src/mongo/db/query/plan_enumerator.h | 9 +- src/mongo/db/query/plan_executor.cpp | 2 +- src/mongo/db/query/plan_executor.h | 13 +- src/mongo/db/query/query_planner.cpp | 2 +- src/mongo/db/query/query_planner_test.cpp | 6 +- src/mongo/db/query/query_planner_test_lib.cpp | 4 +- src/mongo/db/query/query_solution.h | 7 +- src/mongo/db/range_deleter.h | 5 +- src/mongo/db/range_deleter_test.cpp | 12 +- src/mongo/db/range_preserver.h | 3 +- src/mongo/db/repair_database.cpp | 5 +- .../repl/check_quorum_for_config_change_test.cpp | 7 +- src/mongo/db/repl/data_replicator_test.cpp | 4 +- src/mongo/db/repl/elect_cmd_runner.h | 5 +- src/mongo/db/repl/elect_cmd_runner_test.cpp | 9 +- src/mongo/db/repl/election_winner_declarer.h | 5 +- .../db/repl/election_winner_declarer_test.cpp | 5 +- src/mongo/db/repl/freshness_checker.h | 5 +- src/mongo/db/repl/freshness_checker_test.cpp | 11 +- src/mongo/db/repl/master_slave.cpp | 7 +- src/mongo/db/repl/operation_context_repl_mock.h | 1 - .../db/repl/repl_set_heartbeat_response_test.cpp | 3 +- .../repl/replication_coordinator_external_state.h | 1 - .../replication_coordinator_external_state_impl.h | 7 +- src/mongo/db/repl/replication_coordinator_impl.cpp | 4 +- src/mongo/db/repl/replication_coordinator_impl.h | 11 +- .../db/repl/replication_coordinator_impl_elect.cpp | 8 +- .../db/repl/replication_coordinator_impl_test.cpp | 5 +- .../db/repl/replication_coordinator_test_fixture.h | 3 +- src/mongo/db/repl/replication_executor.h | 4 +- src/mongo/db/repl/replication_executor_test.cpp | 1 - .../db/repl/replication_executor_test_fixture.h | 1 - src/mongo/db/repl/replication_info.cpp | 1 - src/mongo/db/repl/rs_rollback.cpp | 2 +- src/mongo/db/repl/scatter_gather_test.cpp | 7 +- src/mongo/db/repl/sync_source_feedback.h | 3 +- .../db/repl/topology_coordinator_impl_test.cpp | 7 +- src/mongo/db/service_context.cpp | 4 +- src/mongo/db/service_context_d.h | 3 +- src/mongo/db/sorter/sorter.cpp | 2 +- .../db/storage/in_memory/in_memory_engine_test.cpp | 2 +- src/mongo/db/storage/kv/kv_catalog.cpp | 15 +- src/mongo/db/storage/kv/kv_catalog.h | 1 - .../db/storage/kv/kv_collection_catalog_entry.h | 2 +- src/mongo/db/storage/kv/kv_engine_test_harness.cpp | 47 ++++--- src/mongo/db/storage/kv/kv_storage_engine.h | 7 +- .../db/storage/mmap_v1/btree/btree_interface.cpp | 7 +- .../catalog/namespace_details_rsv1_metadata.cpp | 3 +- .../db/storage/mmap_v1/catalog/namespace_index.cpp | 2 +- .../db/storage/mmap_v1/catalog/namespace_index.h | 3 +- .../mmap_v1/mmap_v1_database_catalog_entry.cpp | 3 +- .../mmap_v1/mmap_v1_database_catalog_entry.h | 5 +- .../db/storage/mmap_v1/mmap_v1_extent_manager.cpp | 2 +- src/mongo/db/storage/mmap_v1/mmap_v1_init_test.cpp | 3 +- .../db/storage/mmap_v1/record_store_v1_base.cpp | 3 +- .../db/storage/mmap_v1/record_store_v1_base.h | 3 +- src/mongo/db/storage/mmap_v1/repair_database.cpp | 9 +- src/mongo/db/storage/record_store_test_datafor.cpp | 27 ++-- .../db/storage/record_store_test_datasize.cpp | 23 ++-- .../db/storage/record_store_test_deleterecord.cpp | 31 ++--- src/mongo/db/storage/record_store_test_harness.cpp | 103 +++++++------- .../db/storage/record_store_test_insertrecord.cpp | 43 +++--- .../db/storage/record_store_test_manyiter.cpp | 23 ++-- .../db/storage/record_store_test_recorditer.cpp | 75 +++++----- .../db/storage/record_store_test_recordstore.cpp | 15 +- .../db/storage/record_store_test_repairiter.cpp | 35 +++-- .../db/storage/record_store_test_storagesize.cpp | 15 +- src/mongo/db/storage/record_store_test_touch.cpp | 43 +++--- .../db/storage/record_store_test_truncate.cpp | 27 ++-- .../db/storage/record_store_test_updaterecord.cpp | 45 +++--- .../record_store_test_updatewithdamages.cpp | 59 ++++---- .../db/storage/record_store_test_validate.cpp | 43 +++--- src/mongo/db/storage/record_store_test_validate.h | 11 +- src/mongo/db/storage/storage_engine_lock_file.h | 4 +- .../db/storage/storage_engine_lock_file_test.cpp | 1 - .../storage/wiredtiger/wiredtiger_index_test.cpp | 1 - .../db/storage/wiredtiger/wiredtiger_init_test.cpp | 3 +- .../db/storage/wiredtiger/wiredtiger_kv_engine.h | 5 +- .../wiredtiger/wiredtiger_kv_engine_test.cpp | 2 +- .../storage/wiredtiger/wiredtiger_record_store.cpp | 3 +- .../storage/wiredtiger/wiredtiger_record_store.h | 1 - .../wiredtiger/wiredtiger_record_store_test.cpp | 153 ++++++++++----------- .../storage/wiredtiger/wiredtiger_recovery_unit.h | 1 - .../wiredtiger/wiredtiger_server_status.cpp | 2 - .../db/storage/wiredtiger/wiredtiger_util_test.cpp | 5 +- 210 files changed, 832 insertions(+), 998 deletions(-) (limited to 'src/mongo/db') 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 92274c74627..dc15b46f58d 100644 --- a/src/mongo/db/auth/authz_manager_external_state_mock.cpp +++ b/src/mongo/db/auth/authz_manager_external_state_mock.cpp @@ -309,7 +309,7 @@ namespace { if (!parseResult.isOK()) { return parseResult.getStatus(); } - const boost::scoped_ptr matcher(parseResult.getValue()); + const std::unique_ptr matcher(parseResult.getValue()); NamespaceDocumentMap::iterator mapIt = _documents.find(collectionName); if (mapIt == _documents.end()) diff --git a/src/mongo/db/auth/native_sasl_authentication_session.cpp b/src/mongo/db/auth/native_sasl_authentication_session.cpp index 91bcef1fe3d..e2392beacd3 100644 --- a/src/mongo/db/auth/native_sasl_authentication_session.cpp +++ b/src/mongo/db/auth/native_sasl_authentication_session.cpp @@ -30,7 +30,6 @@ #include "mongo/db/auth/native_sasl_authentication_session.h" -#include #include #include "mongo/base/init.h" @@ -53,7 +52,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; namespace { SaslAuthenticationSession* createNativeSaslAuthenticationSession( @@ -87,7 +86,7 @@ namespace { // Not a SASL mechanism; no need to smoke test built-in mechanisms. continue; } - scoped_ptr + unique_ptr session(SaslAuthenticationSession::create(authzSession.get(), mechanism)); Status status = session->start("test", mechanism, diff --git a/src/mongo/db/auth/native_sasl_authentication_session.h b/src/mongo/db/auth/native_sasl_authentication_session.h index d6b5d64c4d4..57b90a145be 100644 --- a/src/mongo/db/auth/native_sasl_authentication_session.h +++ b/src/mongo/db/auth/native_sasl_authentication_session.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" @@ -66,6 +65,6 @@ namespace mongo { private: std::string _mechanism; - boost::scoped_ptr _saslConversation; + std::unique_ptr _saslConversation; }; } // namespace mongo diff --git a/src/mongo/db/auth/role_name.h b/src/mongo/db/auth/role_name.h index ef70f8df069..05b5d30e80b 100644 --- a/src/mongo/db/auth/role_name.h +++ b/src/mongo/db/auth/role_name.h @@ -32,7 +32,6 @@ #include #include -#include #include "mongo/base/disallow_copying.h" #include "mongo/base/string_data.h" @@ -118,7 +117,7 @@ namespace mongo { virtual Impl* doClone() const = 0; }; - RoleNameIterator() : _impl(NULL) {} + RoleNameIterator() : _impl(nullptr) {} RoleNameIterator(const RoleNameIterator& other) : _impl(Impl::clone(other._impl.get())) {} explicit RoleNameIterator(Impl* impl) : _impl(impl) {} @@ -136,7 +135,7 @@ namespace mongo { const RoleName* operator->() const { return &get(); } private: - boost::scoped_ptr _impl; + std::unique_ptr _impl; }; } // namespace mongo diff --git a/src/mongo/db/auth/sasl_commands.cpp b/src/mongo/db/auth/sasl_commands.cpp index a4843e9d900..6747a35771c 100644 --- a/src/mongo/db/auth/sasl_commands.cpp +++ b/src/mongo/db/auth/sasl_commands.cpp @@ -30,7 +30,6 @@ #include "mongo/platform/basic.h" -#include #include "mongo/base/init.h" #include "mongo/base/status.h" diff --git a/src/mongo/db/auth/sasl_scramsha1_server_conversation.cpp b/src/mongo/db/auth/sasl_scramsha1_server_conversation.cpp index fb719ef8c7b..83137a8bd99 100644 --- a/src/mongo/db/auth/sasl_scramsha1_server_conversation.cpp +++ b/src/mongo/db/auth/sasl_scramsha1_server_conversation.cpp @@ -34,7 +34,6 @@ #include #include -#include #include "mongo/crypto/crypto.h" #include "mongo/crypto/mechanism_scram.h" @@ -49,7 +48,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::string; SaslSCRAMSHA1ServerConversation::SaslSCRAMSHA1ServerConversation( @@ -205,7 +204,7 @@ namespace mongo { const int nonceLenQWords = 3; uint64_t binaryNonce[nonceLenQWords]; - scoped_ptr sr(SecureRandom::create()); + unique_ptr sr(SecureRandom::create()); binaryNonce[0] = sr->nextInt64(); binaryNonce[1] = sr->nextInt64(); diff --git a/src/mongo/db/auth/sasl_scramsha1_server_conversation.h b/src/mongo/db/auth/sasl_scramsha1_server_conversation.h index c0eeb231bac..1a2e1ad8fbd 100644 --- a/src/mongo/db/auth/sasl_scramsha1_server_conversation.h +++ b/src/mongo/db/auth/sasl_scramsha1_server_conversation.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include diff --git a/src/mongo/db/auth/user_document_parser_test.cpp b/src/mongo/db/auth/user_document_parser_test.cpp index 3d812f267df..d2dff197b12 100644 --- a/src/mongo/db/auth/user_document_parser_test.cpp +++ b/src/mongo/db/auth/user_document_parser_test.cpp @@ -29,7 +29,6 @@ * Unit tests of the UserDocumentParser type. */ -#include #include "mongo/base/status.h" #include "mongo/db/auth/action_set.h" @@ -45,14 +44,14 @@ namespace mongo { namespace { - using boost::scoped_ptr; + using std::unique_ptr; class V1UserDocumentParsing : public ::mongo::unittest::Test { public: V1UserDocumentParsing() {} - scoped_ptr user; - scoped_ptr adminUser; + unique_ptr user; + unique_ptr adminUser; V1UserDocumentParser v1parser; void setUp() { @@ -187,8 +186,8 @@ namespace { public: V2UserDocumentParsing() {} - scoped_ptr user; - scoped_ptr adminUser; + unique_ptr user; + unique_ptr adminUser; V2UserDocumentParser v2parser; void setUp() { diff --git a/src/mongo/db/auth/user_name.h b/src/mongo/db/auth/user_name.h index 73ff3675eb8..55220f33e10 100644 --- a/src/mongo/db/auth/user_name.h +++ b/src/mongo/db/auth/user_name.h @@ -28,9 +28,9 @@ #pragma once #include +#include #include -#include #include "mongo/base/disallow_copying.h" #include "mongo/base/string_data.h" @@ -106,7 +106,7 @@ namespace mongo { virtual Impl* doClone() const = 0; }; - UserNameIterator() : _impl(NULL) {} + UserNameIterator() : _impl(nullptr) {} UserNameIterator(const UserNameIterator& other) : _impl(Impl::clone(other._impl.get())) {} explicit UserNameIterator(Impl* impl) : _impl(impl) {} @@ -124,7 +124,7 @@ namespace mongo { const UserName* operator->() const { return &get(); } private: - boost::scoped_ptr _impl; + std::unique_ptr _impl; }; diff --git a/src/mongo/db/auth/user_set_test.cpp b/src/mongo/db/auth/user_set_test.cpp index bf65fa6ae3a..c1f036ae289 100644 --- a/src/mongo/db/auth/user_set_test.cpp +++ b/src/mongo/db/auth/user_set_test.cpp @@ -46,9 +46,9 @@ namespace { User* p2 = new User(UserName("George", "test")); User* p3 = new User(UserName("Bob", "test2")); - const boost::scoped_ptr delp1(p1); - const boost::scoped_ptr delp2(p2); - const boost::scoped_ptr delp3(p3); + const std::unique_ptr delp1(p1); + const std::unique_ptr delp2(p2); + const std::unique_ptr delp3(p3); ASSERT_NULL(set.lookup(UserName("Bob", "test"))); ASSERT_NULL(set.lookup(UserName("George", "test"))); @@ -102,7 +102,7 @@ namespace { UserNameIterator iter = pset.getNames(); ASSERT(!iter.more()); - boost::scoped_ptr user(new User(UserName("bob", "test"))); + std::unique_ptr user(new User(UserName("bob", "test"))); ASSERT_NULL(pset.add(user.get())); iter = pset.getNames(); diff --git a/src/mongo/db/catalog/capped_utils.cpp b/src/mongo/db/catalog/capped_utils.cpp index 2b046a64d39..8e981bd2491 100644 --- a/src/mongo/db/catalog/capped_utils.cpp +++ b/src/mongo/db/catalog/capped_utils.cpp @@ -138,7 +138,7 @@ namespace mongo { long long excessSize = fromCollection->dataSize(txn) - allocatedSpaceGuess; - boost::scoped_ptr exec(InternalPlanner::collectionScan( + std::unique_ptr exec(InternalPlanner::collectionScan( txn, fromNs, fromCollection, diff --git a/src/mongo/db/catalog/collection.cpp b/src/mongo/db/catalog/collection.cpp index 4e2c2155254..4be5fe65529 100644 --- a/src/mongo/db/catalog/collection.cpp +++ b/src/mongo/db/catalog/collection.cpp @@ -34,7 +34,6 @@ #include "mongo/db/catalog/collection.h" -#include #include "mongo/base/counter.h" #include "mongo/base/owned_pointer_map.h" @@ -89,7 +88,7 @@ namespace { } } - using boost::scoped_ptr; + using std::unique_ptr; using std::endl; using std::string; using std::vector; @@ -778,7 +777,7 @@ namespace { int idxn = 0; try { // Only applicable when 'full' validation is requested. - boost::scoped_ptr indexDetails(full ? new BSONObjBuilder() : NULL); + std::unique_ptr indexDetails(full ? new BSONObjBuilder() : NULL); BSONObjBuilder indexes; // not using subObjStart to be exception safe IndexCatalog::IndexIterator i = _indexCatalog.getIndexIterator(txn, false); @@ -788,7 +787,7 @@ namespace { IndexAccessMethod* iam = _indexCatalog.getIndex( descriptor ); invariant( iam ); - boost::scoped_ptr bob( + std::unique_ptr bob( indexDetails.get() ? new BSONObjBuilder( indexDetails->subobjStart(descriptor->indexNamespace())) : NULL); diff --git a/src/mongo/db/catalog/collection_info_cache.h b/src/mongo/db/catalog/collection_info_cache.h index 5f844fa1ddc..294f371eef0 100644 --- a/src/mongo/db/catalog/collection_info_cache.h +++ b/src/mongo/db/catalog/collection_info_cache.h @@ -30,7 +30,6 @@ #pragma once -#include #include "mongo/db/query/plan_cache.h" #include "mongo/db/query/query_settings.h" @@ -96,11 +95,11 @@ namespace mongo { UpdateIndexData _indexedPaths; // A cache for query plans. - boost::scoped_ptr _planCache; + std::unique_ptr _planCache; // Query settings. // Includes index filters. - boost::scoped_ptr _querySettings; + std::unique_ptr _querySettings; /** * Must be called under exclusive DB lock. diff --git a/src/mongo/db/catalog/cursor_manager.cpp b/src/mongo/db/catalog/cursor_manager.cpp index 8f72c706560..3143c3382cf 100644 --- a/src/mongo/db/catalog/cursor_manager.cpp +++ b/src/mongo/db/catalog/cursor_manager.cpp @@ -121,13 +121,13 @@ namespace mongo { Map _idToNS; unsigned _nextId; - boost::scoped_ptr _secureRandom; + std::unique_ptr _secureRandom; }; // Note that "globalCursorIdCache" must be declared before "globalCursorManager", as the latter // calls into the former during destruction. - boost::scoped_ptr globalCursorIdCache; - boost::scoped_ptr globalCursorManager; + std::unique_ptr globalCursorIdCache; + std::unique_ptr globalCursorManager; MONGO_INITIALIZER(GlobalCursorIdCache)(InitializerContext* context) { globalCursorIdCache.reset(new GlobalCursorIdCache()); diff --git a/src/mongo/db/catalog/cursor_manager.h b/src/mongo/db/catalog/cursor_manager.h index 60d5d673049..65fd204c5e3 100644 --- a/src/mongo/db/catalog/cursor_manager.h +++ b/src/mongo/db/catalog/cursor_manager.h @@ -30,7 +30,6 @@ #pragma once -#include #include "mongo/db/clientcursor.h" #include "mongo/db/invalidation_type.h" @@ -144,7 +143,7 @@ namespace mongo { NamespaceString _nss; unsigned _collectionCacheRuntimeId; - boost::scoped_ptr _random; + std::unique_ptr _random; mutable SimpleMutex _mutex; diff --git a/src/mongo/db/catalog/index_catalog_entry.cpp b/src/mongo/db/catalog/index_catalog_entry.cpp index 358b5a264d7..41ad093e8cc 100644 --- a/src/mongo/db/catalog/index_catalog_entry.cpp +++ b/src/mongo/db/catalog/index_catalog_entry.cpp @@ -185,7 +185,7 @@ namespace mongo { OperationContext::RecoveryUnitState const _oldRecoveryUnitState; // Owned and life-time is controlled - const boost::scoped_ptr _newRecoveryUnit; + const std::unique_ptr _newRecoveryUnit; }; void IndexCatalogEntry::setMultikey(OperationContext* txn) { diff --git a/src/mongo/db/catalog/index_catalog_entry.h b/src/mongo/db/catalog/index_catalog_entry.h index 770aec496e2..ad919b2bca5 100644 --- a/src/mongo/db/catalog/index_catalog_entry.h +++ b/src/mongo/db/catalog/index_catalog_entry.h @@ -113,7 +113,7 @@ namespace mongo { // Owned here. HeadManager* _headManager; - boost::scoped_ptr _filterExpression; + std::unique_ptr _filterExpression; // cached stuff diff --git a/src/mongo/db/catalog/index_create.cpp b/src/mongo/db/catalog/index_create.cpp index ef80ed8e1a2..84ed9d7e99d 100644 --- a/src/mongo/db/catalog/index_create.cpp +++ b/src/mongo/db/catalog/index_create.cpp @@ -35,7 +35,6 @@ #include "mongo/db/catalog/index_create.h" #include -#include #include "mongo/base/error_codes.h" #include "mongo/client/dbclientinterface.h" @@ -56,7 +55,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::string; using std::endl; @@ -237,7 +236,7 @@ namespace mongo { unsigned long long n = 0; - scoped_ptr exec(InternalPlanner::collectionScan(_txn, + unique_ptr exec(InternalPlanner::collectionScan(_txn, _collection->ns().ns(), _collection)); if (_buildInBackground) { diff --git a/src/mongo/db/client.h b/src/mongo/db/client.h index 251fce3b6d6..1368506b9ea 100644 --- a/src/mongo/db/client.h +++ b/src/mongo/db/client.h @@ -36,7 +36,6 @@ #pragma once -#include #include #include "mongo/db/client_basic.h" diff --git a/src/mongo/db/client_basic.h b/src/mongo/db/client_basic.h index 3fc6409c99d..b28bf0f4c3c 100644 --- a/src/mongo/db/client_basic.h +++ b/src/mongo/db/client_basic.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" diff --git a/src/mongo/db/clientcursor.h b/src/mongo/db/clientcursor.h index b2afdd56e10..4e81a39d7ba 100644 --- a/src/mongo/db/clientcursor.h +++ b/src/mongo/db/clientcursor.h @@ -29,7 +29,6 @@ #pragma once #include -#include #include "mongo/db/jsobj.h" #include "mongo/db/query/plan_executor.h" @@ -272,7 +271,7 @@ namespace mongo { // // The underlying execution machinery. // - boost::scoped_ptr _exec; + std::unique_ptr _exec; }; /** diff --git a/src/mongo/db/clientlistplugin.cpp b/src/mongo/db/clientlistplugin.cpp index 42499f5c116..aaffdd83492 100644 --- a/src/mongo/db/clientlistplugin.cpp +++ b/src/mongo/db/clientlistplugin.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include #include #include "mongo/bson/bsonobjbuilder.h" @@ -47,7 +46,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::string; namespace { @@ -169,7 +168,7 @@ namespace { string& errmsg, BSONObjBuilder& result) { - scoped_ptr filter; + unique_ptr filter; if ( cmdObj["filter"].isABSONObj() ) { StatusWithMatchExpression res = MatchExpressionParser::parse( cmdObj["filter"].Obj() ); diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp index 8ed98728c83..578da9b76c8 100644 --- a/src/mongo/db/cloner.cpp +++ b/src/mongo/db/cloner.cpp @@ -34,7 +34,6 @@ #include "mongo/db/cloner.h" -#include #include "mongo/base/status.h" #include "mongo/bson/util/builder.h" @@ -67,7 +66,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::list; using std::set; @@ -127,8 +126,8 @@ namespace mongo { invariant(from_collection.coll() != "system.indexes"); // XXX: can probably take dblock instead - scoped_ptr scopedXact(new ScopedTransaction(txn, MODE_X)); - scoped_ptr globalWriteLock(new Lock::GlobalWrite(txn->lockState())); + unique_ptr scopedXact(new ScopedTransaction(txn, MODE_X)); + unique_ptr globalWriteLock(new Lock::GlobalWrite(txn->lockState())); uassert(ErrorCodes::NotMaster, str::stream() << "Not primary while cloning collection " << from_collection.ns() << " to " << to_collection.ns(), diff --git a/src/mongo/db/commands/authentication_commands.cpp b/src/mongo/db/commands/authentication_commands.cpp index 6ebe3f06da8..1e2dc0a2439 100644 --- a/src/mongo/db/commands/authentication_commands.cpp +++ b/src/mongo/db/commands/authentication_commands.cpp @@ -33,7 +33,6 @@ #include "mongo/db/commands/authentication_commands.h" #include -#include #include #include @@ -136,7 +135,7 @@ namespace mongo { } SimpleMutex _randMutex; // Synchronizes accesses to _random. - boost::scoped_ptr _random; + std::unique_ptr _random; } cmdGetNonce; void CmdAuthenticate::redactForLogging(mutablebson::Document* cmdObj) { diff --git a/src/mongo/db/commands/collection_to_capped.cpp b/src/mongo/db/commands/collection_to_capped.cpp index 2ee13ed04ca..c9d3816a2b7 100644 --- a/src/mongo/db/commands/collection_to_capped.cpp +++ b/src/mongo/db/commands/collection_to_capped.cpp @@ -30,7 +30,6 @@ #include "mongo/platform/basic.h" -#include #include "mongo/db/background.h" #include "mongo/db/catalog/capped_utils.h" @@ -47,7 +46,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::string; using std::stringstream; diff --git a/src/mongo/db/commands/count_cmd.cpp b/src/mongo/db/commands/count_cmd.cpp index 452bf8209b8..00d5b4ac731 100644 --- a/src/mongo/db/commands/count_cmd.cpp +++ b/src/mongo/db/commands/count_cmd.cpp @@ -30,7 +30,6 @@ #include "mongo/platform/basic.h" -#include #include "mongo/db/commands.h" #include "mongo/db/curop.h" @@ -45,7 +44,7 @@ namespace mongo { namespace { - using boost::scoped_ptr; + using std::unique_ptr; using std::string; using std::stringstream; @@ -103,7 +102,7 @@ namespace { return getExecStatus; } - scoped_ptr exec(rawExec); + unique_ptr exec(rawExec); Explain::explainStages(exec.get(), verbosity, out); return Status::OK(); @@ -139,7 +138,7 @@ namespace { return appendCommandStatus(result, getExecStatus); } - scoped_ptr exec(rawExec); + unique_ptr exec(rawExec); // Store the plan summary string in CurOp. if (NULL != CurOp::get(txn)) { diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp index e96fb4b6288..f7cd6330366 100644 --- a/src/mongo/db/commands/dbhash.cpp +++ b/src/mongo/db/commands/dbhash.cpp @@ -32,7 +32,6 @@ #include "mongo/db/commands/dbhash.h" -#include #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" @@ -47,7 +46,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::list; using std::endl; diff --git a/src/mongo/db/commands/geo_near_cmd.cpp b/src/mongo/db/commands/geo_near_cmd.cpp index 42c608cb2d6..6f44749925d 100644 --- a/src/mongo/db/commands/geo_near_cmd.cpp +++ b/src/mongo/db/commands/geo_near_cmd.cpp @@ -28,7 +28,6 @@ #define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kCommand -#include #include #include "mongo/db/auth/action_set.h" @@ -54,7 +53,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::stringstream; class Geo2dFindNearCmd : public Command { @@ -202,7 +201,7 @@ namespace mongo { return false; } - scoped_ptr exec(rawExec); + unique_ptr exec(rawExec); double totalDistance = 0; BSONObjBuilder resultBuilder(result.subarrayStart("results")); diff --git a/src/mongo/db/commands/group.cpp b/src/mongo/db/commands/group.cpp index adfb6fae37f..31a03fa2543 100644 --- a/src/mongo/db/commands/group.cpp +++ b/src/mongo/db/commands/group.cpp @@ -30,7 +30,6 @@ #include "mongo/db/commands/group.h" -#include #include "mongo/db/auth/action_set.h" #include "mongo/db/auth/action_type.h" @@ -45,7 +44,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::string; static GroupCommand cmdGroup; @@ -152,7 +151,7 @@ namespace mongo { return appendCommandStatus(out, getExecStatus); } - scoped_ptr planExecutor(rawPlanExecutor); + unique_ptr planExecutor(rawPlanExecutor); // Group executors return ADVANCED exactly once, with the entire group result. BSONObj retval; @@ -211,7 +210,7 @@ namespace mongo { return getExecStatus; } - scoped_ptr planExecutor(rawPlanExecutor); + unique_ptr planExecutor(rawPlanExecutor); Explain::explainStages(planExecutor.get(), verbosity, out); return Status::OK(); diff --git a/src/mongo/db/commands/index_filter_commands.cpp b/src/mongo/db/commands/index_filter_commands.cpp index 17d932cffb5..ac85733d3b5 100644 --- a/src/mongo/db/commands/index_filter_commands.cpp +++ b/src/mongo/db/commands/index_filter_commands.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include #include #include @@ -120,7 +119,7 @@ namespace mongo { using std::string; using std::stringstream; using std::vector; - using boost::scoped_ptr; + using std::unique_ptr; IndexFilterCommand::IndexFilterCommand(const string& name, const string& helpText) : Command(name), @@ -274,7 +273,7 @@ namespace mongo { return status; } - scoped_ptr cq(cqRaw); + unique_ptr cq(cqRaw); querySettings->removeAllowedIndices(planCache->computeKey(*cq)); // Remove entry from plan cache @@ -320,7 +319,7 @@ namespace mongo { Status result = CanonicalQuery::canonicalize( ns, entry->query, entry->sort, entry->projection, &cqRaw, whereCallback); invariant(result.isOK()); - scoped_ptr cq(cqRaw); + unique_ptr cq(cqRaw); // Remove plan cache entry. planCache->remove(*cq); @@ -388,7 +387,7 @@ namespace mongo { if (!status.isOK()) { return status; } - scoped_ptr cq(cqRaw); + unique_ptr cq(cqRaw); // Add allowed indices to query settings, overriding any previous entries. querySettings->setAllowedIndices(*cq, planCache->computeKey(*cq), indexes); diff --git a/src/mongo/db/commands/index_filter_commands_test.cpp b/src/mongo/db/commands/index_filter_commands_test.cpp index a1781f2b5bd..baeb4b985a7 100644 --- a/src/mongo/db/commands/index_filter_commands_test.cpp +++ b/src/mongo/db/commands/index_filter_commands_test.cpp @@ -32,7 +32,6 @@ #include "mongo/db/commands/index_filter_commands.h" -#include #include "mongo/db/json.h" #include "mongo/db/operation_context_noop.h" @@ -44,7 +43,7 @@ using namespace mongo; namespace { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::string; using std::vector; @@ -121,7 +120,7 @@ namespace { // Create canonical query. CanonicalQuery* cqRaw; ASSERT_OK(CanonicalQuery::canonicalize(ns, queryObj, sortObj, projectionObj, &cqRaw)); - scoped_ptr cq(cqRaw); + unique_ptr cq(cqRaw); QuerySolution qs; qs.cacheData.reset(new SolutionCacheData()); @@ -143,7 +142,7 @@ namespace { // Create canonical query. CanonicalQuery* cqRaw; ASSERT_OK(CanonicalQuery::canonicalize(ns, queryObj, sortObj, projectionObj, &cqRaw)); - scoped_ptr cq(cqRaw); + unique_ptr cq(cqRaw); // Retrieve cache entries from plan cache. vector entries = planCache.getAllEntries(); @@ -157,7 +156,7 @@ namespace { // Alternatively, we could add key to PlanCacheEntry but that would be used in one place only. ASSERT_OK(CanonicalQuery::canonicalize(ns, entry->query, entry->sort, entry->projection, &cqRaw)); - scoped_ptr currentQuery(cqRaw); + unique_ptr currentQuery(cqRaw); if (planCache.computeKey(*currentQuery) == planCache.computeKey(*cq)) { found = true; diff --git a/src/mongo/db/commands/list_collections.cpp b/src/mongo/db/commands/list_collections.cpp index a9fd6daea3b..9c4789e3cd3 100644 --- a/src/mongo/db/commands/list_collections.cpp +++ b/src/mongo/db/commands/list_collections.cpp @@ -30,7 +30,6 @@ #include "mongo/platform/basic.h" -#include #include "mongo/db/auth/authorization_session.h" #include "mongo/db/catalog/collection_catalog_entry.h" @@ -49,7 +48,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::list; using std::string; using std::stringstream; @@ -93,7 +92,7 @@ namespace mongo { int, string& errmsg, BSONObjBuilder& result) { - boost::scoped_ptr matcher; + std::unique_ptr matcher; BSONElement filterElt = jsobj["filter"]; if (!filterElt.eoo()) { if (filterElt.type() != mongo::Object) { diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp index 099be62e3bc..4551380d44a 100644 --- a/src/mongo/db/commands/mr.cpp +++ b/src/mongo/db/commands/mr.cpp @@ -32,7 +32,6 @@ #include "mongo/db/commands/mr.h" -#include #include "mongo/client/connpool.h" #include "mongo/client/parallel.h" @@ -72,7 +71,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using boost::shared_ptr; using std::unique_ptr; using std::endl; @@ -205,7 +204,7 @@ namespace mongo { // need to build the reduce args: ( key, [values] ) BSONObjBuilder reduceArgs( sizeEstimate ); - boost::scoped_ptr valueBuilder; + std::unique_ptr valueBuilder; unsigned n = 0; for ( ; n ctx(new AutoGetCollectionForRead(_txn, _config.incLong)); + unique_ptr ctx(new AutoGetCollectionForRead(_txn, _config.incLong)); BSONObj prev; BSONList all; @@ -1061,7 +1060,7 @@ namespace mongo { &rawExec, QueryPlannerParams::NO_TABLE_SCAN).isOK()); - scoped_ptr exec(rawExec); + unique_ptr exec(rawExec); // iterate over all sorted objects BSONObj o; @@ -1400,9 +1399,9 @@ namespace mongo { const NamespaceString nss(config.ns); // Need lock and context to use it - scoped_ptr scopedXact( + unique_ptr scopedXact( new ScopedTransaction(txn, MODE_IS)); - scoped_ptr scopedAutoDb(new AutoGetDb(txn, nss.db(), MODE_S)); + unique_ptr scopedAutoDb(new AutoGetDb(txn, nss.db(), MODE_S)); const WhereCallbackReal whereCallback(txn, nss.db()); @@ -1433,7 +1432,7 @@ namespace mongo { return 0; } - scoped_ptr exec(rawExec); + unique_ptr exec(rawExec); Timer mt; diff --git a/src/mongo/db/commands/mr.h b/src/mongo/db/commands/mr.h index 79a6980b03e..b36e36b29b9 100644 --- a/src/mongo/db/commands/mr.h +++ b/src/mongo/db/commands/mr.h @@ -31,7 +31,6 @@ #pragma once #include -#include #include #include @@ -193,9 +192,9 @@ namespace mongo { // functions - boost::scoped_ptr mapper; - boost::scoped_ptr reducer; - boost::scoped_ptr finalizer; + std::unique_ptr mapper; + std::unique_ptr reducer; + std::unique_ptr finalizer; BSONObj mapParams; BSONObj scopeSetup; @@ -352,10 +351,10 @@ namespace mongo { int _add(InMemory* im , const BSONObj& a); OperationContext* _txn; - boost::scoped_ptr _scope; + std::unique_ptr _scope; bool _onDisk; // if the end result of this map reduce is disk or not - boost::scoped_ptr _temp; + std::unique_ptr _temp; long _size; // bytes in _temp long _dupCount; // number of duplicate key entries diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp index 34c0c2e5976..d8e575e1dcf 100644 --- a/src/mongo/db/commands/pipeline_command.cpp +++ b/src/mongo/db/commands/pipeline_command.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include #include #include @@ -57,7 +56,7 @@ namespace mongo { using boost::intrusive_ptr; - using boost::scoped_ptr; + using std::unique_ptr; using boost::shared_ptr; using std::unique_ptr; using std::string; @@ -218,7 +217,7 @@ namespace mongo { } PlanExecutor* exec = NULL; - scoped_ptr pin; // either this OR the execHolder will be non-null + unique_ptr pin; // either this OR the execHolder will be non-null unique_ptr execHolder; { // This will throw if the sharding version for this connection is out of date. The diff --git a/src/mongo/db/commands/plan_cache_commands.cpp b/src/mongo/db/commands/plan_cache_commands.cpp index 0f7003e3dd9..de19f1e10a5 100644 --- a/src/mongo/db/commands/plan_cache_commands.cpp +++ b/src/mongo/db/commands/plan_cache_commands.cpp @@ -30,7 +30,6 @@ #include "mongo/platform/basic.h" -#include #include #include @@ -49,7 +48,7 @@ namespace { - using boost::scoped_ptr; + using std::unique_ptr; using std::string; using namespace mongo; @@ -116,7 +115,7 @@ namespace mongo { using std::string; using std::stringstream; using std::vector; - using boost::scoped_ptr; + using std::unique_ptr; PlanCacheCommand::PlanCacheCommand(const string& name, const string& helpText, ActionType actionType) @@ -309,7 +308,7 @@ namespace mongo { return status; } - scoped_ptr cq(cqRaw); + unique_ptr cq(cqRaw); if (!planCache->contains(*cq)) { // Log if asked to clear non-existent query shape. @@ -379,7 +378,7 @@ namespace mongo { return status; } - scoped_ptr cq(cqRaw); + unique_ptr cq(cqRaw); if (!planCache.contains(*cq)) { // Return empty plans in results if query shape does not @@ -394,7 +393,7 @@ namespace mongo { if (!result.isOK()) { return result; } - scoped_ptr entry(entryRaw); + unique_ptr entry(entryRaw); BSONArrayBuilder plansBuilder(bob->subarrayStart("plans")); size_t numPlans = entry->plannerData.size(); diff --git a/src/mongo/db/commands/plan_cache_commands_test.cpp b/src/mongo/db/commands/plan_cache_commands_test.cpp index 69a9c461a76..abdc2f53a94 100644 --- a/src/mongo/db/commands/plan_cache_commands_test.cpp +++ b/src/mongo/db/commands/plan_cache_commands_test.cpp @@ -33,7 +33,6 @@ #include "mongo/db/commands/plan_cache_commands.h" #include -#include #include "mongo/db/json.h" #include "mongo/db/operation_context_noop.h" @@ -46,7 +45,7 @@ using namespace mongo; namespace { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::string; using std::vector; @@ -196,36 +195,36 @@ namespace { // Valid parameters ASSERT_OK(PlanCacheCommand::canonicalize(&txn, ns, fromjson("{query: {a: 1, b: 1}}"), &cqRaw)); - scoped_ptr query(cqRaw); + unique_ptr query(cqRaw); // Equivalent query should generate same key. ASSERT_OK(PlanCacheCommand::canonicalize(&txn, ns, fromjson("{query: {b: 1, a: 1}}"), &cqRaw)); - scoped_ptr equivQuery(cqRaw); + unique_ptr equivQuery(cqRaw); ASSERT_EQUALS(planCache.computeKey(*query), planCache.computeKey(*equivQuery)); // Sort query should generate different key from unsorted query. ASSERT_OK(PlanCacheCommand::canonicalize(&txn, ns, fromjson("{query: {a: 1, b: 1}, sort: {a: 1, b: 1}}"), &cqRaw)); - scoped_ptr sortQuery1(cqRaw); + unique_ptr sortQuery1(cqRaw); ASSERT_NOT_EQUALS(planCache.computeKey(*query), planCache.computeKey(*sortQuery1)); // Confirm sort arguments are properly delimited (SERVER-17158) ASSERT_OK(PlanCacheCommand::canonicalize(&txn, ns, fromjson("{query: {a: 1, b: 1}, sort: {aab: 1}}"), &cqRaw)); - scoped_ptr sortQuery2(cqRaw); + unique_ptr sortQuery2(cqRaw); ASSERT_NOT_EQUALS(planCache.computeKey(*sortQuery1), planCache.computeKey(*sortQuery2)); // Changing order and/or value of predicates should not change key ASSERT_OK(PlanCacheCommand::canonicalize(&txn, ns, fromjson("{query: {b: 3, a: 3}, sort: {a: 1, b: 1}}"), &cqRaw)); - scoped_ptr sortQuery3(cqRaw); + unique_ptr sortQuery3(cqRaw); ASSERT_EQUALS(planCache.computeKey(*sortQuery1), planCache.computeKey(*sortQuery3)); // Projected query should generate different key from unprojected query. ASSERT_OK(PlanCacheCommand::canonicalize(&txn, ns, fromjson("{query: {a: 1, b: 1}, projection: {_id: 0, a: 1}}"), &cqRaw)); - scoped_ptr projectionQuery(cqRaw); + unique_ptr projectionQuery(cqRaw); ASSERT_NOT_EQUALS(planCache.computeKey(*query), planCache.computeKey(*projectionQuery)); } diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp index e0eeb67c365..1c4c9d7a508 100644 --- a/src/mongo/db/commands/test_commands.cpp +++ b/src/mongo/db/commands/test_commands.cpp @@ -183,7 +183,7 @@ namespace mongo { RecordId end; { - boost::scoped_ptr exec(InternalPlanner::collectionScan(txn, + std::unique_ptr exec(InternalPlanner::collectionScan(txn, nss.ns(), collection, InternalPlanner::BACKWARD)); diff --git a/src/mongo/db/commands/write_commands/batch_executor.cpp b/src/mongo/db/commands/write_commands/batch_executor.cpp index f13689c1bf1..8f2ead63f7c 100644 --- a/src/mongo/db/commands/write_commands/batch_executor.cpp +++ b/src/mongo/db/commands/write_commands/batch_executor.cpp @@ -32,7 +32,6 @@ #include "mongo/db/commands/write_commands/batch_executor.h" -#include #include #include "mongo/base/error_codes.h" @@ -84,7 +83,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::endl; using std::string; @@ -1319,7 +1318,7 @@ namespace mongo { invariant(collection); PlanExecutor* rawExec; uassertStatusOK(getExecutorUpdate(txn, collection, &parsedUpdate, debug, &rawExec)); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); uassertStatusOK(exec->executePlan()); UpdateResult res = UpdateStage::makeUpdateResult(exec.get(), debug); @@ -1423,7 +1422,7 @@ namespace mongo { autoDb.getDb()->getCollection(nss), &parsedDelete, &rawExec)); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); // Execute the delete and retrieve the number deleted. uassertStatusOK(exec->executePlan()); diff --git a/src/mongo/db/commands/write_commands/batch_executor.h b/src/mongo/db/commands/write_commands/batch_executor.h index 6216ae65c89..0bab41d3ff8 100644 --- a/src/mongo/db/commands/write_commands/batch_executor.h +++ b/src/mongo/db/commands/write_commands/batch_executor.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" @@ -149,7 +148,7 @@ namespace mongo { LastError* _le; // Stats - boost::scoped_ptr _stats; + std::unique_ptr _stats; }; /** diff --git a/src/mongo/db/commands/write_commands/write_commands.cpp b/src/mongo/db/commands/write_commands/write_commands.cpp index 3fbacd52b79..4bf374778fb 100644 --- a/src/mongo/db/commands/write_commands/write_commands.cpp +++ b/src/mongo/db/commands/write_commands/write_commands.cpp @@ -235,7 +235,7 @@ namespace mongo { PlanExecutor* rawExec; uassertStatusOK(getExecutorUpdate(txn, collection, &parsedUpdate, debug, &rawExec)); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); // Explain the plan tree. Explain::explainStages( exec.get(), verbosity, out ); @@ -275,7 +275,7 @@ namespace mongo { PlanExecutor* rawExec; uassertStatusOK(getExecutorDelete(txn, collection, &parsedDelete, &rawExec)); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); // Explain the plan tree. Explain::explainStages(exec.get(), verbosity, out); diff --git a/src/mongo/db/concurrency/d_concurrency.h b/src/mongo/db/concurrency/d_concurrency.h index 2503b398b50..f21d356994e 100644 --- a/src/mongo/db/concurrency/d_concurrency.h +++ b/src/mongo/db/concurrency/d_concurrency.h @@ -28,7 +28,6 @@ #pragma once -#include #include // For UINT_MAX #include "mongo/db/concurrency/locker.h" diff --git a/src/mongo/db/concurrency/lock_manager_test.cpp b/src/mongo/db/concurrency/lock_manager_test.cpp index 9195e5c0423..50fc9826a9b 100644 --- a/src/mongo/db/concurrency/lock_manager_test.cpp +++ b/src/mongo/db/concurrency/lock_manager_test.cpp @@ -135,7 +135,7 @@ namespace mongo { LockManager lockMgr; const ResourceId resId(RESOURCE_COLLECTION, std::string("TestDB.collection")); - boost::scoped_ptr locker[6]; + std::unique_ptr locker[6]; for (int i = 0; i < 6; i++) { locker[i].reset(new MMAPV1LockerImpl()); } diff --git a/src/mongo/db/concurrency/lock_stats.cpp b/src/mongo/db/concurrency/lock_stats.cpp index 70d5a3da065..c115244f369 100644 --- a/src/mongo/db/concurrency/lock_stats.cpp +++ b/src/mongo/db/concurrency/lock_stats.cpp @@ -55,14 +55,14 @@ namespace mongo { const char* sectionName, const PerModeLockStatCounters& stat) const { - boost::scoped_ptr section; + std::unique_ptr section; // All indexing below starts from offset 1, because we do not want to report/account // position 0, which is a sentinel value for invalid resource/no lock. // Num acquires { - boost::scoped_ptr numAcquires; + std::unique_ptr numAcquires; for (int mode = 1; mode < LockModesCount; mode++) { const long long value = CounterOps::get(stat.modeStats[mode].numAcquisitions); if (value > 0) { @@ -81,7 +81,7 @@ namespace mongo { // Num waits { - boost::scoped_ptr numWaits; + std::unique_ptr numWaits; for (int mode = 1; mode < LockModesCount; mode++) { const long long value = CounterOps::get(stat.modeStats[mode].numWaits); if (value > 0) { @@ -100,7 +100,7 @@ namespace mongo { // Total time waiting { - boost::scoped_ptr timeAcquiring; + std::unique_ptr timeAcquiring; for (int mode = 1; mode < LockModesCount; mode++) { const long long value = CounterOps::get(stat.modeStats[mode].combinedWaitTimeMicros); if (value > 0) { @@ -119,7 +119,7 @@ namespace mongo { // Deadlocks { - boost::scoped_ptr deadlockCount; + std::unique_ptr deadlockCount; for (int mode = 1; mode < LockModesCount; mode++) { const long long value = CounterOps::get(stat.modeStats[mode].numDeadlocks); if (value > 0) { diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp index af49eb9d779..e9ff7a92bb0 100644 --- a/src/mongo/db/dbcommands.cpp +++ b/src/mongo/db/dbcommands.cpp @@ -32,7 +32,6 @@ #include "mongo/platform/basic.h" -#include #include #include @@ -109,7 +108,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::endl; using std::ostringstream; @@ -588,7 +587,7 @@ namespace mongo { // Check shard version at startup. // This will throw before we've done any work if shard version is outdated // We drop and re-acquire these locks every document because md5'ing is expensive - scoped_ptr ctx(new AutoGetCollectionForRead(txn, ns)); + unique_ptr ctx(new AutoGetCollectionForRead(txn, ns)); Collection* coll = ctx->getCollection(); PlanExecutor* rawExec; @@ -1195,7 +1194,7 @@ namespace { BSONObj interposedCmd = request.getCommandArgs(); std::string dbname = request.getDatabase().toString(); - scoped_ptr mmSetter; + unique_ptr mmSetter; if (isHelpRequest(request)) { CurOp::get(txn)->ensureStarted(); diff --git a/src/mongo/db/dbeval.cpp b/src/mongo/db/dbeval.cpp index 2bc695030c5..ae42d2a349d 100644 --- a/src/mongo/db/dbeval.cpp +++ b/src/mongo/db/dbeval.cpp @@ -48,7 +48,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::dec; using std::endl; using std::string; @@ -93,7 +93,7 @@ namespace { return false; } - scoped_ptr s(globalScriptEngine->newScope()); + unique_ptr s(globalScriptEngine->newScope()); s->registerOperation(txn); ScriptingFunction f = s->createFunction(code); diff --git a/src/mongo/db/dbwebserver.h b/src/mongo/db/dbwebserver.h index 0f4b6625194..10ded265989 100644 --- a/src/mongo/db/dbwebserver.h +++ b/src/mongo/db/dbwebserver.h @@ -129,7 +129,7 @@ namespace mongo { std::vector& headers); - const boost::scoped_ptr _webUsers; + const std::unique_ptr _webUsers; }; void webServerListenThread(boost::shared_ptr dbWebServer); diff --git a/src/mongo/db/exec/and_hash.h b/src/mongo/db/exec/and_hash.h index 1fe60234c85..a6acc353ac9 100644 --- a/src/mongo/db/exec/and_hash.h +++ b/src/mongo/db/exec/and_hash.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/db/jsobj.h" diff --git a/src/mongo/db/exec/count.h b/src/mongo/db/exec/count.h index 13cf7de83a6..ff70f3b2170 100644 --- a/src/mongo/db/exec/count.h +++ b/src/mongo/db/exec/count.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/db/exec/plan_stage.h" @@ -123,7 +122,7 @@ namespace mongo { // by us. WorkingSet* _ws; - boost::scoped_ptr _child; + std::unique_ptr _child; CommonStats _commonStats; CountStats _specificStats; diff --git a/src/mongo/db/exec/count_scan.h b/src/mongo/db/exec/count_scan.h index d04b2b89e8b..e63f672637d 100644 --- a/src/mongo/db/exec/count_scan.h +++ b/src/mongo/db/exec/count_scan.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/db/exec/plan_stage.h" #include "mongo/db/index/index_access_method.h" diff --git a/src/mongo/db/exec/delete.h b/src/mongo/db/exec/delete.h index c84d0e9bfd6..028cd086279 100644 --- a/src/mongo/db/exec/delete.h +++ b/src/mongo/db/exec/delete.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/db/exec/plan_stage.h" #include "mongo/db/jsobj.h" @@ -127,7 +126,7 @@ namespace mongo { // stage. Collection* _collection; - boost::scoped_ptr _child; + std::unique_ptr _child; // If not WorkingSet::INVALID_ID, we use this rather than asking our child what to do next. WorkingSetID _idRetrying; diff --git a/src/mongo/db/exec/distinct_scan.h b/src/mongo/db/exec/distinct_scan.h index 8d7f0a8a18b..d87f5249535 100644 --- a/src/mongo/db/exec/distinct_scan.h +++ b/src/mongo/db/exec/distinct_scan.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/db/exec/plan_stage.h" #include "mongo/db/index/index_access_method.h" diff --git a/src/mongo/db/exec/geo_near.cpp b/src/mongo/db/exec/geo_near.cpp index 3755af02bb3..65d4428b3a8 100644 --- a/src/mongo/db/exec/geo_near.cpp +++ b/src/mongo/db/exec/geo_near.cpp @@ -47,12 +47,11 @@ #include "mongo/db/index/expression_params.h" #include "mongo/util/log.h" -#include #include namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::abs; using std::unique_ptr; @@ -312,8 +311,8 @@ namespace mongo { const IndexDescriptor* _twoDIndex; // Not owned here. const GeoNearParams* _nearParams; // Not owned here. - scoped_ptr _indexScan; - scoped_ptr _converter; + unique_ptr _indexScan; + unique_ptr _converter; GeoHash _centroidCell; unsigned _currentLevel; }; @@ -624,7 +623,7 @@ namespace mongo { private: - const scoped_ptr _region; + const unique_ptr _region; const GeoHashConverter _unhasher; }; @@ -645,7 +644,7 @@ namespace mongo { private: // Owns matcher - const scoped_ptr _matcher; + const unique_ptr _matcher; }; // Helper class to maintain ownership of a match expression alongside an index scan @@ -666,7 +665,7 @@ namespace mongo { private: // Owns matcher - const scoped_ptr _matcher; + const unique_ptr _matcher; }; } @@ -1009,7 +1008,7 @@ namespace mongo { private: - const scoped_ptr _region; + const unique_ptr _region; }; } @@ -1046,7 +1045,7 @@ namespace mongo { const IndexDescriptor* _s2Index; // Not owned here. const GeoNearParams* _nearParams; // Not owned here. int _currentLevel; - scoped_ptr _indexScan; + unique_ptr _indexScan; }; // Setup the index scan stage for neighbors at this level. diff --git a/src/mongo/db/exec/geo_near.h b/src/mongo/db/exec/geo_near.h index af7352cbe47..52c28ed8303 100644 --- a/src/mongo/db/exec/geo_near.h +++ b/src/mongo/db/exec/geo_near.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/db/exec/near.h" #include "mongo/db/exec/working_set.h" @@ -115,7 +114,7 @@ namespace mongo { double _boundsIncrement; class DensityEstimator; - boost::scoped_ptr _densityEstimator; + std::unique_ptr _densityEstimator; }; /** @@ -171,7 +170,7 @@ namespace mongo { double _boundsIncrement; class DensityEstimator; - boost::scoped_ptr _densityEstimator; + std::unique_ptr _densityEstimator; }; } // namespace mongo diff --git a/src/mongo/db/exec/group.h b/src/mongo/db/exec/group.h index 2b2e5bb3d04..b9f525b95bb 100644 --- a/src/mongo/db/exec/group.h +++ b/src/mongo/db/exec/group.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/db/exec/plan_stage.h" #include "mongo/scripting/engine.h" @@ -144,7 +143,7 @@ namespace mongo { CommonStats _commonStats; GroupStats _specificStats; - boost::scoped_ptr _child; + std::unique_ptr _child; // Current state for this stage. GroupState _groupState; diff --git a/src/mongo/db/exec/index_scan.h b/src/mongo/db/exec/index_scan.h index 0a3c1436103..555b00c4beb 100644 --- a/src/mongo/db/exec/index_scan.h +++ b/src/mongo/db/exec/index_scan.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/db/exec/plan_stage.h" #include "mongo/db/index/index_access_method.h" @@ -167,7 +166,7 @@ namespace mongo { // In this case, _checker will be non-NULL. // - boost::scoped_ptr _checker; + std::unique_ptr _checker; IndexSeekPoint _seekPoint; // diff --git a/src/mongo/db/exec/keep_mutations.h b/src/mongo/db/exec/keep_mutations.h index a4c594a1f33..111d777d894 100644 --- a/src/mongo/db/exec/keep_mutations.h +++ b/src/mongo/db/exec/keep_mutations.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/db/jsobj.h" #include "mongo/db/exec/plan_stage.h" @@ -73,7 +72,7 @@ namespace mongo { // Not owned here. WorkingSet* _workingSet; - boost::scoped_ptr _child; + std::unique_ptr _child; // Not owned here. Should be the full query expression tree. const MatchExpression* _filter; diff --git a/src/mongo/db/exec/limit.h b/src/mongo/db/exec/limit.h index 484df742439..f3f722fd1a1 100644 --- a/src/mongo/db/exec/limit.h +++ b/src/mongo/db/exec/limit.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/db/jsobj.h" #include "mongo/db/exec/plan_stage.h" @@ -69,7 +68,7 @@ namespace mongo { private: WorkingSet* _ws; - boost::scoped_ptr _child; + std::unique_ptr _child; // We only return this many results. int _numToReturn; diff --git a/src/mongo/db/exec/multi_plan.h b/src/mongo/db/exec/multi_plan.h index d820324dfe8..189190163ca 100644 --- a/src/mongo/db/exec/multi_plan.h +++ b/src/mongo/db/exec/multi_plan.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/db/jsobj.h" #include "mongo/db/catalog/collection.h" @@ -223,7 +222,7 @@ namespace mongo { // to use to pull the record into memory. We take ownership of the RecordFetcher here, // deleting it after we've had a chance to do the fetch. For timing-based yields, we // just pass a NULL fetcher. - boost::scoped_ptr _fetcher; + std::unique_ptr _fetcher; // Stats CommonStats _commonStats; diff --git a/src/mongo/db/exec/near.h b/src/mongo/db/exec/near.h index a3db2c2b126..f21758617ac 100644 --- a/src/mongo/db/exec/near.h +++ b/src/mongo/db/exec/near.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/string_data.h" @@ -193,14 +192,14 @@ namespace mongo { unordered_map _nextIntervalSeen; // Stats for the stage covering this interval - boost::scoped_ptr _nextIntervalStats; + std::unique_ptr _nextIntervalStats; // Sorted buffered results to be returned - the current interval struct SearchResult; std::priority_queue _resultBuffer; // Stats - boost::scoped_ptr _stats; + std::unique_ptr _stats; // The current stage from which this stage should buffer results // Pointer to the last interval in _childrenIntervals. Owned by _childrenIntervals. @@ -225,7 +224,7 @@ namespace mongo { bool inclusiveMax); // Owned by NearStage - boost::scoped_ptr const covering; + std::unique_ptr const covering; const bool dedupCovering; const double minDistance; diff --git a/src/mongo/db/exec/oplogstart.h b/src/mongo/db/exec/oplogstart.h index 47850eafef8..d7da98f6833 100644 --- a/src/mongo/db/exec/oplogstart.h +++ b/src/mongo/db/exec/oplogstart.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/base/owned_pointer_vector.h" #include "mongo/db/exec/collection_scan.h" @@ -107,7 +106,7 @@ namespace mongo { OperationContext* _txn; // If we're backwards scanning we just punt to a collscan. - boost::scoped_ptr _cs; + std::unique_ptr _cs; // This is only used for the extent hopping scan. std::vector> _subIterators; diff --git a/src/mongo/db/exec/plan_stats.h b/src/mongo/db/exec/plan_stats.h index a9d5a2ae187..2c5aafd1a95 100644 --- a/src/mongo/db/exec/plan_stats.h +++ b/src/mongo/db/exec/plan_stats.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include #include @@ -134,7 +133,7 @@ namespace mongo { CommonStats common; // Per-stage place to stash additional information - boost::scoped_ptr specific; + std::unique_ptr specific; // The stats of the node's children. std::vector children; diff --git a/src/mongo/db/exec/projection.h b/src/mongo/db/exec/projection.h index 6878861a997..d70967eebe1 100644 --- a/src/mongo/db/exec/projection.h +++ b/src/mongo/db/exec/projection.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/db/exec/plan_stage.h" #include "mongo/db/exec/projection_exec.h" @@ -124,11 +123,11 @@ namespace mongo { private: Status transform(WorkingSetMember* member); - boost::scoped_ptr _exec; + std::unique_ptr _exec; // _ws is not owned by us. WorkingSet* _ws; - boost::scoped_ptr _child; + std::unique_ptr _child; // Stats CommonStats _commonStats; diff --git a/src/mongo/db/exec/shard_filter.h b/src/mongo/db/exec/shard_filter.h index f0b04ae9d4a..0703522b525 100644 --- a/src/mongo/db/exec/shard_filter.h +++ b/src/mongo/db/exec/shard_filter.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/db/exec/plan_stage.h" #include "mongo/db/jsobj.h" @@ -98,7 +97,7 @@ namespace mongo { private: WorkingSet* _ws; - boost::scoped_ptr _child; + std::unique_ptr _child; // Stats CommonStats _commonStats; diff --git a/src/mongo/db/exec/skip.h b/src/mongo/db/exec/skip.h index ff3982a415c..77bdd5786a5 100644 --- a/src/mongo/db/exec/skip.h +++ b/src/mongo/db/exec/skip.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/db/exec/plan_stage.h" #include "mongo/db/jsobj.h" @@ -68,7 +67,7 @@ namespace mongo { private: WorkingSet* _ws; - boost::scoped_ptr _child; + std::unique_ptr _child; // We drop the first _toSkip results that we would have returned. int _toSkip; diff --git a/src/mongo/db/exec/sort.h b/src/mongo/db/exec/sort.h index 2255a5ce82c..692b4b3b4cb 100644 --- a/src/mongo/db/exec/sort.h +++ b/src/mongo/db/exec/sort.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include @@ -128,10 +127,10 @@ namespace mongo { IndexBounds _bounds; // Helper to extract sorting keys from documents. - boost::scoped_ptr _keyGen; + std::unique_ptr _keyGen; // Helper to filter keys, ensuring keys generated with _keyGen are within _bounds. - boost::scoped_ptr _boundsChecker; + std::unique_ptr _boundsChecker; }; /** @@ -180,7 +179,7 @@ namespace mongo { WorkingSet* _ws; // Where we're reading data to sort from. - boost::scoped_ptr _child; + std::unique_ptr _child; // The raw sort _pattern as expressed by the user BSONObj _pattern; @@ -194,7 +193,7 @@ namespace mongo { // // Sort key generation // - boost::scoped_ptr _sortKeyGen; + std::unique_ptr _sortKeyGen; // // Data storage @@ -242,7 +241,7 @@ namespace mongo { // Comparator for data buffer // Initialization follows sort key generator - boost::scoped_ptr _sortKeyComparator; + std::unique_ptr _sortKeyComparator; // The data we buffer and sort. // _data will contain sorted data when all data is gathered @@ -253,7 +252,7 @@ namespace mongo { // be used to provide the results of this stage through _resultIterator. std::vector _data; typedef std::set SortableDataItemSet; - boost::scoped_ptr _dataSet; + std::unique_ptr _dataSet; // Iterates through _data post-sort returning it. std::vector::iterator _resultIterator; diff --git a/src/mongo/db/exec/stagedebug_cmd.cpp b/src/mongo/db/exec/stagedebug_cmd.cpp index c3b59a84de2..fe600dcfb7c 100644 --- a/src/mongo/db/exec/stagedebug_cmd.cpp +++ b/src/mongo/db/exec/stagedebug_cmd.cpp @@ -166,7 +166,7 @@ namespace mongo { Status execStatus = PlanExecutor::make(txn, ws.release(), rootFetch, collection, PlanExecutor::YIELD_AUTO, &rawExec); fassert(28536, execStatus); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); BSONArrayBuilder resultBuilder(result.subarrayStart("results")); diff --git a/src/mongo/db/exec/subplan.cpp b/src/mongo/db/exec/subplan.cpp index 386d72eb539..0c64aa7b178 100644 --- a/src/mongo/db/exec/subplan.cpp +++ b/src/mongo/db/exec/subplan.cpp @@ -62,7 +62,7 @@ namespace mongo { _ws(ws), _plannerParams(params), _query(cq), - _child(NULL), + _child(nullptr), _commonStats(kStageType) { invariant(_collection); } diff --git a/src/mongo/db/exec/subplan.h b/src/mongo/db/exec/subplan.h index 8de399a4983..f46a25b3bc8 100644 --- a/src/mongo/db/exec/subplan.h +++ b/src/mongo/db/exec/subplan.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/owned_pointer_vector.h" @@ -129,13 +128,13 @@ namespace mongo { BranchPlanningResult() { } // A parsed version of one branch of the $or. - boost::scoped_ptr canonicalQuery; + std::unique_ptr canonicalQuery; // If there is cache data available, then we store it here rather than generating // a set of alternate plans for the branch. The index tags from the cache data // can be applied directly to the parent $or MatchExpression when generating the // composite solution. - boost::scoped_ptr cachedSolution; + std::unique_ptr cachedSolution; // Query solutions resulting from planning the $or branch. OwnedPointerVector solutions; @@ -180,9 +179,9 @@ namespace mongo { // If we successfully create a "composite solution" by planning each $or branch // independently, that solution is owned here. - boost::scoped_ptr _compositeSolution; + std::unique_ptr _compositeSolution; - boost::scoped_ptr _child; + std::unique_ptr _child; // Holds a list of the results from planning each branch. OwnedPointerVector _branchResults; diff --git a/src/mongo/db/exec/update.h b/src/mongo/db/exec/update.h index c1a9372eae9..8460846aca1 100644 --- a/src/mongo/db/exec/update.h +++ b/src/mongo/db/exec/update.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/db/catalog/collection.h" #include "mongo/db/exec/plan_stage.h" @@ -187,7 +186,7 @@ namespace mongo { Collection* _collection; // Owned by us. - boost::scoped_ptr _child; + std::unique_ptr _child; // If not WorkingSet::INVALID_ID, we use this rather than asking our child what to do next. WorkingSetID _idRetrying; @@ -212,7 +211,7 @@ namespace mongo { // // So, no matter what, we keep track of where the doc wound up. typedef unordered_set DiskLocSet; - const boost::scoped_ptr _updatedLocs; + const std::unique_ptr _updatedLocs; // These get reused for each update. mutablebson::Document& _doc; diff --git a/src/mongo/db/exec/working_set.h b/src/mongo/db/exec/working_set.h index d251f95d5c4..ac23c2cf667 100644 --- a/src/mongo/db/exec/working_set.h +++ b/src/mongo/db/exec/working_set.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" @@ -338,7 +337,7 @@ namespace mongo { size_t getMemUsage() const; private: - boost::scoped_ptr _computed[WSM_COMPUTED_NUM_TYPES]; + std::unique_ptr _computed[WSM_COMPUTED_NUM_TYPES]; std::unique_ptr _fetcher; }; diff --git a/src/mongo/db/exec/working_set_test.cpp b/src/mongo/db/exec/working_set_test.cpp index 01bd2a880c8..d4d7163831b 100644 --- a/src/mongo/db/exec/working_set_test.cpp +++ b/src/mongo/db/exec/working_set_test.cpp @@ -30,7 +30,6 @@ * This file contains tests for mongo/db/exec/working_set.cpp */ -#include #include "mongo/db/exec/working_set.h" #include "mongo/db/json.h" @@ -59,7 +58,7 @@ namespace { member = NULL; } - boost::scoped_ptr ws; + std::unique_ptr ws; WorkingSetMember* member; }; diff --git a/src/mongo/db/geo/big_polygon.cpp b/src/mongo/db/geo/big_polygon.cpp index 10241db45dc..94723eb4cae 100644 --- a/src/mongo/db/geo/big_polygon.cpp +++ b/src/mongo/db/geo/big_polygon.cpp @@ -28,7 +28,6 @@ #include "mongo/db/geo/big_polygon.h" -#include #include #include "mongo/base/owned_pointer_vector.h" @@ -36,7 +35,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::vector; diff --git a/src/mongo/db/geo/big_polygon.h b/src/mongo/db/geo/big_polygon.h index 7125da35f35..c5a913ac05b 100644 --- a/src/mongo/db/geo/big_polygon.h +++ b/src/mongo/db/geo/big_polygon.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/db/geo/s2.h" @@ -104,7 +103,7 @@ namespace mongo { private: - boost::scoped_ptr _loop; + std::unique_ptr _loop; // Cache whether the loop area is at most 2*Pi (the area of hemisphere). // @@ -114,8 +113,8 @@ namespace mongo { bool _isNormalized; // Cached to do Intersects() and Contains() with S2Polylines. - mutable boost::scoped_ptr _borderLine; - mutable boost::scoped_ptr _borderPoly; + mutable std::unique_ptr _borderLine; + mutable std::unique_ptr _borderPoly; }; } diff --git a/src/mongo/db/geo/geometry_container.h b/src/mongo/db/geo/geometry_container.h index 415f603d178..05ca1ed2962 100644 --- a/src/mongo/db/geo/geometry_container.h +++ b/src/mongo/db/geo/geometry_container.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" @@ -143,20 +142,20 @@ namespace mongo { // Only one of these shared_ptrs should be non-NULL. S2Region is a // superclass but it only supports testing against S2Cells. We need // the most specific class we can get. - boost::scoped_ptr _point; - boost::scoped_ptr _line; - boost::scoped_ptr _box; - boost::scoped_ptr _polygon; - boost::scoped_ptr _cap; - boost::scoped_ptr _multiPoint; - boost::scoped_ptr _multiLine; - boost::scoped_ptr _multiPolygon; - boost::scoped_ptr _geometryCollection; + std::unique_ptr _point; + std::unique_ptr _line; + std::unique_ptr _box; + std::unique_ptr _polygon; + std::unique_ptr _cap; + std::unique_ptr _multiPoint; + std::unique_ptr _multiLine; + std::unique_ptr _multiPolygon; + std::unique_ptr _geometryCollection; // Cached for use during covering calculations // TODO: _s2Region is currently generated immediately - don't necessarily need to do this - boost::scoped_ptr _s2Region; - boost::scoped_ptr _r2Region; + std::unique_ptr _s2Region; + std::unique_ptr _r2Region; }; } // namespace mongo diff --git a/src/mongo/db/geo/r2_region_coverer.h b/src/mongo/db/geo/r2_region_coverer.h index ff4f820d755..ddfda208094 100644 --- a/src/mongo/db/geo/r2_region_coverer.h +++ b/src/mongo/db/geo/r2_region_coverer.h @@ -29,7 +29,6 @@ #pragma once #include -#include #include #include "mongo/db/geo/hash.h" @@ -109,8 +108,8 @@ namespace mongo { typedef std::pair QueueEntry; typedef std::priority_queue, CompareQueueEntries> CandidateQueue; - boost::scoped_ptr _candidateQueue; // Priority queue owns candidate pointers. - boost::scoped_ptr > _results; + std::unique_ptr _candidateQueue; // Priority queue owns candidate pointers. + std::unique_ptr > _results; }; diff --git a/src/mongo/db/geo/shapes.h b/src/mongo/db/geo/shapes.h index 297eb8135d3..5eb2f8bceaa 100644 --- a/src/mongo/db/geo/shapes.h +++ b/src/mongo/db/geo/shapes.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include #include @@ -191,8 +190,8 @@ namespace mongo { std::vector _points; // Cached attributes of the polygon - mutable boost::scoped_ptr _bounds; - mutable boost::scoped_ptr _centroid; + mutable std::unique_ptr _bounds; + mutable std::unique_ptr _centroid; }; class R2Region { @@ -301,10 +300,10 @@ namespace mongo { PolygonWithCRS() : crs(UNSET) {} - boost::scoped_ptr s2Polygon; + std::unique_ptr s2Polygon; // Simple polygons with strict winding order may be bigger or smaller than a hemisphere. // Only used for query. We don't support storing/indexing big polygons. - boost::scoped_ptr bigPolygon; + std::unique_ptr bigPolygon; Polygon oldPolygon; CRS crs; @@ -339,7 +338,7 @@ namespace mongo { std::vector points; - // The amount of indirection here is painful but we can't operator= scoped_ptr or + // The amount of indirection here is painful but we can't operator= unique_ptr or // OwnedPointerVector. OwnedPointerVector lines; OwnedPointerVector polygons; diff --git a/src/mongo/db/hasher.cpp b/src/mongo/db/hasher.cpp index 8acb2269459..3ae131a7dee 100644 --- a/src/mongo/db/hasher.cpp +++ b/src/mongo/db/hasher.cpp @@ -34,14 +34,13 @@ #include "mongo/db/hasher.h" -#include #include "mongo/db/jsobj.h" #include "mongo/util/startup_test.h" namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; Hasher::Hasher( HashSeed seed ) : _seed( seed ) { md5_init( &_md5State ); @@ -57,7 +56,7 @@ namespace mongo { } long long int BSONElementHasher::hash64( const BSONElement& e , HashSeed seed ){ - scoped_ptr h( HasherFactory::createHasher( seed ) ); + unique_ptr h( HasherFactory::createHasher( seed ) ); recursiveHash( h.get() , e , false ); HashDigest d; h->finish(d); diff --git a/src/mongo/db/index/btree_access_method.h b/src/mongo/db/index/btree_access_method.h index a19858ca2b4..4133b41b892 100644 --- a/src/mongo/db/index/btree_access_method.h +++ b/src/mongo/db/index/btree_access_method.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/base/status.h" #include "mongo/db/index/index_access_method.h" @@ -52,7 +51,7 @@ namespace mongo { virtual void getKeys(const BSONObj& obj, BSONObjSet* keys) const; // Our keys differ for V0 and V1. - boost::scoped_ptr _keyGenerator; + std::unique_ptr _keyGenerator; }; } // namespace mongo diff --git a/src/mongo/db/index/btree_key_generator_test.cpp b/src/mongo/db/index/btree_key_generator_test.cpp index 9430171f38e..f01f6552f18 100644 --- a/src/mongo/db/index/btree_key_generator_test.cpp +++ b/src/mongo/db/index/btree_key_generator_test.cpp @@ -28,14 +28,13 @@ #include "mongo/db/index/btree_key_generator.h" -#include #include #include "mongo/db/json.h" #include "mongo/unittest/unittest.h" using namespace mongo; -using boost::scoped_ptr; +using std::unique_ptr; using std::cout; using std::endl; using std::vector; @@ -87,7 +86,7 @@ namespace { fixed.push_back(BSONElement()); } - scoped_ptr keyGen( + unique_ptr keyGen( new BtreeKeyGeneratorV1(fieldNames, fixed, sparse)); // diff --git a/src/mongo/db/index/haystack_access_method.cpp b/src/mongo/db/index/haystack_access_method.cpp index 1d7d27f233c..263568af37a 100644 --- a/src/mongo/db/index/haystack_access_method.cpp +++ b/src/mongo/db/index/haystack_access_method.cpp @@ -32,7 +32,6 @@ #include "mongo/db/index/haystack_access_method.h" -#include #include "mongo/base/status.h" #include "mongo/db/geo/hash.h" @@ -45,7 +44,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; HaystackAccessMethod::HaystackAccessMethod(IndexCatalogEntry* btreeState, SortedDataInterface* btree) : IndexAccessMethod(btreeState, btree) { @@ -104,7 +103,7 @@ namespace mongo { unordered_set thisPass; - scoped_ptr exec(InternalPlanner::indexScan(txn, collection, + unique_ptr exec(InternalPlanner::indexScan(txn, collection, _descriptor, key, key, true)); PlanExecutor::ExecState state; RecordId loc; diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp index 8381d244727..3cb3504c24a 100644 --- a/src/mongo/db/instance.cpp +++ b/src/mongo/db/instance.cpp @@ -32,7 +32,6 @@ #include "mongo/platform/basic.h" -#include #include #include #include @@ -110,7 +109,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using logger::LogComponent; using std::unique_ptr; using std::endl; @@ -752,7 +751,7 @@ namespace { &parsedUpdate, &op.debug(), &rawExec)); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); // Run the plan and get stats out. uassertStatusOK(exec->executePlan()); @@ -806,7 +805,7 @@ namespace { &parsedUpdate, &op.debug(), &rawExec)); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); // Run the plan and get stats out. uassertStatusOK(exec->executePlan()); @@ -869,7 +868,7 @@ namespace { ctx.db()->getCollection(nsString), &parsedDelete, &rawExec)); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); // Run the plan and get the number of docs deleted. uassertStatusOK(exec->executePlan()); @@ -904,8 +903,8 @@ namespace { curop.debug().ntoreturn = ntoreturn; curop.debug().cursorid = cursorid; - scoped_ptr ex; - scoped_ptr timer; + unique_ptr ex; + unique_ptr timer; int pass = 0; bool exhaust = false; QueryResult::View msgdata = 0; diff --git a/src/mongo/db/introspect.cpp b/src/mongo/db/introspect.cpp index 9354f8cd3ca..b0788ad9d55 100644 --- a/src/mongo/db/introspect.cpp +++ b/src/mongo/db/introspect.cpp @@ -46,7 +46,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::endl; using std::string; @@ -112,7 +112,7 @@ namespace { while (true) { ScopedTransaction scopedXact(txn, MODE_IX); - boost::scoped_ptr autoGetDb; + std::unique_ptr autoGetDb; if (acquireDbXLock) { autoGetDb.reset(new AutoGetDb(txn, dbName, MODE_X)); if (autoGetDb->getDb()) { diff --git a/src/mongo/db/matcher/expression.h b/src/mongo/db/matcher/expression.h index 288611e2b22..c3b11d74258 100644 --- a/src/mongo/db/matcher/expression.h +++ b/src/mongo/db/matcher/expression.h @@ -30,7 +30,6 @@ #pragma once -#include #include "mongo/base/disallow_copying.h" #include "mongo/base/status.h" @@ -203,7 +202,7 @@ namespace mongo { private: MatchType _matchType; - boost::scoped_ptr _tagData; + std::unique_ptr _tagData; }; /** diff --git a/src/mongo/db/matcher/expression_array.h b/src/mongo/db/matcher/expression_array.h index 9b6f05ab273..4bc14230eb9 100644 --- a/src/mongo/db/matcher/expression_array.h +++ b/src/mongo/db/matcher/expression_array.h @@ -90,7 +90,7 @@ namespace mongo { virtual MatchExpression* getChild( size_t i ) const { return _sub.get(); } private: - boost::scoped_ptr _sub; + std::unique_ptr _sub; }; class ElemMatchValueMatchExpression : public ArrayMatchingMatchExpression { diff --git a/src/mongo/db/matcher/expression_geo.cpp b/src/mongo/db/matcher/expression_geo.cpp index e8f0fac31d5..d61dba70343 100644 --- a/src/mongo/db/matcher/expression_geo.cpp +++ b/src/mongo/db/matcher/expression_geo.cpp @@ -45,7 +45,7 @@ namespace mongo { // GeoExpression // - // Put simple constructors here for scoped_ptr. + // Put simple constructors here for unique_ptr. GeoExpression::GeoExpression() : field(""), predicate(INVALID) {} GeoExpression::GeoExpression(const std::string& f) : field(f), predicate(INVALID) {} diff --git a/src/mongo/db/matcher/expression_geo.h b/src/mongo/db/matcher/expression_geo.h index d8d2a0a105a..59cc2a87ac5 100644 --- a/src/mongo/db/matcher/expression_geo.h +++ b/src/mongo/db/matcher/expression_geo.h @@ -71,7 +71,7 @@ namespace mongo { // Name of the field in the query. std::string field; - boost::scoped_ptr geoContainer; + std::unique_ptr geoContainer; Predicate predicate; }; @@ -120,7 +120,7 @@ namespace mongo { std::string field; // The starting point of the near search. Use forward declaration of geometries. - boost::scoped_ptr centroid; + std::unique_ptr centroid; // Min and max distance from centroid that we're willing to search. // Distance is in units of the geometry's CRS, except SPHERE and isNearSphere => radians diff --git a/src/mongo/db/matcher/expression_leaf.h b/src/mongo/db/matcher/expression_leaf.h index 38648f1b127..44f889d707b 100644 --- a/src/mongo/db/matcher/expression_leaf.h +++ b/src/mongo/db/matcher/expression_leaf.h @@ -30,7 +30,6 @@ #pragma once -#include #include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonmisc.h" @@ -221,7 +220,7 @@ namespace mongo { private: std::string _regex; std::string _flags; - boost::scoped_ptr _re; + std::unique_ptr _re; }; class ModMatchExpression : public LeafMatchExpression { diff --git a/src/mongo/db/matcher/expression_parser_array_test.cpp b/src/mongo/db/matcher/expression_parser_array_test.cpp index e58bb4683d5..26179f9b0c8 100644 --- a/src/mongo/db/matcher/expression_parser_array_test.cpp +++ b/src/mongo/db/matcher/expression_parser_array_test.cpp @@ -518,7 +518,7 @@ namespace mongo { StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr expr( result.getValue() ); + std::unique_ptr expr( result.getValue() ); // Root node should be an AND with one child. ASSERT_EQUALS( MatchExpression::AND, expr->matchType() ); diff --git a/src/mongo/db/matcher/expression_parser_geo_test.cpp b/src/mongo/db/matcher/expression_parser_geo_test.cpp index a7636390403..503958ddbab 100644 --- a/src/mongo/db/matcher/expression_parser_geo_test.cpp +++ b/src/mongo/db/matcher/expression_parser_geo_test.cpp @@ -44,7 +44,7 @@ namespace mongo { StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT(!result.getValue()->matchesBSON(fromjson("{a: [3,4]}"))); ASSERT(result.getValue()->matchesBSON(fromjson("{a: [4,4]}"))); @@ -60,7 +60,7 @@ namespace mongo { StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); MatchExpression* exp = result.getValue(); ASSERT_EQUALS(MatchExpression::GEO_NEAR, exp->matchType()); diff --git a/src/mongo/db/matcher/expression_parser_leaf_test.cpp b/src/mongo/db/matcher/expression_parser_leaf_test.cpp index f0ef78ae40c..10655322580 100644 --- a/src/mongo/db/matcher/expression_parser_leaf_test.cpp +++ b/src/mongo/db/matcher/expression_parser_leaf_test.cpp @@ -49,7 +49,7 @@ namespace mongo { BSONObj query = BSON( "x" << BSON( "$eq" << 2 ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( !result.getValue()->matchesBSON( BSON( "x" << 1 ) ) ); ASSERT( result.getValue()->matchesBSON( BSON( "x" << 2 ) ) ); @@ -66,7 +66,7 @@ namespace mongo { BSONObj query = BSON( "x" << BSON( "$gt" << 2 ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( !result.getValue()->matchesBSON( BSON( "x" << 2 ) ) ); ASSERT( result.getValue()->matchesBSON( BSON( "x" << 3 ) ) ); @@ -76,7 +76,7 @@ namespace mongo { BSONObj query = BSON( "x" << BSON( "$lt" << 2 ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( result.getValue()->matchesBSON( BSON( "x" << 1 ) ) ); ASSERT( !result.getValue()->matchesBSON( BSON( "x" << 2 ) ) ); @@ -87,7 +87,7 @@ namespace mongo { BSONObj query = BSON( "x" << BSON( "$gte" << 2 ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( !result.getValue()->matchesBSON( BSON( "x" << 1 ) ) ); ASSERT( result.getValue()->matchesBSON( BSON( "x" << 2 ) ) ); @@ -98,7 +98,7 @@ namespace mongo { BSONObj query = BSON( "x" << BSON( "$lte" << 2 ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( result.getValue()->matchesBSON( BSON( "x" << 1 ) ) ); ASSERT( result.getValue()->matchesBSON( BSON( "x" << 2 ) ) ); @@ -109,7 +109,7 @@ namespace mongo { BSONObj query = BSON( "x" << BSON( "$ne" << 2 ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( result.getValue()->matchesBSON( BSON( "x" << 1 ) ) ); ASSERT( !result.getValue()->matchesBSON( BSON( "x" << 2 ) ) ); @@ -120,7 +120,7 @@ namespace mongo { BSONObj query = BSON( "x" << BSON( "$mod" << BSON_ARRAY( 3 << 2 ) ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy1(result.getValue()); + std::unique_ptr destroy1(result.getValue()); query = BSON( "x" << BSON( "$mod" << BSON_ARRAY( 3 ) ) ); result = MatchExpressionParser::parse( query ); @@ -147,7 +147,7 @@ namespace mongo { BSONObj query = BSON( "x" << BSON( "$mod" << BSON_ARRAY( 3 << 2 ) ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( result.getValue()->matchesBSON( BSON( "x" << 5 ) ) ); ASSERT( !result.getValue()->matchesBSON( BSON( "x" << 4 ) ) ); @@ -158,7 +158,7 @@ namespace mongo { BSONObj query = BSON( "x" << BSON( "$mod" << BSON_ARRAY( 2 << "r" ) ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( result.getValue()->matchesBSON( BSON( "x" << 2 ) ) ); ASSERT( result.getValue()->matchesBSON( BSON( "x" << 4 ) ) ); @@ -171,7 +171,7 @@ namespace mongo { BSONObj query = BSON( "x" << BSON( "$in" << BSON_ARRAY( 2 << 3 ) ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( !result.getValue()->matchesBSON( BSON( "x" << 1 ) ) ); ASSERT( result.getValue()->matchesBSON( BSON( "x" << 2 ) ) ); @@ -185,7 +185,7 @@ namespace mongo { BSON( "$ref" << "coll" << "$id" << oid << "$db" << "db" ) ) ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); OID oidx = OID::gen(); ASSERT( !result.getValue()->matchesBSON( @@ -222,7 +222,7 @@ namespace mongo { BSON( "$ref" << "coll" << "$id" << oid << "$db" << "db" ) ) ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); OID oidx = OID::gen(); ASSERT( !result.getValue()->matchesBSON( @@ -285,7 +285,7 @@ namespace mongo { BSON( "$ref" << "coll" << "$id" << oid << "foo" << 12345 ) ) ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); OID oidx = OID::gen(); ASSERT( !result.getValue()->matchesBSON( @@ -384,7 +384,7 @@ namespace mongo { BSONObj query = BSON( "a" << operand.obj() ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); BSONObj matchFirst = BSON( "a" << "ax" ); BSONObj matchFirstRegex = BSONObjBuilder().appendRegex( "a", "^a", "" ).obj(); @@ -407,7 +407,7 @@ namespace mongo { BSONObj query = BSON( "x" << BSON( "$nin" << BSON_ARRAY( 2 << 3 ) ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( result.getValue()->matchesBSON( BSON( "x" << 1 ) ) ); ASSERT( !result.getValue()->matchesBSON( BSON( "x" << 2 ) ) ); @@ -427,7 +427,7 @@ namespace mongo { BSONObj query = b.obj(); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( result.getValue()->matchesBSON( BSON( "x" << "abc" ) ) ); ASSERT( result.getValue()->matchesBSON( BSON( "x" << "ABC" ) ) ); @@ -438,7 +438,7 @@ namespace mongo { BSONObj query = BSON( "x" << BSON( "$regex" << "abc" << "$options" << "i" ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( result.getValue()->matchesBSON( BSON( "x" << "abc" ) ) ); ASSERT( result.getValue()->matchesBSON( BSON( "x" << "ABC" ) ) ); @@ -450,7 +450,7 @@ namespace mongo { StatusWithMatchExpression result = MatchExpressionParser::parse( query ); log() << "result: " << result.getStatus() << endl; ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( result.getValue()->matchesBSON( BSON( "x" << "abc" ) ) ); ASSERT( result.getValue()->matchesBSON( BSON( "x" << "ABC" ) ) ); @@ -487,7 +487,7 @@ namespace mongo { BSONObj query = BSON( "x" << b.obj() ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( result.getValue()->matchesBSON( BSON( "x" << "abc" ) ) ); ASSERT( !result.getValue()->matchesBSON( BSON( "y" << "AC" ) ) ); @@ -499,7 +499,7 @@ namespace mongo { BSONObj query = BSON( "x" << b.obj() ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( !result.getValue()->matchesBSON( BSON( "x" << "abc" ) ) ); ASSERT( result.getValue()->matchesBSON( BSON( "y" << "AC" ) ) ); @@ -509,7 +509,7 @@ namespace mongo { BSONObj query = BSON( "x" << BSON( "$type" << String ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( result.getValue()->matchesBSON( BSON( "x" << "abc" ) ) ); ASSERT( !result.getValue()->matchesBSON( BSON( "x" << 5 ) ) ); @@ -519,7 +519,7 @@ namespace mongo { BSONObj query = BSON( "x" << BSON( "$type" << (double)NumberDouble ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( result.getValue()->matchesBSON( BSON( "x" << 5.3 ) ) ); ASSERT( !result.getValue()->matchesBSON( BSON( "x" << 5 ) ) ); @@ -529,7 +529,7 @@ namespace mongo { BSONObj query = BSON( "x" << BSON( "$type" << 1.5 ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( !result.getValue()->matchesBSON( BSON( "x" << 5.3 ) ) ); ASSERT( !result.getValue()->matchesBSON( BSON( "x" << 5 ) ) ); @@ -539,7 +539,7 @@ namespace mongo { BSONObj query = BSON( "x" << BSON( "$type" << jstNULL ) ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( !result.getValue()->matchesBSON( BSONObj() ) ); ASSERT( !result.getValue()->matchesBSON( BSON( "x" << 5 ) ) ); @@ -554,7 +554,7 @@ namespace mongo { BSONObj query = BSON( "x" << b.obj() ); StatusWithMatchExpression result = MatchExpressionParser::parse( query ); ASSERT_TRUE( result.isOK() ); - boost::scoped_ptr destroy(result.getValue()); + std::unique_ptr destroy(result.getValue()); ASSERT( !result.getValue()->matchesBSON( BSON( "x" << 5.3 ) ) ); ASSERT( !result.getValue()->matchesBSON( BSON( "x" << 5 ) ) ); diff --git a/src/mongo/db/matcher/expression_parser_text_test.cpp b/src/mongo/db/matcher/expression_parser_text_test.cpp index 42eb9ce2464..2933c825b08 100644 --- a/src/mongo/db/matcher/expression_parser_text_test.cpp +++ b/src/mongo/db/matcher/expression_parser_text_test.cpp @@ -46,7 +46,7 @@ namespace mongo { ASSERT_TRUE( result.isOK() ); ASSERT_EQUALS( MatchExpression::TEXT, result.getValue()->matchType() ); - boost::scoped_ptr textExp( + std::unique_ptr textExp( static_cast( result.getValue() ) ); ASSERT_EQUALS( textExp->getQuery(), "awesome" ); ASSERT_EQUALS( textExp->getLanguage(), "english" ); @@ -67,7 +67,7 @@ namespace mongo { ASSERT_TRUE( result.isOK() ); ASSERT_EQUALS( MatchExpression::TEXT, result.getValue()->matchType() ); - boost::scoped_ptr textExp( + std::unique_ptr textExp( static_cast( result.getValue() ) ); ASSERT_EQUALS( textExp->getCaseSensitive(), true ); } @@ -79,7 +79,7 @@ namespace mongo { ASSERT_TRUE( result.isOK() ); ASSERT_EQUALS( MatchExpression::TEXT, result.getValue()->matchType() ); - boost::scoped_ptr textExp( + std::unique_ptr textExp( static_cast( result.getValue() ) ); ASSERT_EQUALS( textExp->getCaseSensitive(), false ); } diff --git a/src/mongo/db/matcher/expression_tree.h b/src/mongo/db/matcher/expression_tree.h index b6441e70f57..6e35af8df72 100644 --- a/src/mongo/db/matcher/expression_tree.h +++ b/src/mongo/db/matcher/expression_tree.h @@ -32,7 +32,6 @@ #include "mongo/db/matcher/expression.h" -#include /** * this contains all Expessions that define the structure of the tree diff --git a/src/mongo/db/matcher/match_details.h b/src/mongo/db/matcher/match_details.h index 2209c4ac1ff..8d5f016747f 100644 --- a/src/mongo/db/matcher/match_details.h +++ b/src/mongo/db/matcher/match_details.h @@ -30,8 +30,7 @@ #pragma once -#include - +#include #include namespace mongo { @@ -69,6 +68,6 @@ namespace mongo { private: bool _loadedRecord; bool _elemMatchKeyRequested; - boost::scoped_ptr _elemMatchKey; + std::unique_ptr _elemMatchKey; }; } diff --git a/src/mongo/db/matcher/matcher.h b/src/mongo/db/matcher/matcher.h index 278f6668789..629f08facd5 100644 --- a/src/mongo/db/matcher/matcher.h +++ b/src/mongo/db/matcher/matcher.h @@ -30,7 +30,6 @@ #pragma once -#include #include "mongo/base/disallow_copying.h" #include "mongo/base/status.h" @@ -62,7 +61,7 @@ namespace mongo { private: BSONObj _pattern; - boost::scoped_ptr _expression; + std::unique_ptr _expression; }; } // namespace mongo diff --git a/src/mongo/db/matcher/path.h b/src/mongo/db/matcher/path.h index 4aae82af3ef..11fec9ff673 100644 --- a/src/mongo/db/matcher/path.h +++ b/src/mongo/db/matcher/path.h @@ -30,7 +30,6 @@ #pragma once -#include #include "mongo/base/status.h" #include "mongo/base/string_data.h" @@ -158,13 +157,13 @@ namespace mongo { BSONElement _theArray; BSONElement _current; - boost::scoped_ptr _iterator; + std::unique_ptr _iterator; }; ArrayIterationState _arrayIterationState; - boost::scoped_ptr _subCursor; - boost::scoped_ptr _subCursorPath; + std::unique_ptr _subCursor; + std::unique_ptr _subCursorPath; }; } diff --git a/src/mongo/db/operation_context_impl.h b/src/mongo/db/operation_context_impl.h index 163bff53295..36b6688bfab 100644 --- a/src/mongo/db/operation_context_impl.h +++ b/src/mongo/db/operation_context_impl.h @@ -27,7 +27,6 @@ */ #pragma once -#include #include #include "mongo/db/operation_context.h" diff --git a/src/mongo/db/operation_context_noop.h b/src/mongo/db/operation_context_noop.h index 055c83d690c..5466806b276 100644 --- a/src/mongo/db/operation_context_noop.h +++ b/src/mongo/db/operation_context_noop.h @@ -27,7 +27,6 @@ */ #pragma once -#include #include "mongo/db/operation_context.h" #include "mongo/db/client.h" @@ -113,7 +112,7 @@ namespace mongo { private: std::unique_ptr _recoveryUnit; - boost::scoped_ptr _locker; + std::unique_ptr _locker; ProgressMeter _pm; }; diff --git a/src/mongo/db/ops/delete.cpp b/src/mongo/db/ops/delete.cpp index f7782d14edf..ecf4f752873 100644 --- a/src/mongo/db/ops/delete.cpp +++ b/src/mongo/db/ops/delete.cpp @@ -69,7 +69,7 @@ namespace mongo { PlanExecutor* rawExec; uassertStatusOK(getExecutorDelete(txn, collection, &parsedDelete, &rawExec)); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); uassertStatusOK(exec->executePlan()); return DeleteStage::getNumDeleted(exec.get()); diff --git a/src/mongo/db/ops/modifier_add_to_set.h b/src/mongo/db/ops/modifier_add_to_set.h index 296009385b9..bbbc37ece1e 100644 --- a/src/mongo/db/ops/modifier_add_to_set.h +++ b/src/mongo/db/ops/modifier_add_to_set.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/base/disallow_copying.h" #include "mongo/bson/mutable/document.h" @@ -80,7 +79,7 @@ namespace mongo { mutablebson::Element _val; struct PreparedState; - boost::scoped_ptr _preparedState; + std::unique_ptr _preparedState; }; } // namespace mongo diff --git a/src/mongo/db/ops/modifier_bit.h b/src/mongo/db/ops/modifier_bit.h index 1f5a9437f1e..812ac8f41e1 100644 --- a/src/mongo/db/ops/modifier_bit.h +++ b/src/mongo/db/ops/modifier_bit.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include @@ -94,7 +93,7 @@ namespace mongo { OpEntries _ops; struct PreparedState; - boost::scoped_ptr _preparedState; + std::unique_ptr _preparedState; }; } // namespace mongo diff --git a/src/mongo/db/ops/modifier_compare.h b/src/mongo/db/ops/modifier_compare.h index 4d1afbcacf7..8285f3e10ad 100644 --- a/src/mongo/db/ops/modifier_compare.h +++ b/src/mongo/db/ops/modifier_compare.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" @@ -105,7 +104,7 @@ namespace mongo { // prepare() was issued and until a log() is issued. The document this mod is // being prepared against must be live throughout all the calls. struct PreparedState; - boost::scoped_ptr _preparedState; + std::unique_ptr _preparedState; }; } // namespace mongo diff --git a/src/mongo/db/ops/modifier_current_date.h b/src/mongo/db/ops/modifier_current_date.h index 09e56c9c8ac..291c05b377a 100644 --- a/src/mongo/db/ops/modifier_current_date.h +++ b/src/mongo/db/ops/modifier_current_date.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" @@ -84,7 +83,7 @@ namespace mongo { // State which changes with each call of the mod. struct PreparedState; - boost::scoped_ptr _preparedState; + std::unique_ptr _preparedState; }; } // namespace mongo diff --git a/src/mongo/db/ops/modifier_inc.h b/src/mongo/db/ops/modifier_inc.h index 62c81cafbee..cfb7bbdf25d 100644 --- a/src/mongo/db/ops/modifier_inc.h +++ b/src/mongo/db/ops/modifier_inc.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" @@ -95,7 +94,7 @@ namespace mongo { SafeNum _val; struct PreparedState; - boost::scoped_ptr _preparedState; + std::unique_ptr _preparedState; }; } // namespace mongo diff --git a/src/mongo/db/ops/modifier_object_replace.h b/src/mongo/db/ops/modifier_object_replace.h index 393036d610b..4e923e4a7fd 100644 --- a/src/mongo/db/ops/modifier_object_replace.h +++ b/src/mongo/db/ops/modifier_object_replace.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/base/disallow_copying.h" #include "mongo/base/status.h" @@ -93,7 +92,7 @@ namespace mongo { // was issued and until a log() is issued. The document this mod is being prepared // against must e live throughout all the calls. struct PreparedState; - boost::scoped_ptr _preparedState; + std::unique_ptr _preparedState; }; } // namespace mongo diff --git a/src/mongo/db/ops/modifier_pop.h b/src/mongo/db/ops/modifier_pop.h index c495c4c07fa..41501275619 100644 --- a/src/mongo/db/ops/modifier_pop.h +++ b/src/mongo/db/ops/modifier_pop.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" @@ -83,7 +82,7 @@ namespace mongo { // The instance of the field in the provided doc. // This data is valid after prepare, for use by log and apply struct PreparedState; - boost::scoped_ptr _preparedState; + std::unique_ptr _preparedState; }; } // namespace mongo diff --git a/src/mongo/db/ops/modifier_pull.h b/src/mongo/db/ops/modifier_pull.h index 25a7f784f2a..4660fd28b62 100644 --- a/src/mongo/db/ops/modifier_pull.h +++ b/src/mongo/db/ops/modifier_pull.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/base/disallow_copying.h" #include "mongo/bson/mutable/document.h" @@ -78,11 +77,11 @@ namespace mongo { BSONObj _exprObj; // If we are using the matcher, this is the match expression we built around _exprObj. - boost::scoped_ptr _matchExpr; + std::unique_ptr _matchExpr; bool _matcherOnPrimitive; struct PreparedState; - boost::scoped_ptr _preparedState; + std::unique_ptr _preparedState; }; } // namespace mongo diff --git a/src/mongo/db/ops/modifier_pull_all.h b/src/mongo/db/ops/modifier_pull_all.h index bdc96b18b74..fef6c7b03f3 100644 --- a/src/mongo/db/ops/modifier_pull_all.h +++ b/src/mongo/db/ops/modifier_pull_all.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" @@ -78,7 +77,7 @@ namespace mongo { // The instance of the field in the provided doc. // This data is valid after prepare, for use by log and apply struct PreparedState; - boost::scoped_ptr _preparedState; + std::unique_ptr _preparedState; // User specified elements to remove std::vector _elementsToFind; diff --git a/src/mongo/db/ops/modifier_push.h b/src/mongo/db/ops/modifier_push.h index bc2929555f5..708c6431d97 100644 --- a/src/mongo/db/ops/modifier_push.h +++ b/src/mongo/db/ops/modifier_push.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" @@ -129,7 +128,7 @@ namespace mongo { // prepare() was issued and until a log() is issued. The document this mod is // being prepared against must be live throughout all the calls. struct PreparedState; - boost::scoped_ptr _preparedState; + std::unique_ptr _preparedState; }; diff --git a/src/mongo/db/ops/modifier_rename.h b/src/mongo/db/ops/modifier_rename.h index a0407ab9d31..a43523f5320 100644 --- a/src/mongo/db/ops/modifier_rename.h +++ b/src/mongo/db/ops/modifier_rename.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" @@ -93,7 +92,7 @@ namespace mongo { // The state carried over from prepare for apply/log struct PreparedState; - boost::scoped_ptr _preparedState; + std::unique_ptr _preparedState; }; } // namespace mongo diff --git a/src/mongo/db/ops/modifier_set.h b/src/mongo/db/ops/modifier_set.h index eeae479a162..cc961163234 100644 --- a/src/mongo/db/ops/modifier_set.h +++ b/src/mongo/db/ops/modifier_set.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" @@ -108,7 +107,7 @@ namespace mongo { // prepare() was issued and until a log() is issued. The document this mod is // being prepared against must be live throughout all the calls. struct PreparedState; - boost::scoped_ptr _preparedState; + std::unique_ptr _preparedState; }; diff --git a/src/mongo/db/ops/modifier_unset.h b/src/mongo/db/ops/modifier_unset.h index aff10a80e07..53417a3c37e 100644 --- a/src/mongo/db/ops/modifier_unset.h +++ b/src/mongo/db/ops/modifier_unset.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" @@ -97,7 +96,7 @@ namespace mongo { // prepare() was issued and until a log() is issued. The document this mod is // being prepared against must be live throughout all the calls. struct PreparedState; - boost::scoped_ptr _preparedState; + std::unique_ptr _preparedState; }; diff --git a/src/mongo/db/ops/update.cpp b/src/mongo/db/ops/update.cpp index b4d8de45094..cf60978b4b8 100644 --- a/src/mongo/db/ops/update.cpp +++ b/src/mongo/db/ops/update.cpp @@ -101,7 +101,7 @@ namespace mongo { PlanExecutor* rawExec; uassertStatusOK(getExecutorUpdate(txn, collection, &parsedUpdate, opDebug, &rawExec)); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); uassertStatusOK(exec->executePlan()); return UpdateStage::makeUpdateResult(exec.get(), opDebug); diff --git a/src/mongo/db/ops/update_driver.cpp b/src/mongo/db/ops/update_driver.cpp index b5737419dad..0cb17de5de6 100644 --- a/src/mongo/db/ops/update_driver.cpp +++ b/src/mongo/db/ops/update_driver.cpp @@ -28,7 +28,6 @@ #include "mongo/db/ops/update_driver.h" -#include #include "mongo/base/error_codes.h" #include "mongo/base/string_data.h" @@ -48,7 +47,7 @@ namespace mongo { namespace str = mongoutils::str; namespace mb = mongo::mutablebson; - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::vector; @@ -181,7 +180,7 @@ namespace mongo { Status s = CanonicalQuery::canonicalize("", query, &rawCG, WhereCallbackNoop()); if (!s.isOK()) return s; - scoped_ptr cq(rawCG); + unique_ptr cq(rawCG); return populateDocumentWithQueryFields(rawCG, immutablePaths, doc); } @@ -232,8 +231,8 @@ namespace mongo { FieldRefSet* targetFields = updatedFields; // If we didn't get a FieldRefSet* from the caller, allocate storage and use - // the scoped_ptr for lifecycle management - scoped_ptr targetFieldScopedPtr; + // the unique_ptr for lifecycle management + unique_ptr targetFieldScopedPtr; if (!targetFields) { targetFieldScopedPtr.reset(new FieldRefSet()); targetFields = targetFieldScopedPtr.get(); diff --git a/src/mongo/db/ops/update_driver_test.cpp b/src/mongo/db/ops/update_driver_test.cpp index 22140b5389e..1fd93aa27c1 100644 --- a/src/mongo/db/ops/update_driver_test.cpp +++ b/src/mongo/db/ops/update_driver_test.cpp @@ -28,7 +28,6 @@ #include "mongo/db/ops/update_driver.h" -#include #include @@ -156,8 +155,8 @@ namespace { } private: - boost::scoped_ptr _driverOps; - boost::scoped_ptr _driverRepl; + std::unique_ptr _driverOps; + std::unique_ptr _driverRepl; Document _doc; }; diff --git a/src/mongo/db/pipeline/document_source.h b/src/mongo/db/pipeline/document_source.h index fd88833611d..befbfad2198 100644 --- a/src/mongo/db/pipeline/document_source.h +++ b/src/mongo/db/pipeline/document_source.h @@ -32,7 +32,6 @@ #include #include -#include #include #include #include @@ -550,7 +549,7 @@ namespace mongo { bool _spilled; const bool _extSortAllowed; const int _maxMemoryUsageBytes; - boost::scoped_ptr _variables; + std::unique_ptr _variables; std::vector _idFieldNames; // used when id is a document std::vector > _idExpressions; @@ -558,7 +557,7 @@ namespace mongo { GroupsMap::iterator groupsIterator; // only used when _spilled - boost::scoped_ptr::Iterator> _sorterIterator; + std::unique_ptr::Iterator> _sorterIterator; std::pair _firstPartOfNextGroup; Value _currentId; Accumulators _currentAccumulators; @@ -609,7 +608,7 @@ namespace mongo { DocumentSourceMatch(const BSONObj &query, const boost::intrusive_ptr &pExpCtx); - boost::scoped_ptr matcher; + std::unique_ptr matcher; bool _isTextQuery; }; @@ -759,7 +758,7 @@ namespace mongo { const boost::intrusive_ptr& exprObj); // configuration state - boost::scoped_ptr _variables; + std::unique_ptr _variables; boost::intrusive_ptr pEO; BSONObj _raw; }; @@ -788,7 +787,7 @@ namespace mongo { Value redactValue(const Value& in); Variables::Id _currentId; - boost::scoped_ptr _variables; + std::unique_ptr _variables; boost::intrusive_ptr _expression; }; @@ -904,7 +903,7 @@ namespace mongo { bool _done; bool _mergingPresorted; - boost::scoped_ptr _output; + std::unique_ptr _output; }; class DocumentSourceLimit : public DocumentSource @@ -1052,11 +1051,11 @@ namespace mongo { void unwindPath(const FieldPath &fieldPath); // Configuration state. - boost::scoped_ptr _unwindPath; + std::unique_ptr _unwindPath; // Iteration state. class Unwinder; - boost::scoped_ptr _unwinder; + std::unique_ptr _unwinder; }; class DocumentSourceGeoNear : public DocumentSource @@ -1098,16 +1097,16 @@ namespace mongo { // coords and distanceField are required, rest are optional BSONObj coords; // "near" option, but near is a reserved keyword on windows bool coordsIsArray; - boost::scoped_ptr distanceField; // Using scoped_ptr because FieldPath can't be empty + std::unique_ptr distanceField; // Using unique_ptr because FieldPath can't be empty long long limit; double maxDistance; BSONObj query; bool spherical; double distanceMultiplier; - boost::scoped_ptr includeLocs; + std::unique_ptr includeLocs; // these fields are used while processing the results BSONObj cmdOutput; - boost::scoped_ptr resultsIterator; // iterator over cmdOutput["results"] + std::unique_ptr resultsIterator; // iterator over cmdOutput["results"] }; } diff --git a/src/mongo/db/pipeline/document_source_sort.cpp b/src/mongo/db/pipeline/document_source_sort.cpp index 95abf93400b..77fa0180332 100644 --- a/src/mongo/db/pipeline/document_source_sort.cpp +++ b/src/mongo/db/pipeline/document_source_sort.cpp @@ -31,7 +31,6 @@ #include "mongo/db/pipeline/document_source.h" #include -#include #include "mongo/db/jsobj.h" #include "mongo/db/pipeline/document.h" @@ -42,7 +41,7 @@ namespace mongo { using boost::intrusive_ptr; - using boost::scoped_ptr; + using std::unique_ptr; using std::make_pair; using std::string; using std::vector; @@ -239,7 +238,7 @@ namespace mongo { msgasserted(17196, "can only mergePresorted from MergeCursors and CommandShards"); } } else { - scoped_ptr sorter (MySorter::make(makeSortOptions(), Comparator(*this))); + unique_ptr sorter (MySorter::make(makeSortOptions(), Comparator(*this))); while (boost::optional next = pSource->getNext()) { sorter->add(extractKey(*next), *next); } diff --git a/src/mongo/db/query/canonical_query.h b/src/mongo/db/query/canonical_query.h index b14fb29c233..365a06e4802 100644 --- a/src/mongo/db/query/canonical_query.h +++ b/src/mongo/db/query/canonical_query.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/base/status.h" #include "mongo/db/dbmessage.h" @@ -215,12 +214,12 @@ namespace mongo { const MatchExpressionParser::WhereCallback& whereCallback, MatchExpression* root); - boost::scoped_ptr _pq; + std::unique_ptr _pq; // _root points into _pq->getFilter() - boost::scoped_ptr _root; + std::unique_ptr _root; - boost::scoped_ptr _proj; + std::unique_ptr _proj; }; } // namespace mongo diff --git a/src/mongo/db/query/explain.cpp b/src/mongo/db/query/explain.cpp index e67bb343dfb..1f37907c877 100644 --- a/src/mongo/db/query/explain.cpp +++ b/src/mongo/db/query/explain.cpp @@ -30,7 +30,6 @@ #include "mongo/db/query/explain.h" -#include #include "mongo/base/owned_pointer_vector.h" #include "mongo/db/exec/multi_plan.h" @@ -48,7 +47,7 @@ namespace { using namespace mongo; - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::string; using std::vector; @@ -501,7 +500,7 @@ namespace mongo { AllowedIndices* allowedIndicesRaw; if (querySettings->getAllowedIndices(planCacheKey, &allowedIndicesRaw)) { // Found an index filter set on the query shape. - boost::scoped_ptr allowedIndices(allowedIndicesRaw); + std::unique_ptr allowedIndices(allowedIndicesRaw); indexFilterSet = true; } } @@ -612,7 +611,7 @@ namespace mongo { // // Get stats for the winning plan. - scoped_ptr winningStats(exec->getStats()); + unique_ptr winningStats(exec->getStats()); // Get stats for the rejected plans, if more than one plan was considered. OwnedPointerVector allPlansStats; diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp index a722ceb05b8..dbf656723ba 100644 --- a/src/mongo/db/query/find.cpp +++ b/src/mongo/db/query/find.cpp @@ -32,7 +32,6 @@ #include "mongo/db/query/find.h" -#include #include "mongo/client/dbclientinterface.h" #include "mongo/db/catalog/collection.h" @@ -62,7 +61,7 @@ #include "mongo/util/log.h" #include "mongo/util/mongoutils/str.h" -using boost::scoped_ptr; +using std::unique_ptr; using std::unique_ptr; using std::endl; @@ -230,7 +229,7 @@ namespace mongo { // Set debug information for consumption by the profiler only. if (dbProfilingLevel > 0) { // Get BSON stats. - scoped_ptr execStats(exec->getStats()); + unique_ptr execStats(exec->getStats()); BSONObjBuilder statsBob; Explain::statsToBSON(*execStats, &statsBob); curop->debug().execStats.set(statsBob.obj()); @@ -286,9 +285,9 @@ namespace mongo { // Note that we declare our locks before our ClientCursorPin, in order to ensure that the // pin's destructor is called before the lock destructors (so that the unpin occurs under // the lock). - boost::scoped_ptr ctx; - boost::scoped_ptr unpinDBLock; - boost::scoped_ptr unpinCollLock; + std::unique_ptr ctx; + std::unique_ptr unpinDBLock; + std::unique_ptr unpinCollLock; CursorManager* cursorManager; CursorManager* globalCursorManager = CursorManager::getGlobalCursorManager(); diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp index 74d0d42051a..2b7f0980b4b 100644 --- a/src/mongo/db/query/get_executor.cpp +++ b/src/mongo/db/query/get_executor.cpp @@ -166,7 +166,7 @@ namespace mongo { // Filter index catalog if index filters are specified for query. // Also, signal to planner that application hint should be ignored. if (querySettings->getAllowedIndices(planCacheKey, &allowedIndicesRaw)) { - boost::scoped_ptr allowedIndices(allowedIndicesRaw); + std::unique_ptr allowedIndices(allowedIndicesRaw); filterAllowedIndexEntries(*allowedIndices, &plannerParams->indices); plannerParams->indexFiltersApplied = true; } @@ -319,7 +319,7 @@ namespace mongo { if (PlanCache::shouldCacheQuery(*canonicalQuery) && collection->infoCache()->getPlanCache()->get(*canonicalQuery, &rawCS).isOK()) { // We have a CachedSolution. Have the planner turn it into a QuerySolution. - boost::scoped_ptr cs(rawCS); + std::unique_ptr cs(rawCS); QuerySolution *qs; Status status = QueryPlanner::planFromCache(*canonicalQuery, plannerParams, *cs, &qs); diff --git a/src/mongo/db/query/lite_parsed_query_test.cpp b/src/mongo/db/query/lite_parsed_query_test.cpp index b2f0bc1ad9c..820ce989a8e 100644 --- a/src/mongo/db/query/lite_parsed_query_test.cpp +++ b/src/mongo/db/query/lite_parsed_query_test.cpp @@ -34,13 +34,12 @@ #include #include -#include #include "mongo/db/json.h" #include "mongo/unittest/unittest.h" using namespace mongo; -using boost::scoped_ptr; +using std::unique_ptr; namespace { @@ -149,7 +148,7 @@ namespace { false, // explain &lpqRaw); if (result.isOK()) { - boost::scoped_ptr lpq(lpqRaw); + std::unique_ptr lpq(lpqRaw); } return result; @@ -278,7 +277,7 @@ namespace { bool isExplain = false; Status status = LiteParsedQuery::make("testns", cmdObj, isExplain, &rawLpq); ASSERT_OK(status); - scoped_ptr lpq(rawLpq); + unique_ptr lpq(rawLpq); } TEST(LiteParsedQueryTest, ParseFromCommandWithOptions) { @@ -293,7 +292,7 @@ namespace { bool isExplain = false; Status status = LiteParsedQuery::make("testns", cmdObj, isExplain, &rawLpq); ASSERT_OK(status); - scoped_ptr lpq(rawLpq); + unique_ptr lpq(rawLpq); // Make sure the values from the command BSON are reflected in the LPQ. ASSERT(lpq->showRecordId()); @@ -309,7 +308,7 @@ namespace { bool isExplain = false; Status status = LiteParsedQuery::make("testns", cmdObj, isExplain, &rawLpq); ASSERT_OK(status); - scoped_ptr lpq(rawLpq); + unique_ptr lpq(rawLpq); BSONObj hintObj = lpq->getHint(); ASSERT_EQUALS(BSON("$hint" << "foo_1"), hintObj); @@ -323,7 +322,7 @@ namespace { bool isExplain = false; Status status = LiteParsedQuery::make("testns", cmdObj, isExplain, &rawLpq); ASSERT_OK(status); - scoped_ptr lpq(rawLpq); + unique_ptr lpq(rawLpq); } TEST(LiteParsedQueryTest, ParseFromCommandValidSortProjMeta) { @@ -334,7 +333,7 @@ namespace { bool isExplain = false; Status status = LiteParsedQuery::make("testns", cmdObj, isExplain, &rawLpq); ASSERT_OK(status); - scoped_ptr lpq(rawLpq); + unique_ptr lpq(rawLpq); } TEST(LiteParsedQueryTest, ParseFromCommandAllFlagsTrue) { @@ -350,7 +349,7 @@ namespace { bool isExplain = false; Status status = LiteParsedQuery::make("testns", cmdObj, isExplain, &rawLpq); ASSERT_OK(status); - scoped_ptr lpq(rawLpq); + unique_ptr lpq(rawLpq); // Test that all the flags got set to true. ASSERT(lpq->isTailable()); @@ -371,7 +370,7 @@ namespace { bool isExplain = false; Status status = LiteParsedQuery::make("testns", cmdObj, isExplain, &rawLpq); ASSERT_OK(status); - scoped_ptr lpq(rawLpq); + unique_ptr lpq(rawLpq); ASSERT_EQUALS("the comment", lpq->getComment()); BSONObj expectedMin = BSON("a" << 1); @@ -395,7 +394,7 @@ namespace { bool isExplain = false; Status status = LiteParsedQuery::make("testns", cmdObj, isExplain, &rawLpq); ASSERT_OK(status); - scoped_ptr lpq(rawLpq); + unique_ptr lpq(rawLpq); // Check the values inside the LPQ. BSONObj expectedQuery = BSON("a" << 1); @@ -696,7 +695,7 @@ namespace { const bool isExplain = false; Status status = LiteParsedQuery::make("testns", cmdObj, isExplain, &rawLpq); ASSERT_OK(status); - boost::scoped_ptr lpq(rawLpq); + std::unique_ptr lpq(rawLpq); ASSERT(lpq->getBatchSize()); ASSERT_EQ(0, lpq->getBatchSize()); @@ -711,7 +710,7 @@ namespace { const bool isExplain = false; Status status = LiteParsedQuery::make("testns", cmdObj, isExplain, &rawLpq); ASSERT_OK(status); - boost::scoped_ptr lpq(rawLpq); + std::unique_ptr lpq(rawLpq); ASSERT(!lpq->getBatchSize()); ASSERT(!lpq->getLimit()); @@ -771,7 +770,7 @@ namespace { "sort: {b: 1}}"); status = LiteParsedQuery::make("testns", cmdObj, isExplain, &rawLpq); ASSERT_OK(status); - scoped_ptr lpq(rawLpq); + unique_ptr lpq(rawLpq); } TEST(LiteParsedQueryTest, ParseCommandForbidMetaSortOnFieldWithoutMetaProject) { @@ -810,7 +809,7 @@ namespace { Status status = LiteParsedQuery::make("testns", cmdObj, isExplain, &rawLpq); ASSERT_OK(status); - boost::scoped_ptr lpq(rawLpq); + std::unique_ptr lpq(rawLpq); ASSERT(lpq->fromFindCommand()); } @@ -824,7 +823,7 @@ namespace { &rawLpq); ASSERT_OK(status); - boost::scoped_ptr lpq(rawLpq); + std::unique_ptr lpq(rawLpq); ASSERT(!lpq->fromFindCommand()); } @@ -844,7 +843,7 @@ namespace { Status status = LiteParsedQuery::make("testns", cmdObj, false, &rawLpq); ASSERT_OK(status); - boost::scoped_ptr lpq(rawLpq); + std::unique_ptr lpq(rawLpq); ASSERT_EQUALS(0, lpq->getSkip()); ASSERT_EQUALS(true, lpq->wantMore()); diff --git a/src/mongo/db/query/parsed_projection_test.cpp b/src/mongo/db/query/parsed_projection_test.cpp index 4507da17a1d..c669490f35a 100644 --- a/src/mongo/db/query/parsed_projection_test.cpp +++ b/src/mongo/db/query/parsed_projection_test.cpp @@ -48,7 +48,7 @@ namespace { unique_ptr createParsedProjection(const BSONObj& query, const BSONObj& projObj) { StatusWithMatchExpression swme = MatchExpressionParser::parse(query); ASSERT(swme.isOK()); - boost::scoped_ptr queryMatchExpr(swme.getValue()); + std::unique_ptr queryMatchExpr(swme.getValue()); ParsedProjection* out = NULL; Status status = ParsedProjection::make(projObj, queryMatchExpr.get(), &out); if (!status.isOK()) { @@ -74,10 +74,10 @@ namespace { BSONObj projObj = fromjson(projStr); StatusWithMatchExpression swme = MatchExpressionParser::parse(query); ASSERT(swme.isOK()); - boost::scoped_ptr queryMatchExpr(swme.getValue()); + std::unique_ptr queryMatchExpr(swme.getValue()); ParsedProjection* out = NULL; Status status = ParsedProjection::make(projObj, queryMatchExpr.get(), &out); - boost::scoped_ptr destroy(out); + std::unique_ptr destroy(out); ASSERT(!status.isOK()); } @@ -184,7 +184,7 @@ namespace { BSONObj projObj = fromjson("{'a.$': 1}"); Status status = ParsedProjection::make(projObj, queryMatchExpr.get(), &out); ASSERT(!status.isOK()); - boost::scoped_ptr destroy(out); + std::unique_ptr destroy(out); // Projecting onto empty field should fail. BSONObj emptyFieldProjObj = fromjson("{'.$': 1}"); diff --git a/src/mongo/db/query/plan_cache.h b/src/mongo/db/query/plan_cache.h index ef90363748d..488180537e4 100644 --- a/src/mongo/db/query/plan_cache.h +++ b/src/mongo/db/query/plan_cache.h @@ -30,7 +30,6 @@ #include #include -#include #include #include "mongo/db/exec/plan_stats.h" @@ -56,7 +55,7 @@ namespace mongo { */ struct PlanCacheEntryFeedback { // How well did the cached plan perform? - boost::scoped_ptr stats; + std::unique_ptr stats; // The "goodness" score produced by the plan ranker // corresponding to 'stats'. @@ -87,7 +86,7 @@ namespace mongo { * This is done by QueryPlanner::tagAccordingToCache. */ struct PlanCacheIndexTree { - PlanCacheIndexTree() : entry(NULL), index_pos(0) { } + PlanCacheIndexTree() : entry(nullptr), index_pos(0) { } ~PlanCacheIndexTree() { for (std::vector::const_iterator it = children.begin(); @@ -115,7 +114,7 @@ namespace mongo { std::vector children; // Owned here. - boost::scoped_ptr entry; + std::unique_ptr entry; size_t index_pos; }; @@ -128,7 +127,7 @@ namespace mongo { */ struct SolutionCacheData { SolutionCacheData() : - tree(NULL), + tree(nullptr), solnType(USE_INDEX_TAGS_SOLN), wholeIXSolnDir(1), indexFilterApplied(false) { @@ -144,7 +143,7 @@ namespace mongo { // can be used to tag an isomorphic match expression. If 'wholeIXSoln' // is true, then 'tree' is used to store the relevant IndexEntry. // If 'collscanSoln' is true, then 'tree' should be NULL. - boost::scoped_ptr tree; + std::unique_ptr tree; enum SolutionType { // Indicates that the plan should use @@ -252,7 +251,7 @@ namespace mongo { // Information that went into picking the winning plan and also why // the other plans lost. - boost::scoped_ptr decision; + std::unique_ptr decision; // Annotations from cached runs. The CachedPlanStage provides these stats about its // runs when they complete. diff --git a/src/mongo/db/query/plan_cache_test.cpp b/src/mongo/db/query/plan_cache_test.cpp index 55554315376..5b286023eaa 100644 --- a/src/mongo/db/query/plan_cache_test.cpp +++ b/src/mongo/db/query/plan_cache_test.cpp @@ -33,7 +33,6 @@ #include "mongo/db/query/plan_cache.h" #include -#include #include #include @@ -51,7 +50,7 @@ using namespace mongo; namespace { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::string; using std::unique_ptr; @@ -363,7 +362,7 @@ namespace { PlanCache planCache; unique_ptr cq(canonicalize("{a: 1}")); std::vector solns; - boost::scoped_ptr decision(createDecision(1U)); + std::unique_ptr decision(createDecision(1U)); ASSERT_NOT_OK(planCache.add(*cq, solns, decision.get())); } @@ -637,7 +636,7 @@ namespace { CanonicalQuery* cq; Status s = CanonicalQuery::canonicalize(ns, query, sort, proj, &cq); ASSERT_OK(s); - scoped_ptr scopedCq(cq); + unique_ptr scopedCq(cq); cq = NULL; // Create a CachedSolution the long way.. diff --git a/src/mongo/db/query/plan_enumerator.h b/src/mongo/db/query/plan_enumerator.h index cfddbf7ed5c..39f0d697145 100644 --- a/src/mongo/db/query/plan_enumerator.h +++ b/src/mongo/db/query/plan_enumerator.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" @@ -232,10 +231,10 @@ namespace mongo { * Associates indices with predicates. */ struct NodeAssignment { - boost::scoped_ptr pred; - boost::scoped_ptr orAssignment; - boost::scoped_ptr andAssignment; - boost::scoped_ptr arrayAssignment; + std::unique_ptr pred; + std::unique_ptr orAssignment; + std::unique_ptr andAssignment; + std::unique_ptr arrayAssignment; std::string toString() const; }; diff --git a/src/mongo/db/query/plan_executor.cpp b/src/mongo/db/query/plan_executor.cpp index c261f1b8982..6e56b9b20f0 100644 --- a/src/mongo/db/query/plan_executor.cpp +++ b/src/mongo/db/query/plan_executor.cpp @@ -333,7 +333,7 @@ namespace mongo { // to use to pull the record into memory. We take ownership of the RecordFetcher here, // deleting it after we've had a chance to do the fetch. For timing-based yields, we // just pass a NULL fetcher. - boost::scoped_ptr fetcher; + std::unique_ptr fetcher; // Incremented on every writeConflict, reset to 0 on any successful call to _root->work. size_t writeConflictsInARow = 0; diff --git a/src/mongo/db/query/plan_executor.h b/src/mongo/db/query/plan_executor.h index 69aa7ef8397..c3e6fdc94c7 100644 --- a/src/mongo/db/query/plan_executor.h +++ b/src/mongo/db/query/plan_executor.h @@ -29,7 +29,6 @@ #pragma once #include -#include #include #include "mongo/base/status.h" @@ -422,13 +421,13 @@ namespace mongo { // the plan stages. The collection must not be destroyed while there are active plans. const Collection* _collection; - boost::scoped_ptr _cq; - boost::scoped_ptr _workingSet; - boost::scoped_ptr _qs; - boost::scoped_ptr _root; + std::unique_ptr _cq; + std::unique_ptr _workingSet; + std::unique_ptr _qs; + std::unique_ptr _root; // Deregisters this executor when it is destroyed. - boost::scoped_ptr _safety; + std::unique_ptr _safety; // What namespace are we operating over? std::string _ns; @@ -440,7 +439,7 @@ namespace mongo { // This is used to handle automatic yielding when allowed by the YieldPolicy. Never NULL. // TODO make this a non-pointer member. This requires some header shuffling so that this // file includes plan_yield_policy.h rather than the other way around. - const boost::scoped_ptr _yieldPolicy; + const std::unique_ptr _yieldPolicy; // A stash of results generated by this plan that the user of the PlanExecutor didn't want // to consume yet. We empty the queue before retrieving further results from the plan diff --git a/src/mongo/db/query/query_planner.cpp b/src/mongo/db/query/query_planner.cpp index 4cdcbff54a3..852b705c532 100644 --- a/src/mongo/db/query/query_planner.cpp +++ b/src/mongo/db/query/query_planner.cpp @@ -750,7 +750,7 @@ namespace mongo { // The tagged tree produced by the plan enumerator is not guaranteed // to be canonically sorted. In order to be compatible with the cached // data, sort the tagged tree according to CanonicalQuery ordering. - boost::scoped_ptr clone(rawTree->shallowClone()); + std::unique_ptr clone(rawTree->shallowClone()); CanonicalQuery::sortTree(clone.get()); PlanCacheIndexTree* cacheData; diff --git a/src/mongo/db/query/query_planner_test.cpp b/src/mongo/db/query/query_planner_test.cpp index c2856df15ec..7d513f1ddf1 100644 --- a/src/mongo/db/query/query_planner_test.cpp +++ b/src/mongo/db/query/query_planner_test.cpp @@ -3419,7 +3419,7 @@ namespace { CanonicalQuery *cq; Status cqStatus = CanonicalQuery::canonicalize("ns", BSON("a" << 3), &cq); ASSERT_OK(cqStatus); - boost::scoped_ptr scopedCq(cq); + std::unique_ptr scopedCq(cq); scopedCq->root()->setTag(new IndexTag(1)); s = QueryPlanner::cacheDataFromTaggedTree(scopedCq->root(), relevantIndices, &indexTree); @@ -3431,9 +3431,9 @@ namespace { CanonicalQuery *cq; Status cqStatus = CanonicalQuery::canonicalize("ns", BSON("a" << 3), &cq); ASSERT_OK(cqStatus); - boost::scoped_ptr scopedCq(cq); + std::unique_ptr scopedCq(cq); - boost::scoped_ptr indexTree(new PlanCacheIndexTree()); + std::unique_ptr indexTree(new PlanCacheIndexTree()); indexTree->setIndexEntry(IndexEntry(BSON("a" << 1))); std::map indexMap; diff --git a/src/mongo/db/query/query_planner_test_lib.cpp b/src/mongo/db/query/query_planner_test_lib.cpp index 6384927049d..d81fc0f27e9 100644 --- a/src/mongo/db/query/query_planner_test_lib.cpp +++ b/src/mongo/db/query/query_planner_test_lib.cpp @@ -54,9 +54,9 @@ namespace { if (!swme.isOK()) { return false; } - const boost::scoped_ptr root(swme.getValue()); + const std::unique_ptr root(swme.getValue()); CanonicalQuery::sortTree(root.get()); - boost::scoped_ptr trueFilter(trueFilterNode->filter->shallowClone()); + std::unique_ptr trueFilter(trueFilterNode->filter->shallowClone()); CanonicalQuery::sortTree(trueFilter.get()); return trueFilter->equivalent(root.get()); } diff --git a/src/mongo/db/query/query_solution.h b/src/mongo/db/query/query_solution.h index 95afa910864..45a4b24ecea 100644 --- a/src/mongo/db/query/query_solution.h +++ b/src/mongo/db/query/query_solution.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/db/jsobj.h" #include "mongo/db/matcher/expression.h" @@ -150,7 +149,7 @@ namespace mongo { // If a stage has a non-NULL filter all values outputted from that stage must pass that // filter. - boost::scoped_ptr filter; + std::unique_ptr filter; protected: /** @@ -178,7 +177,7 @@ namespace mongo { QuerySolution() : hasBlockingStage(false), indexFilterApplied(false) { } // Owned here. - boost::scoped_ptr root; + std::unique_ptr root; // Any filters in root or below point into this object. Must be owned. BSONObj filterData; @@ -199,7 +198,7 @@ namespace mongo { bool indexFilterApplied; // Owned here. Used by the plan cache. - boost::scoped_ptr cacheData; + std::unique_ptr cacheData; /** * Output a human-readable std::string representing the plan. diff --git a/src/mongo/db/range_deleter.h b/src/mongo/db/range_deleter.h index 69957229872..2a6b5ccb7af 100644 --- a/src/mongo/db/range_deleter.h +++ b/src/mongo/db/range_deleter.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include #include @@ -198,10 +197,10 @@ namespace mongo { /** Returns true if stopWorkers() was called. This call is synchronized. */ bool stopRequested() const; - boost::scoped_ptr _env; + std::unique_ptr _env; // Initially not active. Must be started explicitly. - boost::scoped_ptr _worker; + std::unique_ptr _worker; // Protects _stopRequested. mutable mutex _stopMutex; diff --git a/src/mongo/db/range_deleter_test.cpp b/src/mongo/db/range_deleter_test.cpp index d7229bdece3..a74f6f72644 100644 --- a/src/mongo/db/range_deleter_test.cpp +++ b/src/mongo/db/range_deleter_test.cpp @@ -63,7 +63,7 @@ namespace { // Should not be able to queue deletes if deleter workers were not started. TEST(QueueDelete, CantAfterStop) { - boost::scoped_ptr mock( + std::unique_ptr mock( new mongo::repl::ReplicationCoordinatorMock(replSettings)); mongo::repl::setGlobalReplicationCoordinator(mock.get()); @@ -93,7 +93,7 @@ namespace { TEST(QueuedDelete, ShouldWaitCursor) { const string ns("test.user"); - boost::scoped_ptr mock( + std::unique_ptr mock( new mongo::repl::ReplicationCoordinatorMock(replSettings)); mongo::repl::setGlobalReplicationCoordinator(mock.get()); @@ -144,7 +144,7 @@ namespace { TEST(QueuedDelete, StopWhileWaitingCursor) { const string ns("test.user"); - boost::scoped_ptr mock( + std::unique_ptr mock( new mongo::repl::ReplicationCoordinatorMock(replSettings)); mongo::repl::setGlobalReplicationCoordinator(mock.get()); @@ -188,7 +188,7 @@ namespace { TEST(ImmediateDelete, ShouldWaitCursor) { const string ns("test.user"); - boost::scoped_ptr mock( + std::unique_ptr mock( new mongo::repl::ReplicationCoordinatorMock(replSettings)); mongo::repl::setGlobalReplicationCoordinator(mock.get()); @@ -245,7 +245,7 @@ namespace { TEST(ImmediateDelete, StopWhileWaitingCursor) { const string ns("test.user"); - boost::scoped_ptr mock( + std::unique_ptr mock( new mongo::repl::ReplicationCoordinatorMock(replSettings)); mongo::repl::setGlobalReplicationCoordinator(mock.get()); @@ -297,7 +297,7 @@ namespace { const string blockedNS("foo.bar"); const string ns("test.user"); - boost::scoped_ptr mock( + std::unique_ptr mock( new mongo::repl::ReplicationCoordinatorMock(replSettings)); mongo::repl::setGlobalReplicationCoordinator(mock.get()); diff --git a/src/mongo/db/range_preserver.h b/src/mongo/db/range_preserver.h index 74912e05196..818d848914e 100644 --- a/src/mongo/db/range_preserver.h +++ b/src/mongo/db/range_preserver.h @@ -26,7 +26,6 @@ * it in the license file. */ -#include #include "mongo/db/catalog/collection.h" #include "mongo/db/clientcursor.h" @@ -66,7 +65,7 @@ namespace mongo { } private: - boost::scoped_ptr _pin; + std::unique_ptr _pin; }; } // namespace mongo diff --git a/src/mongo/db/repair_database.cpp b/src/mongo/db/repair_database.cpp index fccf3ef21e3..80963f123b7 100644 --- a/src/mongo/db/repair_database.cpp +++ b/src/mongo/db/repair_database.cpp @@ -32,7 +32,6 @@ #include "mongo/db/repair_database.h" -#include #include "mongo/db/background.h" #include "mongo/base/status.h" @@ -85,8 +84,8 @@ namespace { // Skip the rest if there are no indexes to rebuild. if (indexSpecs.empty()) return Status::OK(); - boost::scoped_ptr collection; - boost::scoped_ptr indexer; + std::unique_ptr collection; + std::unique_ptr indexer; { // These steps are combined into a single WUOW to ensure there are no commits without // the indexes. 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 63fe5684aa9..e8e210cb78c 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 @@ -31,7 +31,6 @@ #include "mongo/platform/basic.h" #include -#include #include "mongo/base/status.h" #include "mongo/db/jsobj.h" @@ -75,7 +74,7 @@ namespace { NetworkInterfaceMock* _net; StorageInterfaceMock* _storage; - boost::scoped_ptr _executor; + std::unique_ptr _executor; private: void setUp(); @@ -84,8 +83,8 @@ namespace { void _runQuorumCheck(const ReplicaSetConfig& config, int myIndex); virtual Status _runQuorumCheckImpl(const ReplicaSetConfig& config, int myIndex) = 0; - boost::scoped_ptr _executorThread; - boost::scoped_ptr _quorumCheckThread; + std::unique_ptr _executorThread; + std::unique_ptr _quorumCheckThread; Status _quorumCheckStatus; boost::mutex _mutex; bool _isQuorumCheckDone; diff --git a/src/mongo/db/repl/data_replicator_test.cpp b/src/mongo/db/repl/data_replicator_test.cpp index 818fe559bec..854829ef113 100644 --- a/src/mongo/db/repl/data_replicator_test.cpp +++ b/src/mongo/db/repl/data_replicator_test.cpp @@ -146,7 +146,7 @@ namespace { private: std::unique_ptr _dr; - boost::scoped_ptr _repl; + std::unique_ptr _repl; // Owned by ReplicationCoordinatorImpl TopologyCoordinatorImpl* _topo; // Owned by ReplicationCoordinatorImpl @@ -198,7 +198,7 @@ namespace { DataReplicator* _dr; TimestampStatus _result; - boost::scoped_ptr _thread; + std::unique_ptr _thread; }; class InitialSyncTest : public DataReplicatorTest { diff --git a/src/mongo/db/repl/elect_cmd_runner.h b/src/mongo/db/repl/elect_cmd_runner.h index d92ba9326a2..2a9a7bab435 100644 --- a/src/mongo/db/repl/elect_cmd_runner.h +++ b/src/mongo/db/repl/elect_cmd_runner.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" @@ -117,8 +116,8 @@ namespace repl { bool isCanceled() const { return _isCanceled; } private: - boost::scoped_ptr _algorithm; - boost::scoped_ptr _runner; + std::unique_ptr _algorithm; + std::unique_ptr _runner; bool _isCanceled; }; diff --git a/src/mongo/db/repl/elect_cmd_runner_test.cpp b/src/mongo/db/repl/elect_cmd_runner_test.cpp index 2da5db3e98b..ce7f6ad3380 100644 --- a/src/mongo/db/repl/elect_cmd_runner_test.cpp +++ b/src/mongo/db/repl/elect_cmd_runner_test.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include #include #include "mongo/base/status.h" @@ -43,7 +42,7 @@ #include "mongo/unittest/unittest.h" -using boost::scoped_ptr; +using std::unique_ptr; namespace mongo { namespace repl { @@ -69,8 +68,8 @@ namespace { NetworkInterfaceMock* _net; StorageInterfaceMock* _storage; - boost::scoped_ptr _executor; - boost::scoped_ptr _executorThread; + std::unique_ptr _executor; + std::unique_ptr _executorThread; private: void setUp(); @@ -337,7 +336,7 @@ namespace { } private: - scoped_ptr _checker; + unique_ptr _checker; }; TEST_F(ElectScatterGatherTest, NodeRespondsWithBadVoteType) { diff --git a/src/mongo/db/repl/election_winner_declarer.h b/src/mongo/db/repl/election_winner_declarer.h index d721dea141e..9745ed4ce20 100644 --- a/src/mongo/db/repl/election_winner_declarer.h +++ b/src/mongo/db/repl/election_winner_declarer.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include @@ -119,8 +118,8 @@ namespace repl { Status getStatus() const; private: - boost::scoped_ptr _algorithm; - boost::scoped_ptr _runner; + std::unique_ptr _algorithm; + std::unique_ptr _runner; bool _isCanceled = false; }; diff --git a/src/mongo/db/repl/election_winner_declarer_test.cpp b/src/mongo/db/repl/election_winner_declarer_test.cpp index 1b264e26b56..ede769c620d 100644 --- a/src/mongo/db/repl/election_winner_declarer_test.cpp +++ b/src/mongo/db/repl/election_winner_declarer_test.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include #include #include "mongo/base/status.h" @@ -40,7 +39,7 @@ #include "mongo/unittest/unittest.h" #include "mongo/util/mongoutils/str.h" -using boost::scoped_ptr; +using std::unique_ptr; namespace mongo { namespace repl { @@ -149,7 +148,7 @@ namespace { } private: - scoped_ptr _declarer; + unique_ptr _declarer; }; diff --git a/src/mongo/db/repl/freshness_checker.h b/src/mongo/db/repl/freshness_checker.h index c2d6c99343b..188e67bd953 100644 --- a/src/mongo/db/repl/freshness_checker.h +++ b/src/mongo/db/repl/freshness_checker.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" @@ -155,8 +154,8 @@ namespace repl { long long getOriginalConfigVersion() const; private: - boost::scoped_ptr _algorithm; - boost::scoped_ptr _runner; + std::unique_ptr _algorithm; + std::unique_ptr _runner; long long _originalConfigVersion; bool _isCanceled; }; diff --git a/src/mongo/db/repl/freshness_checker_test.cpp b/src/mongo/db/repl/freshness_checker_test.cpp index c271ae0c371..6f530bbc57a 100644 --- a/src/mongo/db/repl/freshness_checker_test.cpp +++ b/src/mongo/db/repl/freshness_checker_test.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include #include #include "mongo/base/status.h" @@ -44,7 +43,7 @@ #include "mongo/unittest/unittest.h" #include "mongo/util/mongoutils/str.h" -using boost::scoped_ptr; +using std::unique_ptr; namespace mongo { namespace repl { @@ -76,8 +75,8 @@ namespace { NetworkInterfaceMock* _net; StorageInterfaceMock* _storage; - boost::scoped_ptr _executor; - boost::scoped_ptr _executorThread; + std::unique_ptr _executor; + std::unique_ptr _executorThread; private: void freshnessCheckerRunner(const ReplicationExecutor::CallbackData& data, @@ -88,7 +87,7 @@ namespace { void setUp(); void tearDown(); - boost::scoped_ptr _checker; + std::unique_ptr _checker; ReplicationExecutor::EventHandle _checkerDoneEvent; }; @@ -933,7 +932,7 @@ namespace { Milliseconds(0)); } private: - scoped_ptr _checker; + unique_ptr _checker; }; TEST_F(FreshnessScatterGatherTest, BothNodesLessFresh) { diff --git a/src/mongo/db/repl/master_slave.cpp b/src/mongo/db/repl/master_slave.cpp index 2f269b625c5..8bd5ee04cce 100644 --- a/src/mongo/db/repl/master_slave.cpp +++ b/src/mongo/db/repl/master_slave.cpp @@ -43,7 +43,6 @@ #include "mongo/db/repl/master_slave.h" #include -#include #include #include @@ -73,7 +72,7 @@ #include "mongo/util/exit.h" #include "mongo/util/log.h" -using boost::scoped_ptr; +using std::unique_ptr; using std::unique_ptr; using std::cout; using std::endl; @@ -738,7 +737,7 @@ namespace repl { } } - scoped_ptr lk(alreadyLocked ? 0 : new Lock::GlobalWrite(txn->lockState())); + unique_ptr lk(alreadyLocked ? 0 : new Lock::GlobalWrite(txn->lockState())); if ( replAllDead ) { // hmmm why is this check here and not at top of this function? does it get set between top and here? @@ -1051,7 +1050,7 @@ namespace repl { int b = replApplyBatchSize.get(); bool justOne = b == 1; - scoped_ptr lk(justOne ? 0 : new Lock::GlobalWrite(txn->lockState())); + unique_ptr lk(justOne ? 0 : new Lock::GlobalWrite(txn->lockState())); while( 1 ) { BSONElement ts = op.getField("ts"); diff --git a/src/mongo/db/repl/operation_context_repl_mock.h b/src/mongo/db/repl/operation_context_repl_mock.h index c79580f1482..592a331fbb4 100644 --- a/src/mongo/db/repl/operation_context_repl_mock.h +++ b/src/mongo/db/repl/operation_context_repl_mock.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/db/operation_context_noop.h" diff --git a/src/mongo/db/repl/repl_set_heartbeat_response_test.cpp b/src/mongo/db/repl/repl_set_heartbeat_response_test.cpp index 49f9ed1e06d..c416c3c3f3c 100644 --- a/src/mongo/db/repl/repl_set_heartbeat_response_test.cpp +++ b/src/mongo/db/repl/repl_set_heartbeat_response_test.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include #include "mongo/db/repl/repl_set_heartbeat_response.h" #include "mongo/unittest/unittest.h" @@ -38,7 +37,7 @@ namespace mongo { namespace repl { namespace { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; bool stringContains(const std::string &haystack, const std::string& needle) { diff --git a/src/mongo/db/repl/replication_coordinator_external_state.h b/src/mongo/db/repl/replication_coordinator_external_state.h index 710a01ef83e..10e842bf36a 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state.h +++ b/src/mongo/db/repl/replication_coordinator_external_state.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/base/disallow_copying.h" #include "mongo/bson/timestamp.h" diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.h b/src/mongo/db/repl/replication_coordinator_external_state_impl.h index d9f9a49373b..62edea65c70 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state_impl.h +++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" @@ -81,13 +80,13 @@ namespace repl { SyncSourceFeedback _syncSourceFeedback; // Thread running SyncSourceFeedback::run(). - boost::scoped_ptr _syncSourceFeedbackThread; + std::unique_ptr _syncSourceFeedbackThread; // Thread running runSyncThread(). - boost::scoped_ptr _applierThread; + std::unique_ptr _applierThread; // Thread running BackgroundSync::producerThread(). - boost::scoped_ptr _producerThread; + std::unique_ptr _producerThread; // Mutex guarding the _nextThreadId value to prevent concurrent incrementing. boost::mutex _nextThreadIdMutex; diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index d131c902a3a..e908970c2ae 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -97,7 +97,7 @@ namespace { if (elem.fieldNameStringData() == ReplicaSetConfig::kVersionFieldName && elem.isNumber()) { - boost::scoped_ptr generator(SecureRandom::create()); + std::unique_ptr generator(SecureRandom::create()); const int random = std::abs(static_cast(generator->nextInt64()) % 100000); builder.appendIntOrLL(ReplicaSetConfig::kVersionFieldName, elem.numberLong() + 10000 + random); @@ -185,7 +185,7 @@ namespace { return; } - boost::scoped_ptr rbidGenerator(SecureRandom::create()); + std::unique_ptr rbidGenerator(SecureRandom::create()); _rbid = static_cast(rbidGenerator->nextInt64()); if (_rbid < 0) { // Ensure _rbid is always positive diff --git a/src/mongo/db/repl/replication_coordinator_impl.h b/src/mongo/db/repl/replication_coordinator_impl.h index 0f6f4253239..a322699c58d 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.h +++ b/src/mongo/db/repl/replication_coordinator_impl.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include #include @@ -918,7 +917,7 @@ namespace repl { const Mode _replMode; // (R) // Pointer to the TopologyCoordinator owned by this ReplicationCoordinator. - boost::scoped_ptr _topCoord; // (X) + std::unique_ptr _topCoord; // (X) // If the executer is owned then this will be set, but should not be used. // This is only used to clean up and destroy the replExec if owned @@ -927,11 +926,11 @@ namespace repl { ReplicationExecutor& _replExecutor; // (S) // Pointer to the ReplicationCoordinatorExternalState owned by this ReplicationCoordinator. - boost::scoped_ptr _externalState; // (PS) + std::unique_ptr _externalState; // (PS) // Thread that drives actions in the topology coordinator // Set in startReplication() and thereafter accessed in shutdown. - boost::scoped_ptr _topCoordDriverThread; // (I) + std::unique_ptr _topCoordDriverThread; // (I) // Our RID, used to identify us to our sync source when sending replication progress // updates upstream. Set once in startReplication() and then never modified again. @@ -994,9 +993,9 @@ namespace repl { // currently in progress. When using the V1 protocol, a non-null _voteRequester pointer // indicates this instead. // Only one election is allowed at a time. - boost::scoped_ptr _freshnessChecker; // (X) + std::unique_ptr _freshnessChecker; // (X) - boost::scoped_ptr _electCmdRunner; // (X) + std::unique_ptr _electCmdRunner; // (X) std::unique_ptr _voteRequester; // (X) diff --git a/src/mongo/db/repl/replication_coordinator_impl_elect.cpp b/src/mongo/db/repl/replication_coordinator_impl_elect.cpp index 6d8acf59822..df686e79519 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_elect.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_elect.cpp @@ -48,8 +48,8 @@ namespace { LoseElectionGuard( TopologyCoordinator* topCoord, ReplicationExecutor* executor, - boost::scoped_ptr* freshnessChecker, - boost::scoped_ptr* electCmdRunner, + std::unique_ptr* freshnessChecker, + std::unique_ptr* electCmdRunner, ReplicationExecutor::EventHandle* electionFinishedEvent) : _topCoord(topCoord), _executor(executor), @@ -76,8 +76,8 @@ namespace { private: TopologyCoordinator* const _topCoord; ReplicationExecutor* const _executor; - boost::scoped_ptr* const _freshnessChecker; - boost::scoped_ptr* const _electCmdRunner; + std::unique_ptr* const _freshnessChecker; + std::unique_ptr* const _electCmdRunner; const ReplicationExecutor::EventHandle* _electionFinishedEvent; bool _dismissed; }; diff --git a/src/mongo/db/repl/replication_coordinator_impl_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_test.cpp index 82373106580..9d8144e36dc 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_test.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_test.cpp @@ -30,7 +30,6 @@ #include "mongo/platform/basic.h" -#include #include #include #include @@ -699,7 +698,7 @@ namespace { OpTime _optime; WriteConcernOptions _writeConcern; ReplicationCoordinator::StatusAndDuration _result; - boost::scoped_ptr _thread; + std::unique_ptr _thread; }; TEST_F(ReplCoordTest, AwaitReplicationNumberOfNodesBlocking) { @@ -1118,7 +1117,7 @@ namespace { ReplicationCoordinatorImpl* _replCoord; bool _finished; Status _result; - boost::scoped_ptr _thread; + std::unique_ptr _thread; bool _force; Milliseconds _waitTime; Milliseconds _stepDownTime; diff --git a/src/mongo/db/repl/replication_coordinator_test_fixture.h b/src/mongo/db/repl/replication_coordinator_test_fixture.h index d6a67cced2e..22ab10a1e25 100644 --- a/src/mongo/db/repl/replication_coordinator_test_fixture.h +++ b/src/mongo/db/repl/replication_coordinator_test_fixture.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/db/repl/repl_settings.h" @@ -182,7 +181,7 @@ namespace repl { int64_t countLogLinesContaining(const std::string& needle); private: - boost::scoped_ptr _repl; + std::unique_ptr _repl; // Owned by ReplicationCoordinatorImpl TopologyCoordinatorImpl* _topo; // Owned by ReplicationCoordinatorImpl diff --git a/src/mongo/db/repl/replication_executor.h b/src/mongo/db/repl/replication_executor.h index 14d9f50ccfb..8b7dd5255c9 100644 --- a/src/mongo/db/repl/replication_executor.h +++ b/src/mongo/db/repl/replication_executor.h @@ -435,8 +435,8 @@ namespace repl { // PRNG; seeded at class construction time. PseudoRandom _random; - boost::scoped_ptr _networkInterface; - boost::scoped_ptr _storageInterface; + std::unique_ptr _networkInterface; + std::unique_ptr _storageInterface; boost::mutex _mutex; boost::mutex _terribleExLockSyncMutex; boost::condition_variable _noMoreWaitingThreads; diff --git a/src/mongo/db/repl/replication_executor_test.cpp b/src/mongo/db/repl/replication_executor_test.cpp index d916f3e01d2..a2bd2ee8822 100644 --- a/src/mongo/db/repl/replication_executor_test.cpp +++ b/src/mongo/db/repl/replication_executor_test.cpp @@ -29,7 +29,6 @@ #include "mongo/platform/basic.h" #include -#include #include #include "mongo/db/namespace_string.h" diff --git a/src/mongo/db/repl/replication_executor_test_fixture.h b/src/mongo/db/repl/replication_executor_test_fixture.h index a5a7ae6bf25..c5e2a9cbc5e 100644 --- a/src/mongo/db/repl/replication_executor_test_fixture.h +++ b/src/mongo/db/repl/replication_executor_test_fixture.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/unittest/unittest.h" diff --git a/src/mongo/db/repl/replication_info.cpp b/src/mongo/db/repl/replication_info.cpp index 6d75a351957..343a939fc95 100644 --- a/src/mongo/db/repl/replication_info.cpp +++ b/src/mongo/db/repl/replication_info.cpp @@ -30,7 +30,6 @@ #include #include -#include #include "mongo/client/connpool.h" #include "mongo/db/commands/server_status.h" diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp index 437e01f1011..bbd53eb887c 100644 --- a/src/mongo/db/repl/rs_rollback.cpp +++ b/src/mongo/db/repl/rs_rollback.cpp @@ -475,7 +475,7 @@ namespace { removeSaver.reset(new Helpers::RemoveSaver("rollback", "", *it)); // perform a collection scan and write all documents in the collection to disk - boost::scoped_ptr exec( + std::unique_ptr exec( InternalPlanner::collectionScan(txn, *it, db->getCollection(*it))); diff --git a/src/mongo/db/repl/scatter_gather_test.cpp b/src/mongo/db/repl/scatter_gather_test.cpp index 49209e9a31a..fa00ce05e23 100644 --- a/src/mongo/db/repl/scatter_gather_test.cpp +++ b/src/mongo/db/repl/scatter_gather_test.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include #include #include "mongo/db/repl/replication_executor.h" @@ -116,8 +115,8 @@ namespace { // owned by _executor NetworkInterfaceMock* _net; StorageInterfaceMock* _storage; - boost::scoped_ptr _executor; - boost::scoped_ptr _executorThread; + std::unique_ptr _executor; + std::unique_ptr _executorThread; }; void ScatterGatherTest::setUp() { @@ -164,7 +163,7 @@ namespace { ScatterGatherRunner* _sgr; ReplicationExecutor* _executor; Status _result; - boost::scoped_ptr _thread; + std::unique_ptr _thread; }; // Simple onCompletion function which will toggle a bool, so that we can check the logs to diff --git a/src/mongo/db/repl/sync_source_feedback.h b/src/mongo/db/repl/sync_source_feedback.h index 054f6d6b183..40d22bddb5e 100644 --- a/src/mongo/db/repl/sync_source_feedback.h +++ b/src/mongo/db/repl/sync_source_feedback.h @@ -29,7 +29,6 @@ #pragma once -#include #include #include @@ -82,7 +81,7 @@ namespace repl { // the member we are currently syncing from HostAndPort _syncTarget; // our connection to our sync target - boost::scoped_ptr _connection; + std::unique_ptr _connection; // protects cond, _shutdownSignaled, and _positionChanged. boost::mutex _mtx; // used to alert our thread of changes which need to be passed up the chain diff --git a/src/mongo/db/repl/topology_coordinator_impl_test.cpp b/src/mongo/db/repl/topology_coordinator_impl_test.cpp index 93e5dfa8080..d1b75d4492b 100644 --- a/src/mongo/db/repl/topology_coordinator_impl_test.cpp +++ b/src/mongo/db/repl/topology_coordinator_impl_test.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include #include #include "mongo/db/repl/heartbeat_response_action.h" @@ -48,7 +47,7 @@ #define ASSERT_NO_ACTION(EXPRESSION) \ ASSERT_EQUALS(mongo::repl::HeartbeatResponseAction::NoAction, (EXPRESSION)) -using boost::scoped_ptr; +using std::unique_ptr; namespace mongo { namespace repl { @@ -211,8 +210,8 @@ namespace { } private: - scoped_ptr _topo; - scoped_ptr _cbData; + unique_ptr _topo; + unique_ptr _cbData; Date_t _now; int _selfIndex; }; diff --git a/src/mongo/db/service_context.cpp b/src/mongo/db/service_context.cpp index 175702aebad..53b2857bd86 100644 --- a/src/mongo/db/service_context.cpp +++ b/src/mongo/db/service_context.cpp @@ -86,7 +86,7 @@ namespace mongo { << "' has to be an embedded document."); } - boost::scoped_ptr sfi(getGlobalServiceContext()-> + std::unique_ptr sfi(getGlobalServiceContext()-> makeStorageFactoriesIterator()); invariant(sfi); bool found = false; @@ -231,7 +231,7 @@ namespace mongo { if (!hasGlobalServiceContext()) return BSONArray(); - boost::scoped_ptr sfi( + std::unique_ptr sfi( getGlobalServiceContext()->makeStorageFactoriesIterator()); if (!sfi) diff --git a/src/mongo/db/service_context_d.h b/src/mongo/db/service_context_d.h index 972063c147b..5ec8b7f6ecc 100644 --- a/src/mongo/db/service_context_d.h +++ b/src/mongo/db/service_context_d.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/db/service_context.h" @@ -103,7 +102,7 @@ namespace mongo { // protected by parent class's _mutex std::vector _killOpListeners; - boost::scoped_ptr _lockFile; + std::unique_ptr _lockFile; // logically owned here, but never deleted by anyone. StorageEngine* _storageEngine; diff --git a/src/mongo/db/sorter/sorter.cpp b/src/mongo/db/sorter/sorter.cpp index 6d6c8de179c..8b2e82ef665 100644 --- a/src/mongo/db/sorter/sorter.cpp +++ b/src/mongo/db/sorter/sorter.cpp @@ -258,7 +258,7 @@ namespace mongo { const Settings _settings; bool _done; boost::scoped_array _buffer; - boost::scoped_ptr _reader; + std::unique_ptr _reader; std::string _fileName; boost::shared_ptr _fileDeleter; // Must outlive _file std::ifstream _file; diff --git a/src/mongo/db/storage/in_memory/in_memory_engine_test.cpp b/src/mongo/db/storage/in_memory/in_memory_engine_test.cpp index 58b79a6c2b5..ec31394baae 100644 --- a/src/mongo/db/storage/in_memory/in_memory_engine_test.cpp +++ b/src/mongo/db/storage/in_memory/in_memory_engine_test.cpp @@ -46,7 +46,7 @@ namespace mongo { virtual KVEngine* getEngine() { return _engine.get(); } private: - boost::scoped_ptr _engine; + std::unique_ptr _engine; }; KVHarnessHelper* KVHarnessHelper::create() { diff --git a/src/mongo/db/storage/kv/kv_catalog.cpp b/src/mongo/db/storage/kv/kv_catalog.cpp index 53382bd8b93..6797cdf5bff 100644 --- a/src/mongo/db/storage/kv/kv_catalog.cpp +++ b/src/mongo/db/storage/kv/kv_catalog.cpp @@ -32,7 +32,6 @@ #include "mongo/db/storage/kv/kv_catalog.h" -#include #include #include "mongo/db/concurrency/d_concurrency.h" @@ -54,7 +53,7 @@ namespace { const ResourceId resourceIdCatalogMetadata(RESOURCE_METADATA, 1ULL); } - using boost::scoped_ptr; + using std::unique_ptr; using std::string; class KVCatalog::AddIdentChange : public RecoveryUnit::Change { @@ -107,7 +106,7 @@ namespace { std::string KVCatalog::_newRand() { return str::stream() - << boost::scoped_ptr(SecureRandom::create())->nextInt64(); + << std::unique_ptr(SecureRandom::create())->nextInt64(); } bool KVCatalog::_hasEntryCollidingWithRand() const { @@ -162,7 +161,7 @@ namespace { invariant( opCtx->lockState() == NULL || opCtx->lockState()->isDbLockedForMode( nsToDatabaseSubstring(ns), MODE_X ) ); - boost::scoped_ptr rLk; + std::unique_ptr rLk; if (!_isRsThreadSafe && opCtx->lockState()) { rLk.reset(new Lock::ResourceLock(opCtx->lockState(), resourceIdCatalogMetadata, @@ -219,7 +218,7 @@ namespace { StringData ns, RecordId* out ) const { - boost::scoped_ptr rLk; + std::unique_ptr rLk; if (!_isRsThreadSafe && opCtx->lockState()) { rLk.reset(new Lock::ResourceLock(opCtx->lockState(), resourceIdCatalogMetadata, @@ -266,7 +265,7 @@ namespace { StringData ns, BSONCollectionCatalogEntry::MetaData& md ) { - boost::scoped_ptr rLk; + std::unique_ptr rLk; if (!_isRsThreadSafe && opCtx->lockState()) { rLk.reset(new Lock::ResourceLock(opCtx->lockState(), resourceIdCatalogMetadata, @@ -320,7 +319,7 @@ namespace { StringData toNS, bool stayTemp ) { - boost::scoped_ptr rLk; + std::unique_ptr rLk; if (!_isRsThreadSafe && opCtx->lockState()) { rLk.reset(new Lock::ResourceLock(opCtx->lockState(), resourceIdCatalogMetadata, @@ -371,7 +370,7 @@ namespace { StringData ns ) { invariant( opCtx->lockState() == NULL || opCtx->lockState()->isDbLockedForMode( nsToDatabaseSubstring(ns), MODE_X ) ); - boost::scoped_ptr rLk; + std::unique_ptr rLk; if (!_isRsThreadSafe && opCtx->lockState()) { rLk.reset(new Lock::ResourceLock(opCtx->lockState(), resourceIdCatalogMetadata, diff --git a/src/mongo/db/storage/kv/kv_catalog.h b/src/mongo/db/storage/kv/kv_catalog.h index 359fa4cfbdb..cbdbfc515bc 100644 --- a/src/mongo/db/storage/kv/kv_catalog.h +++ b/src/mongo/db/storage/kv/kv_catalog.h @@ -33,7 +33,6 @@ #include #include -#include #include #include "mongo/base/string_data.h" diff --git a/src/mongo/db/storage/kv/kv_collection_catalog_entry.h b/src/mongo/db/storage/kv/kv_collection_catalog_entry.h index 28392db8a61..963c9d623f9 100644 --- a/src/mongo/db/storage/kv/kv_collection_catalog_entry.h +++ b/src/mongo/db/storage/kv/kv_collection_catalog_entry.h @@ -89,7 +89,7 @@ namespace mongo { KVEngine* _engine; // not owned KVCatalog* _catalog; // not owned std::string _ident; - boost::scoped_ptr _recordStore; // owned + std::unique_ptr _recordStore; // owned }; } 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 f2438689f8e..36aeefcf2c4 100644 --- a/src/mongo/db/storage/kv/kv_engine_test_harness.cpp +++ b/src/mongo/db/storage/kv/kv_engine_test_harness.cpp @@ -30,7 +30,6 @@ #include "mongo/db/storage/kv/kv_engine_test_harness.h" -#include #include "mongo/db/operation_context_noop.h" #include "mongo/db/index/index_descriptor.h" @@ -42,7 +41,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::string; namespace { @@ -55,12 +54,12 @@ namespace mongo { } TEST( KVEngineTestHarness, SimpleRS1 ) { - scoped_ptr helper( KVHarnessHelper::create() ); + unique_ptr helper( KVHarnessHelper::create() ); KVEngine* engine = helper->getEngine(); ASSERT( engine ); string ns = "a.b"; - scoped_ptr rs; + unique_ptr rs; { MyOperationContext opCtx( engine ); ASSERT_OK( engine->createRecordStore( &opCtx, ns, ns, CollectionOptions() ) ); @@ -94,7 +93,7 @@ namespace mongo { } TEST( KVEngineTestHarness, Restart1 ) { - scoped_ptr helper( KVHarnessHelper::create() ); + unique_ptr helper( KVHarnessHelper::create() ); KVEngine* engine = helper->getEngine(); ASSERT( engine ); @@ -103,7 +102,7 @@ namespace mongo { // 'loc' holds location of "abc" and is referenced after restarting engine. RecordId loc; { - scoped_ptr rs; + unique_ptr rs; { MyOperationContext opCtx( engine ); ASSERT_OK( engine->createRecordStore( &opCtx, ns, ns, CollectionOptions() ) ); @@ -129,7 +128,7 @@ namespace mongo { engine = helper->restartEngine(); { - scoped_ptr rs; + unique_ptr rs; MyOperationContext opCtx( engine ); rs.reset( engine->getRecordStore( &opCtx, ns, ns, CollectionOptions() ) ); ASSERT_EQUALS( string("abc"), rs->dataFor( &opCtx, loc ).data() ); @@ -139,13 +138,13 @@ namespace mongo { TEST( KVEngineTestHarness, SimpleSorted1 ) { - scoped_ptr helper( KVHarnessHelper::create() ); + unique_ptr helper( KVHarnessHelper::create() ); KVEngine* engine = helper->getEngine(); ASSERT( engine ); string ident = "abc"; IndexDescriptor desc( NULL, "", BSON( "key" << BSON( "a" << 1 ) ) ); - scoped_ptr sorted; + unique_ptr sorted; { MyOperationContext opCtx( engine ); ASSERT_OK( engine->createSortedDataInterface( &opCtx, ident, &desc ) ); @@ -168,11 +167,11 @@ namespace mongo { } TEST( KVCatalogTest, Coll1 ) { - scoped_ptr helper( KVHarnessHelper::create() ); + unique_ptr helper( KVHarnessHelper::create() ); KVEngine* engine = helper->getEngine(); - scoped_ptr rs; - scoped_ptr catalog; + unique_ptr rs; + unique_ptr catalog; { MyOperationContext opCtx( engine ); WriteUnitOfWork uow( &opCtx ); @@ -212,11 +211,11 @@ namespace mongo { TEST( KVCatalogTest, Idx1 ) { - scoped_ptr helper( KVHarnessHelper::create() ); + unique_ptr helper( KVHarnessHelper::create() ); KVEngine* engine = helper->getEngine(); - scoped_ptr rs; - scoped_ptr catalog; + unique_ptr rs; + unique_ptr catalog; { MyOperationContext opCtx( engine ); WriteUnitOfWork uow( &opCtx ); @@ -284,11 +283,11 @@ namespace mongo { } TEST( KVCatalogTest, DirectoryPerDb1 ) { - scoped_ptr helper( KVHarnessHelper::create() ); + unique_ptr helper( KVHarnessHelper::create() ); KVEngine* engine = helper->getEngine(); - scoped_ptr rs; - scoped_ptr catalog; + unique_ptr rs; + unique_ptr catalog; { MyOperationContext opCtx( engine ); WriteUnitOfWork uow( &opCtx ); @@ -326,11 +325,11 @@ namespace mongo { } TEST( KVCatalogTest, Split1 ) { - scoped_ptr helper( KVHarnessHelper::create() ); + unique_ptr helper( KVHarnessHelper::create() ); KVEngine* engine = helper->getEngine(); - scoped_ptr rs; - scoped_ptr catalog; + unique_ptr rs; + unique_ptr catalog; { MyOperationContext opCtx( engine ); WriteUnitOfWork uow( &opCtx ); @@ -368,11 +367,11 @@ namespace mongo { } TEST( KVCatalogTest, DirectoryPerAndSplit1 ) { - scoped_ptr helper( KVHarnessHelper::create() ); + unique_ptr helper( KVHarnessHelper::create() ); KVEngine* engine = helper->getEngine(); - scoped_ptr rs; - scoped_ptr catalog; + unique_ptr rs; + unique_ptr catalog; { MyOperationContext opCtx( engine ); WriteUnitOfWork uow( &opCtx ); diff --git a/src/mongo/db/storage/kv/kv_storage_engine.h b/src/mongo/db/storage/kv/kv_storage_engine.h index b6f33c2d7b5..f8106959dc3 100644 --- a/src/mongo/db/storage/kv/kv_storage_engine.h +++ b/src/mongo/db/storage/kv/kv_storage_engine.h @@ -33,7 +33,6 @@ #include #include -#include #include #include "mongo/db/storage/kv/kv_catalog.h" @@ -103,12 +102,12 @@ namespace mongo { KVStorageEngineOptions _options; // This must be the first member so it is destroyed last. - boost::scoped_ptr _engine; + std::unique_ptr _engine; const bool _supportsDocLocking; - boost::scoped_ptr _catalogRecordStore; - boost::scoped_ptr _catalog; + std::unique_ptr _catalogRecordStore; + std::unique_ptr _catalog; typedef std::map DBMap; DBMap _dbs; diff --git a/src/mongo/db/storage/mmap_v1/btree/btree_interface.cpp b/src/mongo/db/storage/mmap_v1/btree/btree_interface.cpp index fe42c679f15..422a6441e9a 100644 --- a/src/mongo/db/storage/mmap_v1/btree/btree_interface.cpp +++ b/src/mongo/db/storage/mmap_v1/btree/btree_interface.cpp @@ -30,7 +30,6 @@ #include "mongo/db/storage/sorted_data_interface.h" -#include #include "mongo/db/operation_context.h" #include "mongo/db/storage/mmap_v1/btree/btree_logic.h" @@ -40,7 +39,7 @@ namespace mongo { namespace { - using boost::scoped_ptr; + using std::unique_ptr; using std::string; using std::vector; @@ -56,7 +55,7 @@ namespace { } private: - boost::scoped_ptr::Builder> _builder; + std::unique_ptr::Builder> _builder; // Not owned here. OperationContext* _trans; @@ -349,7 +348,7 @@ namespace { } private: - scoped_ptr > _btree; + unique_ptr > _btree; }; } // namespace diff --git a/src/mongo/db/storage/mmap_v1/catalog/namespace_details_rsv1_metadata.cpp b/src/mongo/db/storage/mmap_v1/catalog/namespace_details_rsv1_metadata.cpp index 35f724850be..5c95ec2bbc7 100644 --- a/src/mongo/db/storage/mmap_v1/catalog/namespace_details_rsv1_metadata.cpp +++ b/src/mongo/db/storage/mmap_v1/catalog/namespace_details_rsv1_metadata.cpp @@ -30,13 +30,12 @@ #include "mongo/db/storage/mmap_v1/catalog/namespace_details_rsv1_metadata.h" -#include #include "mongo/db/operation_context.h" namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::numeric_limits; BOOST_STATIC_ASSERT(RecordStoreV1Base::Buckets diff --git a/src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp b/src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp index 99c734a93d6..8f1bb505197 100644 --- a/src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp +++ b/src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp @@ -54,7 +54,7 @@ namespace mongo { NamespaceIndex::NamespaceIndex(const std::string& dir, const std::string& database) : _dir(dir), _database(database), - _ht(NULL) { + _ht(nullptr) { } diff --git a/src/mongo/db/storage/mmap_v1/catalog/namespace_index.h b/src/mongo/db/storage/mmap_v1/catalog/namespace_index.h index 4c652b1fc25..44f429311ba 100644 --- a/src/mongo/db/storage/mmap_v1/catalog/namespace_index.h +++ b/src/mongo/db/storage/mmap_v1/catalog/namespace_index.h @@ -30,7 +30,6 @@ #pragma once -#include #include #include @@ -87,7 +86,7 @@ namespace mongo { const std::string _database; DurableMappedFile _f; - boost::scoped_ptr _ht; + std::unique_ptr _ht; }; } diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp index 2d9857ce64e..34dede1f702 100644 --- a/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp +++ b/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp @@ -32,7 +32,6 @@ #include "mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h" -#include #include #include "mongo/db/catalog/index_catalog_entry.h" @@ -56,7 +55,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; namespace { diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h b/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h index 92dea158286..1db5e8a1f87 100644 --- a/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h +++ b/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include @@ -137,8 +136,8 @@ namespace mongo { // RecoveryUnit to ensure correct handling of rollback. struct Entry { - boost::scoped_ptr catalogEntry; - boost::scoped_ptr recordStore; + std::unique_ptr catalogEntry; + std::unique_ptr recordStore; }; typedef std::map CollectionMap; diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp index b783d92a76c..d96b8f69b88 100644 --- a/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp +++ b/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp @@ -105,7 +105,7 @@ namespace mongo { // This ensures that our MmapV1RecordHeader* does not drop out from under our feet before // we dereference it. - boost::scoped_ptr _filesLock; + std::unique_ptr _filesLock; }; MmapV1ExtentManager::MmapV1ExtentManager(StringData dbname, diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_init_test.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_init_test.cpp index 2fb752eab8e..62ecdde5aa1 100644 --- a/src/mongo/db/storage/mmap_v1/mmap_v1_init_test.cpp +++ b/src/mongo/db/storage/mmap_v1/mmap_v1_init_test.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include #include "mongo/db/service_context.h" #include "mongo/db/json.h" @@ -47,7 +46,7 @@ namespace { ServiceContext* globalEnv = getGlobalServiceContext(); ASSERT_TRUE(globalEnv); ASSERT_TRUE(getGlobalServiceContext()->isRegisteredStorageEngine("mmapv1")); - boost::scoped_ptr sfi(getGlobalServiceContext()-> + std::unique_ptr sfi(getGlobalServiceContext()-> makeStorageFactoriesIterator()); ASSERT_TRUE(sfi); bool found = false; diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp b/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp index 4368190a532..5862a44a144 100644 --- a/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp +++ b/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp @@ -32,7 +32,6 @@ #include "mongo/db/storage/mmap_v1/record_store_v1_base.h" -#include #include "mongo/db/catalog/collection.h" #include "mongo/db/client.h" @@ -49,7 +48,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::set; using std::string; diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_base.h b/src/mongo/db/storage/mmap_v1/record_store_v1_base.h index a9b1ed78aa5..4e1aa8de338 100644 --- a/src/mongo/db/storage/mmap_v1/record_store_v1_base.h +++ b/src/mongo/db/storage/mmap_v1/record_store_v1_base.h @@ -30,7 +30,6 @@ #pragma once -#include #include "mongo/util/concurrency/spin_lock.h" #include "mongo/platform/unordered_set.h" @@ -307,7 +306,7 @@ namespace mongo { int len, bool enforceQuota ); - boost::scoped_ptr _details; + std::unique_ptr _details; ExtentManager* _extentManager; bool _isSystemIndexes; diff --git a/src/mongo/db/storage/mmap_v1/repair_database.cpp b/src/mongo/db/storage/mmap_v1/repair_database.cpp index f85120f8a87..aa83636ae6b 100644 --- a/src/mongo/db/storage/mmap_v1/repair_database.cpp +++ b/src/mongo/db/storage/mmap_v1/repair_database.cpp @@ -35,7 +35,6 @@ #include "mongo/db/storage/mmap_v1/mmap_v1_engine.h" #include -#include #include "mongo/db/background.h" #include "mongo/db/catalog/collection.h" @@ -56,7 +55,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::endl; using std::map; using std::string; @@ -281,7 +280,7 @@ namespace mongo { const std::string& dbName, bool preserveClonedFilesOnFailure, bool backupOriginalFiles ) { - scoped_ptr repairFileDeleter; + unique_ptr repairFileDeleter; // Must be done before and after repair getDur().syncDataAndTruncateJournal(txn); @@ -318,8 +317,8 @@ namespace mongo { return Status(ErrorCodes::NamespaceNotFound, "database does not exist to repair"); } - scoped_ptr dbEntry; - scoped_ptr tempDatabase; + unique_ptr dbEntry; + unique_ptr tempDatabase; // Must call this before MMAPV1DatabaseCatalogEntry's destructor closes the DB files ON_BLOCK_EXIT(&dur::DurableInterface::syncDataAndTruncateJournal, &getDur(), txn); diff --git a/src/mongo/db/storage/record_store_test_datafor.cpp b/src/mongo/db/storage/record_store_test_datafor.cpp index a068c26ad27..7af9534acb5 100644 --- a/src/mongo/db/storage/record_store_test_datafor.cpp +++ b/src/mongo/db/storage/record_store_test_datafor.cpp @@ -30,7 +30,6 @@ #include "mongo/db/storage/record_store_test_harness.h" -#include #include "mongo/db/record_id.h" #include "mongo/db/storage/record_data.h" @@ -42,23 +41,23 @@ using std::stringstream; namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; // Insert a record and verify its contents by calling dataFor() // on the returned RecordId. TEST( RecordStoreTestHarness, DataFor ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } string data = "record-"; RecordId loc; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->insertRecord( opCtx.get(), @@ -72,12 +71,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { RecordData record = rs->dataFor( opCtx.get(), loc ); ASSERT_EQUALS( data.size() + 1, static_cast( record.size() ) ); @@ -89,18 +88,18 @@ namespace mongo { // Insert multiple records and verify their contents by calling dataFor() // on each of the returned RecordIds. TEST( RecordStoreTestHarness, DataForMultiple ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } const int nToInsert = 10; RecordId locs[nToInsert]; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record----" << i; @@ -118,12 +117,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record----" << i; diff --git a/src/mongo/db/storage/record_store_test_datasize.cpp b/src/mongo/db/storage/record_store_test_datasize.cpp index aadcc99acb8..247adb92189 100644 --- a/src/mongo/db/storage/record_store_test_datasize.cpp +++ b/src/mongo/db/storage/record_store_test_datasize.cpp @@ -30,7 +30,6 @@ #include "mongo/db/storage/record_store_test_harness.h" -#include #include "mongo/db/storage/record_store.h" #include "mongo/unittest/unittest.h" @@ -40,37 +39,37 @@ using std::stringstream; namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; // Verify that an empty collection takes up no space. TEST( RecordStoreTestHarness, DataSizeEmpty ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT( rs->dataSize( opCtx.get() ) == 0 ); } } // Verify that a nonempty collection takes up some space. TEST( RecordStoreTestHarness, DataSizeNonEmpty ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } int nToInsert = 10; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record " << i; @@ -87,12 +86,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT( rs->dataSize( opCtx.get() ) > 0 ); } } diff --git a/src/mongo/db/storage/record_store_test_deleterecord.cpp b/src/mongo/db/storage/record_store_test_deleterecord.cpp index e51ba6c224f..d2a978d733f 100644 --- a/src/mongo/db/storage/record_store_test_deleterecord.cpp +++ b/src/mongo/db/storage/record_store_test_deleterecord.cpp @@ -30,7 +30,6 @@ #include "mongo/db/storage/record_store_test_harness.h" -#include #include "mongo/db/record_id.h" #include "mongo/db/storage/record_data.h" @@ -42,22 +41,22 @@ using std::stringstream; namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; // Insert a record and try to delete it. TEST( RecordStoreTestHarness, DeleteRecord ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } string data = "my record"; RecordId loc; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->insertRecord( opCtx.get(), @@ -71,12 +70,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); rs->deleteRecord( opCtx.get(), loc ); @@ -85,25 +84,25 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } } // Insert multiple records and try to delete them. TEST( RecordStoreTestHarness, DeleteMultipleRecords ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } const int nToInsert = 10; RecordId locs[nToInsert]; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record " << i; @@ -121,12 +120,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); rs->deleteRecord( opCtx.get(), locs[i] ); @@ -135,7 +134,7 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } } diff --git a/src/mongo/db/storage/record_store_test_harness.cpp b/src/mongo/db/storage/record_store_test_harness.cpp index 149509abf63..b3a4495b2e1 100644 --- a/src/mongo/db/storage/record_store_test_harness.cpp +++ b/src/mongo/db/storage/record_store_test_harness.cpp @@ -30,22 +30,21 @@ #include "mongo/db/storage/record_store_test_harness.h" -#include #include "mongo/db/storage/record_store.h" #include "mongo/unittest/unittest.h" namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::string; TEST( RecordStoreTestHarness, Simple1 ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } @@ -54,7 +53,7 @@ namespace mongo { RecordId loc1; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->insertRecord( opCtx.get(), s.c_str(), s.size() + 1, false ); @@ -67,7 +66,7 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( s, rs->dataFor( opCtx.get(), loc1 ).data() ); ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) ); @@ -80,7 +79,7 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->insertRecord( opCtx.get(), s.c_str(), s.size() + 1, false ); @@ -91,7 +90,7 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 2, rs->numRecords( opCtx.get() ) ); } } @@ -111,13 +110,13 @@ namespace mongo { TEST( RecordStoreTestHarness, Simple1InsertDocWroter ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); RecordId loc1; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); @@ -133,11 +132,11 @@ namespace mongo { } TEST( RecordStoreTestHarness, Delete1 ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } @@ -145,7 +144,7 @@ namespace mongo { RecordId loc; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); @@ -160,12 +159,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); @@ -179,11 +178,11 @@ namespace mongo { } TEST( RecordStoreTestHarness, Delete2 ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } @@ -191,7 +190,7 @@ namespace mongo { RecordId loc; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); @@ -206,13 +205,13 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( s, rs->dataFor( opCtx.get(), loc ).data() ); ASSERT_EQUALS( 2, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); rs->deleteRecord( opCtx.get(), loc ); @@ -222,11 +221,11 @@ namespace mongo { } TEST( RecordStoreTestHarness, Update1 ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } @@ -235,7 +234,7 @@ namespace mongo { RecordId loc; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->insertRecord( opCtx.get(), @@ -249,12 +248,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( s1, rs->dataFor( opCtx.get(), loc ).data() ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->updateRecord( opCtx.get(), loc, @@ -268,7 +267,7 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) ); ASSERT_EQUALS( s2, rs->dataFor( opCtx.get(), loc ).data() ); } @@ -276,8 +275,8 @@ namespace mongo { } TEST( RecordStoreTestHarness, UpdateInPlace1 ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); if (!rs->updateWithDamagesSupported()) return; @@ -288,7 +287,7 @@ namespace mongo { RecordId loc; const RecordData s1Rec(s1.c_str(), s1.size() + 1); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->insertRecord( opCtx.get(), @@ -303,12 +302,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( s1, rs->dataFor( opCtx.get(), loc ).data() ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); const char* damageSource = "222"; @@ -328,18 +327,18 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( s2, rs->dataFor( opCtx.get(), loc ).data() ); } } TEST( RecordStoreTestHarness, Truncate1 ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } @@ -347,7 +346,7 @@ namespace mongo { RecordId loc; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->insertRecord( opCtx.get(), s.c_str(), s.size() + 1, false ); @@ -360,17 +359,17 @@ namespace mongo { { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( s, rs->dataFor( opCtx.get(), loc ).data() ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); rs->truncate( opCtx.get() ); @@ -380,7 +379,7 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } @@ -389,16 +388,16 @@ namespace mongo { TEST( RecordStoreTestHarness, Cursor1 ) { const int N = 10; - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); for ( int i = 0; i < N; i++ ) { @@ -410,13 +409,13 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( N, rs->numRecords( opCtx.get() ) ); } { int x = 0; - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); auto cursor = rs->getCursor(opCtx.get()); while (auto record = cursor->next()) { string s = str::stream() << "eliot" << x++; @@ -428,7 +427,7 @@ namespace mongo { { int x = N; - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); auto cursor = rs->getCursor(opCtx.get(), false); while (auto record = cursor->next()) { string s = str::stream() << "eliot" << --x; diff --git a/src/mongo/db/storage/record_store_test_insertrecord.cpp b/src/mongo/db/storage/record_store_test_insertrecord.cpp index 5fddb8c4e01..18f72f8bab7 100644 --- a/src/mongo/db/storage/record_store_test_insertrecord.cpp +++ b/src/mongo/db/storage/record_store_test_insertrecord.cpp @@ -30,7 +30,6 @@ #include "mongo/db/storage/record_store_test_harness.h" -#include #include "mongo/db/record_id.h" #include "mongo/db/storage/record_data.h" @@ -43,22 +42,22 @@ using std::stringstream; namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; // Insert a record and verify the number of entries in the collection is 1. TEST( RecordStoreTestHarness, InsertRecord ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } string data = "my record"; RecordId loc; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->insertRecord( opCtx.get(), @@ -72,7 +71,7 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) ); } } @@ -80,18 +79,18 @@ namespace mongo { // Insert multiple records and verify the number of entries in the collection // equals the number that were inserted. TEST( RecordStoreTestHarness, InsertMultipleRecords ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } const int nToInsert = 10; RecordId locs[nToInsert]; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record " << i; @@ -109,7 +108,7 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } } @@ -117,17 +116,17 @@ namespace mongo { // Insert a record using a DocWriter and verify the number of entries // in the collection is 1. TEST( RecordStoreTestHarness, InsertRecordUsingDocWriter ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } RecordId loc; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { StringDocWriter docWriter( "my record", false ); @@ -142,7 +141,7 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) ); } } @@ -150,18 +149,18 @@ namespace mongo { // Insert multiple records using a DocWriter and verify the number of entries // in the collection equals the number that were inserted. TEST( RecordStoreTestHarness, InsertMultipleRecordsUsingDocWriter ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } const int nToInsert = 10; RecordId locs[nToInsert]; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record " << i; @@ -178,7 +177,7 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } } diff --git a/src/mongo/db/storage/record_store_test_manyiter.cpp b/src/mongo/db/storage/record_store_test_manyiter.cpp index 57723e23723..ec896be50a0 100644 --- a/src/mongo/db/storage/record_store_test_manyiter.cpp +++ b/src/mongo/db/storage/record_store_test_manyiter.cpp @@ -30,7 +30,6 @@ #include "mongo/db/storage/record_store_test_harness.h" -#include #include "mongo/db/record_id.h" #include "mongo/db/storage/record_data.h" @@ -44,20 +43,20 @@ using std::vector; namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; // Create multiple iterators over an empty record store. TEST( RecordStoreTestHarness, GetManyIteratorsEmpty ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); for (auto&& cursor : rs->getManyCursors(opCtx.get())) { ASSERT(!cursor->next()); ASSERT(!cursor->next()); @@ -67,18 +66,18 @@ namespace mongo { // Create multiple iterators over a nonempty record store. TEST( RecordStoreTestHarness, GetManyIteratorsNonEmpty ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } const int nToInsert = 10; RecordId locs[nToInsert]; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record " << i; @@ -96,13 +95,13 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } set remain( locs, locs + nToInsert ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); for (auto&& cursor : rs->getManyCursors(opCtx.get())) { while (auto record = cursor->next()) { ASSERT_EQ(remain.erase(record->id), size_t(1)); diff --git a/src/mongo/db/storage/record_store_test_recorditer.cpp b/src/mongo/db/storage/record_store_test_recorditer.cpp index 63edb205c6a..a4f33287ee3 100644 --- a/src/mongo/db/storage/record_store_test_recorditer.cpp +++ b/src/mongo/db/storage/record_store_test_recorditer.cpp @@ -31,7 +31,6 @@ #include "mongo/db/storage/record_store_test_harness.h" #include -#include #include "mongo/bson/util/builder.h" #include "mongo/db/record_id.h" @@ -39,7 +38,7 @@ #include "mongo/db/storage/record_store.h" #include "mongo/unittest/unittest.h" -using boost::scoped_ptr; +using std::unique_ptr; using std::string; using std::stringstream; @@ -49,11 +48,11 @@ namespace mongo { // When curr() or getNext() is called on an iterator positioned at EOF, // the iterator returns RecordId() and stays at EOF. TEST( RecordStoreTestHarness, IterateOverMultipleRecords ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } @@ -61,7 +60,7 @@ namespace mongo { RecordId locs[nToInsert]; std::string datas[nToInsert]; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record " << i; @@ -80,13 +79,13 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } std::sort( locs, locs + nToInsert ); // inserted records may not be in RecordId order { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); auto cursor = rs->getCursor(opCtx.get()); for ( int i = 0; i < nToInsert; i++ ) { const auto record = cursor->next(); @@ -102,11 +101,11 @@ namespace mongo { // When curr() or getNext() is called on an iterator positioned at EOF, // the iterator returns RecordId() and stays at EOF. TEST( RecordStoreTestHarness, IterateOverMultipleRecordsReversed ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } @@ -114,7 +113,7 @@ namespace mongo { RecordId locs[nToInsert]; std::string datas[nToInsert]; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record " << i; @@ -133,13 +132,13 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } std::sort( locs, locs + nToInsert ); // inserted records may not be in RecordId order { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); auto cursor = rs->getCursor(opCtx.get(), false); for ( int i = nToInsert - 1; i >= 0; i-- ) { @@ -155,11 +154,11 @@ namespace mongo { // Insert multiple records and try to create a forward iterator // starting at an interior position. TEST( RecordStoreTestHarness, IterateStartFromMiddle ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } @@ -167,7 +166,7 @@ namespace mongo { RecordId locs[nToInsert]; std::string datas[nToInsert]; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record " << i; @@ -186,13 +185,13 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } std::sort( locs, locs + nToInsert ); // inserted records may not be in RecordId order { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); int start = nToInsert / 2; auto cursor = rs->getCursor(opCtx.get()); @@ -209,11 +208,11 @@ namespace mongo { // Insert multiple records and try to create a reverse iterator // starting at an interior position. TEST( RecordStoreTestHarness, IterateStartFromMiddleReversed ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } @@ -221,7 +220,7 @@ namespace mongo { RecordId locs[nToInsert]; std::string datas[nToInsert]; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record " << i; @@ -240,13 +239,13 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } std::sort( locs, locs + nToInsert ); // inserted records may not be in RecordId order { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); int start = nToInsert / 2; auto cursor = rs->getCursor(opCtx.get(), false); @@ -264,11 +263,11 @@ namespace mongo { // is EOF. Add an additional record, saving and restoring the iterator state, and check // that the iterator remains EOF. TEST( RecordStoreTestHarness, RecordIteratorEOF ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } @@ -276,7 +275,7 @@ namespace mongo { RecordId locs[nToInsert]; std::string datas[nToInsert]; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { StringBuilder sb; sb << "record " << i; @@ -295,12 +294,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); // Get a forward iterator starting at the beginning of the record store. auto cursor = rs->getCursor(opCtx.get()); @@ -339,11 +338,11 @@ namespace mongo { // Test calling savePositioned and restore after each call to next TEST( RecordStoreTestHarness, RecordIteratorSavePositionedRestore ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } @@ -351,7 +350,7 @@ namespace mongo { RecordId locs[nToInsert]; std::string datas[nToInsert]; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { StringBuilder sb; sb << "record " << i; @@ -370,12 +369,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); // Get a forward iterator starting at the beginning of the record store. auto cursor = rs->getCursor(opCtx.get()); diff --git a/src/mongo/db/storage/record_store_test_recordstore.cpp b/src/mongo/db/storage/record_store_test_recordstore.cpp index c5dd2c60805..14b21c15aac 100644 --- a/src/mongo/db/storage/record_store_test_recordstore.cpp +++ b/src/mongo/db/storage/record_store_test_recordstore.cpp @@ -30,20 +30,19 @@ #include "mongo/db/storage/record_store_test_harness.h" -#include #include "mongo/db/storage/record_store.h" #include "mongo/unittest/unittest.h" -using boost::scoped_ptr; +using std::unique_ptr; using std::string; namespace mongo { // Verify that the name of the record store is not NULL and nonempty. TEST ( RecordStoreTestHarness, RecordStoreName ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { const char *name = rs->name(); @@ -53,8 +52,8 @@ namespace mongo { // Verify that the namespace of the record store is nonempty. TEST( RecordStoreTestHarness, Namespace ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { string ns = rs->ns(); @@ -64,8 +63,8 @@ namespace mongo { // Call isCapped() on a non-capped collection and verify the result is false. TEST( RecordStoreTestHarness, IsNotCapped ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); ASSERT( !rs->isCapped() ); } diff --git a/src/mongo/db/storage/record_store_test_repairiter.cpp b/src/mongo/db/storage/record_store_test_repairiter.cpp index abb6e5f6bb3..b3e11e137d4 100644 --- a/src/mongo/db/storage/record_store_test_repairiter.cpp +++ b/src/mongo/db/storage/record_store_test_repairiter.cpp @@ -30,14 +30,13 @@ #include "mongo/db/storage/record_store_test_harness.h" -#include #include "mongo/db/record_id.h" #include "mongo/db/storage/record_data.h" #include "mongo/db/storage/record_store.h" #include "mongo/unittest/unittest.h" -using boost::scoped_ptr; +using std::unique_ptr; using std::set; using std::string; using std::stringstream; @@ -46,16 +45,16 @@ namespace mongo { // Create an iterator for repairing an empty record store. TEST( RecordStoreTestHarness, GetIteratorForRepairEmpty ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); auto cursor = rs->getCursorForRepair( opCtx.get() ); // returns NULL if getCursorForRepair is not supported if (!cursor) { @@ -68,18 +67,18 @@ namespace mongo { // Insert multiple records and create an iterator for repairing the record store, // even though the it has not been corrupted. TEST( RecordStoreTestHarness, GetIteratorForRepairNonEmpty ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } const int nToInsert = 10; RecordId locs[nToInsert]; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record " << i; @@ -97,13 +96,13 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } set remain( locs, locs + nToInsert ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); auto cursor = rs->getCursorForRepair( opCtx.get() ); // returns NULL if getCursorForRepair is not supported if (!cursor) { @@ -123,18 +122,18 @@ namespace mongo { // Then invalidate the record and ensure that the repair iterator responds correctly. // See SERVER-16300. TEST(RecordStoreTestHarness, GetIteratorForRepairInvalidateSingleton) { - scoped_ptr harnessHelper(newHarnessHelper()); - scoped_ptr rs(harnessHelper->newNonCappedRecordStore()); + unique_ptr harnessHelper(newHarnessHelper()); + unique_ptr rs(harnessHelper->newNonCappedRecordStore()); { - scoped_ptr opCtx(harnessHelper->newOperationContext()); + unique_ptr opCtx(harnessHelper->newOperationContext()); ASSERT_EQ(0, rs->numRecords(opCtx.get())); } // Insert one record. RecordId idToInvalidate; { - scoped_ptr opCtx(harnessHelper->newOperationContext()); + unique_ptr opCtx(harnessHelper->newOperationContext()); WriteUnitOfWork uow(opCtx.get()); StatusWith res = rs->insertRecord(opCtx.get(), "some data", 10, false); ASSERT_OK(res.getStatus()); @@ -144,12 +143,12 @@ namespace mongo { // Double-check that the record store has one record in it now. { - scoped_ptr opCtx(harnessHelper->newOperationContext()); + unique_ptr opCtx(harnessHelper->newOperationContext()); ASSERT_EQ(1, rs->numRecords(opCtx.get())); } { - scoped_ptr opCtx(harnessHelper->newOperationContext()); + unique_ptr opCtx(harnessHelper->newOperationContext()); auto cursor = rs->getCursorForRepair( opCtx.get() ); // returns NULL if getCursorForRepair is not supported if (!cursor) { diff --git a/src/mongo/db/storage/record_store_test_storagesize.cpp b/src/mongo/db/storage/record_store_test_storagesize.cpp index 9f5ec9163cf..a0d5cfab024 100644 --- a/src/mongo/db/storage/record_store_test_storagesize.cpp +++ b/src/mongo/db/storage/record_store_test_storagesize.cpp @@ -30,12 +30,11 @@ #include "mongo/db/storage/record_store_test_harness.h" -#include #include "mongo/db/storage/record_store.h" #include "mongo/unittest/unittest.h" -using boost::scoped_ptr; +using std::unique_ptr; using std::string; using std::stringstream; @@ -43,17 +42,17 @@ namespace mongo { // Verify that a nonempty collection maybe takes up some space on disk. TEST( RecordStoreTestHarness, StorageSizeNonEmpty ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } int nToInsert = 10; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record " << i; @@ -70,12 +69,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT( rs->storageSize( opCtx.get(), NULL ) >= 0 ); } } diff --git a/src/mongo/db/storage/record_store_test_touch.cpp b/src/mongo/db/storage/record_store_test_touch.cpp index d1bcdfe488c..80b8909611c 100644 --- a/src/mongo/db/storage/record_store_test_touch.cpp +++ b/src/mongo/db/storage/record_store_test_touch.cpp @@ -30,12 +30,11 @@ #include "mongo/db/storage/record_store_test_harness.h" -#include #include "mongo/db/storage/record_store.h" #include "mongo/unittest/unittest.h" -using boost::scoped_ptr; +using std::unique_ptr; using std::string; using std::stringstream; @@ -43,16 +42,16 @@ namespace mongo { // Verify that calling touch() on an empty collection returns an OK status. TEST( RecordStoreTestHarness, TouchEmpty ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { BSONObjBuilder stats; Status status = rs->touch( opCtx.get(), &stats ); @@ -64,17 +63,17 @@ namespace mongo { // Insert multiple records, and verify that calling touch() on a nonempty collection // returns an OK status. TEST( RecordStoreTestHarness, TouchNonEmpty ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } int nToInsert = 10; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record " << i; @@ -91,12 +90,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { BSONObjBuilder stats; // XXX does not verify the collection was loaded into cache @@ -110,16 +109,16 @@ namespace mongo { // Verify that calling touch() on an empty collection returns an OK status, // even when NULL is passed in for the stats output. TEST( RecordStoreTestHarness, TouchEmptyWithNullStats ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); Status status = rs->touch( opCtx.get(), NULL /* stats output */ ); ASSERT( status.isOK() || status.code() == ErrorCodes::CommandNotSupported ); } @@ -128,17 +127,17 @@ namespace mongo { // Insert multiple records, and verify that calling touch() on a nonempty collection // returns an OK status, even when NULL is passed in for the stats output. TEST( RecordStoreTestHarness, TouchNonEmptyWithNullStats ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } int nToInsert = 10; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record " << i; @@ -155,12 +154,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); // XXX does not verify the collection was loaded into cache // (even if supported by storage engine) Status status = rs->touch( opCtx.get(), NULL /* stats output */ ); diff --git a/src/mongo/db/storage/record_store_test_truncate.cpp b/src/mongo/db/storage/record_store_test_truncate.cpp index a4d21b1f0cc..08870cc141f 100644 --- a/src/mongo/db/storage/record_store_test_truncate.cpp +++ b/src/mongo/db/storage/record_store_test_truncate.cpp @@ -30,12 +30,11 @@ #include "mongo/db/storage/record_store_test_harness.h" -#include #include "mongo/db/storage/record_store.h" #include "mongo/unittest/unittest.h" -using boost::scoped_ptr; +using std::unique_ptr; using std::string; using std::stringstream; @@ -43,16 +42,16 @@ namespace mongo { // Verify that calling truncate() on an already empty collection returns an OK status. TEST( RecordStoreTestHarness, TruncateEmpty ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); ASSERT_OK( rs->truncate( opCtx.get() ) ); @@ -61,7 +60,7 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } } @@ -69,17 +68,17 @@ namespace mongo { // Insert multiple records, and verify that calling truncate() on a nonempty collection // removes all of them and returns an OK status. TEST( RecordStoreTestHarness, TruncateNonEmpty ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } int nToInsert = 10; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record " << i; @@ -96,12 +95,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); ASSERT_OK( rs->truncate( opCtx.get() ) ); @@ -110,7 +109,7 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } } diff --git a/src/mongo/db/storage/record_store_test_updaterecord.cpp b/src/mongo/db/storage/record_store_test_updaterecord.cpp index 6955f752327..260ce0e7e9e 100644 --- a/src/mongo/db/storage/record_store_test_updaterecord.cpp +++ b/src/mongo/db/storage/record_store_test_updaterecord.cpp @@ -30,7 +30,6 @@ #include "mongo/db/storage/record_store_test_updaterecord.h" -#include #include "mongo/db/record_id.h" #include "mongo/db/storage/record_data.h" @@ -38,7 +37,7 @@ #include "mongo/db/storage/record_store_test_harness.h" #include "mongo/unittest/unittest.h" -using boost::scoped_ptr; +using std::unique_ptr; using std::string; using std::stringstream; @@ -46,18 +45,18 @@ namespace mongo { // Insert a record and try to update it. TEST( RecordStoreTestHarness, UpdateRecord ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } string data = "my record"; RecordId loc; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->insertRecord( opCtx.get(), @@ -71,13 +70,13 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) ); } data = "updated record-"; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->updateRecord( opCtx.get(), @@ -93,7 +92,7 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { RecordData record = rs->dataFor( opCtx.get(), loc ); ASSERT_EQUALS( data.size() + 1, static_cast( record.size() ) ); @@ -104,18 +103,18 @@ namespace mongo { // Insert multiple records and try to update them. TEST( RecordStoreTestHarness, UpdateMultipleRecords ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } const int nToInsert = 10; RecordId locs[nToInsert]; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record " << i; @@ -133,12 +132,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "update record-" << i; @@ -158,7 +157,7 @@ namespace mongo { } for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "update record-" << i; @@ -173,18 +172,18 @@ namespace mongo { // Insert a record, try to update it, and examine how the UpdateNotifier is called. TEST( RecordStoreTestHarness, UpdateRecordWithMoveNotifier ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } string oldData = "my record"; RecordId loc; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->insertRecord( opCtx.get(), @@ -198,13 +197,13 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) ); } string newData = "my updated record--"; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { UpdateNotifierSpy umn( opCtx.get(), loc, oldData.c_str(), oldData.size() ); @@ -233,7 +232,7 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { RecordData record = rs->dataFor( opCtx.get(), loc ); ASSERT_EQUALS( newData.size() + 1, static_cast( record.size() ) ); diff --git a/src/mongo/db/storage/record_store_test_updatewithdamages.cpp b/src/mongo/db/storage/record_store_test_updatewithdamages.cpp index 413e4f15adb..f5dc1353f15 100644 --- a/src/mongo/db/storage/record_store_test_updatewithdamages.cpp +++ b/src/mongo/db/storage/record_store_test_updatewithdamages.cpp @@ -30,28 +30,27 @@ #include "mongo/db/storage/record_store_test_harness.h" -#include #include "mongo/db/record_id.h" #include "mongo/db/storage/record_data.h" #include "mongo/db/storage/record_store.h" #include "mongo/unittest/unittest.h" -using boost::scoped_ptr; +using std::unique_ptr; using std::string; namespace mongo { // Insert a record and try to perform an in-place update on it. TEST( RecordStoreTestHarness, UpdateWithDamages ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); if (!rs->updateWithDamagesSupported()) return; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } @@ -59,7 +58,7 @@ namespace mongo { RecordId loc; const RecordData rec(data.c_str(), data.size() + 1); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->insertRecord( opCtx.get(), @@ -73,12 +72,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { mutablebson::DamageVector dv( 3 ); dv[0].sourceOffset = 5; @@ -99,7 +98,7 @@ namespace mongo { data = "11101000"; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { RecordData record = rs->dataFor( opCtx.get(), loc ); ASSERT_EQUALS( data, record.data() ); @@ -110,14 +109,14 @@ namespace mongo { // Insert a record and try to perform an in-place update on it with a DamageVector // containing overlapping DamageEvents. TEST( RecordStoreTestHarness, UpdateWithOverlappingDamageEvents ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); if (!rs->updateWithDamagesSupported()) return; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } @@ -125,7 +124,7 @@ namespace mongo { RecordId loc; const RecordData rec(data.c_str(), data.size() + 1); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->insertRecord( opCtx.get(), @@ -139,12 +138,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { mutablebson::DamageVector dv( 2 ); dv[0].sourceOffset = 3; @@ -162,7 +161,7 @@ namespace mongo { data = "10100010"; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { RecordData record = rs->dataFor( opCtx.get(), loc ); ASSERT_EQUALS( data, record.data() ); @@ -174,14 +173,14 @@ namespace mongo { // containing overlapping DamageEvents. The changes should be applied in the order // specified by the DamageVector, and not -- for instance -- by the targetOffset. TEST( RecordStoreTestHarness, UpdateWithOverlappingDamageEventsReversed ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); if (!rs->updateWithDamagesSupported()) return; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } @@ -189,7 +188,7 @@ namespace mongo { RecordId loc; const RecordData rec(data.c_str(), data.size() + 1); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->insertRecord( opCtx.get(), @@ -203,12 +202,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { mutablebson::DamageVector dv( 2 ); dv[0].sourceOffset = 0; @@ -226,7 +225,7 @@ namespace mongo { data = "10111010"; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { RecordData record = rs->dataFor( opCtx.get(), loc ); ASSERT_EQUALS( data, record.data() ); @@ -236,14 +235,14 @@ namespace mongo { // Insert a record and try to call updateWithDamages() with an empty DamageVector. TEST( RecordStoreTestHarness, UpdateWithNoDamages ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); if (!rs->updateWithDamagesSupported()) return; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } @@ -251,7 +250,7 @@ namespace mongo { RecordId loc; const RecordData rec(data.c_str(), data.size() + 1); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->insertRecord( opCtx.get(), @@ -265,12 +264,12 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { mutablebson::DamageVector dv; @@ -281,7 +280,7 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { RecordData record = rs->dataFor( opCtx.get(), loc ); ASSERT_EQUALS( data, record.data() ); diff --git a/src/mongo/db/storage/record_store_test_validate.cpp b/src/mongo/db/storage/record_store_test_validate.cpp index 984b8beb8ef..89453520073 100644 --- a/src/mongo/db/storage/record_store_test_validate.cpp +++ b/src/mongo/db/storage/record_store_test_validate.cpp @@ -30,13 +30,12 @@ #include "mongo/db/storage/record_store_test_validate.h" -#include #include "mongo/db/storage/record_store.h" #include "mongo/db/storage/record_store_test_harness.h" #include "mongo/unittest/unittest.h" -using boost::scoped_ptr; +using std::unique_ptr; using std::string; namespace mongo { @@ -46,16 +45,16 @@ namespace { // When either of `full` or `scanData` are false, the ValidateAdaptor // should not be used. TEST( RecordStoreTestHarness, ValidateEmpty ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { ValidateAdaptorSpy adaptor; ValidateResults results; @@ -76,16 +75,16 @@ namespace { // When either of `full` or `scanData` are false, the ValidateAdaptor // should not be used. TEST( RecordStoreTestHarness, ValidateEmptyAndScanData ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { ValidateAdaptorSpy adaptor; ValidateResults results; @@ -106,16 +105,16 @@ namespace { // When either of `full` or `scanData` are false, the ValidateAdaptor // should not be used. TEST( RecordStoreTestHarness, FullValidateEmpty ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { ValidateAdaptorSpy adaptor; ValidateResults results; @@ -134,16 +133,16 @@ namespace { // Verify that calling validate() on an empty collection returns an OK status. TEST( RecordStoreTestHarness, FullValidateEmptyAndScanData ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { ValidateAdaptorSpy adaptor; ValidateResults results; @@ -165,7 +164,7 @@ namespace { // should not be used. TEST_F( ValidateTest, ValidateNonEmpty ) { { - scoped_ptr opCtx( newOperationContext() ); + unique_ptr opCtx( newOperationContext() ); { ValidateAdaptorSpy adaptor; ValidateResults results; @@ -187,7 +186,7 @@ namespace { // should not be used. TEST_F( ValidateTest, ValidateAndScanDataNonEmpty ) { { - scoped_ptr opCtx( newOperationContext() ); + unique_ptr opCtx( newOperationContext() ); { ValidateAdaptorSpy adaptor; ValidateResults results; @@ -209,7 +208,7 @@ namespace { // should not be used. TEST_F( ValidateTest, FullValidateNonEmpty ) { { - scoped_ptr opCtx( newOperationContext() ); + unique_ptr opCtx( newOperationContext() ); { ValidateAdaptorSpy adaptor; ValidateResults results; @@ -230,7 +229,7 @@ namespace { // returns an OK status. TEST_F( ValidateTest, FullValidateNonEmptyAndScanData ) { { - scoped_ptr opCtx( newOperationContext() ); + unique_ptr opCtx( newOperationContext() ); { ValidateAdaptorSpy adaptor( getInsertedRecords() ); ValidateResults results; diff --git a/src/mongo/db/storage/record_store_test_validate.h b/src/mongo/db/storage/record_store_test_validate.h index c342e43dfda..e8ff30acfa3 100644 --- a/src/mongo/db/storage/record_store_test_validate.h +++ b/src/mongo/db/storage/record_store_test_validate.h @@ -30,7 +30,6 @@ #pragma once -#include #include "mongo/db/storage/record_data.h" #include "mongo/db/storage/record_store.h" @@ -81,13 +80,13 @@ namespace { void setUp() { { - boost::scoped_ptr opCtx( newOperationContext() ); + std::unique_ptr opCtx( newOperationContext() ); ASSERT_EQUALS( 0, _rs->numRecords( opCtx.get() ) ); } int nToInsert = 10; for ( int i = 0; i < nToInsert; i++ ) { - boost::scoped_ptr opCtx( newOperationContext() ); + std::unique_ptr opCtx( newOperationContext() ); { std::stringstream ss; ss << "record " << i; @@ -105,14 +104,14 @@ namespace { } { - boost::scoped_ptr opCtx( newOperationContext() ); + std::unique_ptr opCtx( newOperationContext() ); ASSERT_EQUALS( nToInsert, _rs->numRecords( opCtx.get() ) ); } } private: - boost::scoped_ptr _harnessHelper; - boost::scoped_ptr _rs; + std::unique_ptr _harnessHelper; + std::unique_ptr _rs; std::set _remain; }; diff --git a/src/mongo/db/storage/storage_engine_lock_file.h b/src/mongo/db/storage/storage_engine_lock_file.h index b28ccc29823..2cb14ac77d3 100644 --- a/src/mongo/db/storage/storage_engine_lock_file.h +++ b/src/mongo/db/storage/storage_engine_lock_file.h @@ -28,7 +28,7 @@ #pragma once -#include +#include #include #include "mongo/base/disallow_copying.h" @@ -89,7 +89,7 @@ namespace mongo { bool _uncleanShutdown; class LockFileHandle; - boost::scoped_ptr _lockFileHandle; + std::unique_ptr _lockFileHandle; }; } // namespace mongo diff --git a/src/mongo/db/storage/storage_engine_lock_file_test.cpp b/src/mongo/db/storage/storage_engine_lock_file_test.cpp index 2ca432d0d71..7ed69bc1477 100644 --- a/src/mongo/db/storage/storage_engine_lock_file_test.cpp +++ b/src/mongo/db/storage/storage_engine_lock_file_test.cpp @@ -29,7 +29,6 @@ #include "mongo/platform/basic.h" #include -#include #include #include diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_index_test.cpp index b78f11564ba..f7e308e6cf2 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_index_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index_test.cpp @@ -30,7 +30,6 @@ #include "mongo/platform/basic.h" -#include #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/catalog/index_catalog_entry.h" diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp index 767e23d6c37..2f3ddf38518 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include #include "mongo/db/service_context.h" #include "mongo/db/json.h" @@ -49,7 +48,7 @@ namespace { ServiceContext* globalEnv = getGlobalServiceContext(); ASSERT_TRUE(globalEnv); ASSERT_TRUE(getGlobalServiceContext()->isRegisteredStorageEngine(kWiredTigerEngineName)); - boost::scoped_ptr sfi(getGlobalServiceContext()-> + std::unique_ptr sfi(getGlobalServiceContext()-> makeStorageFactoriesIterator()); ASSERT_TRUE(sfi); bool found = false; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h index 0d96c0577d3..739084bdd06 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h @@ -34,7 +34,6 @@ #include #include -#include #include #include @@ -140,7 +139,7 @@ namespace mongo { WT_CONNECTION* _conn; WT_EVENT_HANDLER _eventHandler; - boost::scoped_ptr _sessionCache; + std::unique_ptr _sessionCache; std::string _path; bool _durable; @@ -150,7 +149,7 @@ namespace mongo { std::set _identToDrop; mutable boost::mutex _identToDropMutex; - boost::scoped_ptr _sizeStorer; + std::unique_ptr _sizeStorer; std::string _sizeStorerUri; mutable ElapsedTracker _sizeStorerSyncTracker; }; 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 409f0452404..db944d575d2 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp @@ -57,7 +57,7 @@ namespace mongo { private: unittest::TempDir _dbpath; - boost::scoped_ptr _engine; + std::unique_ptr _engine; }; KVHarnessHelper* KVHarnessHelper::create() { diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp index 4d3e1a37b79..fb603e787f9 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp @@ -35,7 +35,6 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_record_store.h" -#include #include #include @@ -62,7 +61,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::string; namespace { diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h index e613868bce2..a050c68d7fd 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h @@ -34,7 +34,6 @@ #include #include -#include #include #include "mongo/db/catalog/collection_options.h" 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 7bd8728109e..c03613f9b9b 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp @@ -30,7 +30,6 @@ #include "mongo/platform/basic.h" -#include #include #include @@ -51,7 +50,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::string; using std::stringstream; @@ -190,14 +189,14 @@ namespace mongo { } TEST(WiredTigerRecordStoreTest, Isolation1 ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); RecordId loc1; RecordId loc2; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); @@ -214,11 +213,11 @@ namespace mongo { } { - scoped_ptr t1( harnessHelper->newOperationContext() ); - scoped_ptr t2( harnessHelper->newOperationContext() ); + unique_ptr t1( harnessHelper->newOperationContext() ); + unique_ptr t2( harnessHelper->newOperationContext() ); - scoped_ptr w1( new WriteUnitOfWork( t1.get() ) ); - scoped_ptr w2( new WriteUnitOfWork( t2.get() ) ); + unique_ptr w1( new WriteUnitOfWork( t1.get() ) ); + unique_ptr w2( new WriteUnitOfWork( t2.get() ) ); rs->dataFor( t1.get(), loc1 ); rs->dataFor( t2.get(), loc1 ); @@ -241,14 +240,14 @@ namespace mongo { } TEST(WiredTigerRecordStoreTest, Isolation2 ) { - scoped_ptr harnessHelper( newHarnessHelper() ); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper( newHarnessHelper() ); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); RecordId loc1; RecordId loc2; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); @@ -265,8 +264,8 @@ namespace mongo { } { - scoped_ptr t1( harnessHelper->newOperationContext() ); - scoped_ptr t2( harnessHelper->newOperationContext() ); + unique_ptr t1( harnessHelper->newOperationContext() ); + unique_ptr t2( harnessHelper->newOperationContext() ); // ensure we start transactions rs->dataFor( t1.get(), loc2 ); @@ -295,8 +294,8 @@ namespace mongo { } TEST(WiredTigerRecordStoreTest, SizeStorer1 ) { - scoped_ptr harnessHelper(new WiredTigerHarnessHelper()); - scoped_ptr rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr harnessHelper(new WiredTigerHarnessHelper()); + unique_ptr rs( harnessHelper->newNonCappedRecordStore() ); string uri = checked_cast( rs.get() )->getURI(); @@ -307,7 +306,7 @@ namespace mongo { int N = 12; { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); for ( int i = 0; i < N; i++ ) { @@ -319,7 +318,7 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( N, rs->numRecords( opCtx.get() ) ); } @@ -333,18 +332,18 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); rs.reset( new WiredTigerRecordStore( opCtx.get(), "a.b", uri, false, -1, -1, NULL, &ss ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( N, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); WiredTigerRecoveryUnit* ru = checked_cast( opCtx->recoveryUnit() ); @@ -359,7 +358,7 @@ namespace mongo { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); WiredTigerSizeStorer ss2(harnessHelper->conn(), indexUri); ss2.fillCache(); long long numRecords; @@ -402,7 +401,7 @@ namespace { expectedNumRecords = WiredTigerRecordStore::kCollectionScanOnCreationThreshold; expectedDataSize = expectedNumRecords * 2; { - scoped_ptr opCtx(harnessHelper->newOperationContext()); + unique_ptr opCtx(harnessHelper->newOperationContext()); WriteUnitOfWork uow( opCtx.get() ); for (int i=0; i < expectedNumRecords; i++) { ASSERT_OK(rs->insertRecord( opCtx.get(), "a", 2, false ).getStatus()); @@ -438,9 +437,9 @@ namespace { return dataSize; } - boost::scoped_ptr harnessHelper; - boost::scoped_ptr sizeStorer; - boost::scoped_ptr rs; + std::unique_ptr harnessHelper; + std::unique_ptr sizeStorer; + std::unique_ptr rs; std::string uri; long long expectedNumRecords; @@ -449,7 +448,7 @@ namespace { // Basic validation - size storer data is not updated. TEST_F(SizeStorerValidateTest, Basic) { - scoped_ptr opCtx(harnessHelper->newOperationContext()); + unique_ptr opCtx(harnessHelper->newOperationContext()); ValidateResults results; BSONObjBuilder output; ASSERT_OK(rs->validate(opCtx.get(), false, false, NULL, &results, &output)); @@ -461,7 +460,7 @@ namespace { // Full validation - size storer data is updated. TEST_F(SizeStorerValidateTest, FullWithGoodAdaptor) { - scoped_ptr opCtx(harnessHelper->newOperationContext()); + unique_ptr opCtx(harnessHelper->newOperationContext()); GoodValidateAdaptor adaptor; ValidateResults results; BSONObjBuilder output; @@ -474,7 +473,7 @@ namespace { // Full validation with a validation adaptor that fails - size storer data is not updated. TEST_F(SizeStorerValidateTest, FullWithBadAdapter) { - scoped_ptr opCtx(harnessHelper->newOperationContext()); + unique_ptr opCtx(harnessHelper->newOperationContext()); BadValidateAdaptor adaptor; ValidateResults results; BSONObjBuilder output; @@ -489,7 +488,7 @@ namespace { TEST_F(SizeStorerValidateTest, InvalidSizeStorerAtCreation) { rs.reset(NULL); - scoped_ptr opCtx(harnessHelper->newOperationContext()); + unique_ptr opCtx(harnessHelper->newOperationContext()); sizeStorer->storeToCache(uri, expectedNumRecords*2, expectedDataSize*2); rs.reset(new WiredTigerRecordStore(opCtx.get(), "a.b", uri, false, -1, -1, NULL, sizeStorer.get())); @@ -513,8 +512,8 @@ namespace { } // namespace - StatusWith insertBSON(scoped_ptr& opCtx, - scoped_ptr& rs, + StatusWith insertBSON(unique_ptr& opCtx, + unique_ptr& rs, const Timestamp& opTime) { BSONObj obj = BSON( "ts" << opTime ); WriteUnitOfWork wuow(opCtx.get()); @@ -535,9 +534,9 @@ namespace { // TODO make generic TEST(WiredTigerRecordStoreTest, OplogHack) { WiredTigerHarnessHelper harnessHelper; - scoped_ptr rs(harnessHelper.newNonCappedRecordStore("local.oplog.foo")); + unique_ptr rs(harnessHelper.newNonCappedRecordStore("local.oplog.foo")); { - scoped_ptr opCtx(harnessHelper.newOperationContext()); + unique_ptr opCtx(harnessHelper.newOperationContext()); // always illegal ASSERT_EQ(insertBSON(opCtx, rs, Timestamp(2,-1)).getStatus(), @@ -571,7 +570,7 @@ namespace { } { - scoped_ptr opCtx(harnessHelper.newOperationContext()); + unique_ptr opCtx(harnessHelper.newOperationContext()); // find start ASSERT_EQ(rs->oplogStartHack(opCtx.get(), RecordId(0,1)), RecordId()); // nothing <= ASSERT_EQ(rs->oplogStartHack(opCtx.get(), RecordId(2,1)), RecordId(1,2)); // between @@ -580,53 +579,53 @@ namespace { } { - scoped_ptr opCtx(harnessHelper.newOperationContext()); + unique_ptr opCtx(harnessHelper.newOperationContext()); rs->temp_cappedTruncateAfter(opCtx.get(), RecordId(2,2), false); // no-op } { - scoped_ptr opCtx(harnessHelper.newOperationContext()); + unique_ptr opCtx(harnessHelper.newOperationContext()); ASSERT_EQ(rs->oplogStartHack(opCtx.get(), RecordId(2,3)), RecordId(2,2)); } { - scoped_ptr opCtx(harnessHelper.newOperationContext()); + unique_ptr opCtx(harnessHelper.newOperationContext()); rs->temp_cappedTruncateAfter(opCtx.get(), RecordId(1,2), false); // deletes 2,2 } { - scoped_ptr opCtx(harnessHelper.newOperationContext()); + unique_ptr opCtx(harnessHelper.newOperationContext()); ASSERT_EQ(rs->oplogStartHack(opCtx.get(), RecordId(2,3)), RecordId(1,2)); } { - scoped_ptr opCtx(harnessHelper.newOperationContext()); + unique_ptr opCtx(harnessHelper.newOperationContext()); rs->temp_cappedTruncateAfter(opCtx.get(), RecordId(1,2), true); // deletes 1,2 } { - scoped_ptr opCtx(harnessHelper.newOperationContext()); + unique_ptr opCtx(harnessHelper.newOperationContext()); ASSERT_EQ(rs->oplogStartHack(opCtx.get(), RecordId(2,3)), RecordId(1,1)); } { - scoped_ptr opCtx(harnessHelper.newOperationContext()); + unique_ptr opCtx(harnessHelper.newOperationContext()); WriteUnitOfWork wuow(opCtx.get()); ASSERT_OK(rs->truncate(opCtx.get())); // deletes 1,1 and leaves collection empty wuow.commit(); } { - scoped_ptr opCtx(harnessHelper.newOperationContext()); + unique_ptr opCtx(harnessHelper.newOperationContext()); ASSERT_EQ(rs->oplogStartHack(opCtx.get(), RecordId(2,3)), RecordId()); } } TEST(WiredTigerRecordStoreTest, OplogHackOnNonOplog) { WiredTigerHarnessHelper harnessHelper; - scoped_ptr rs(harnessHelper.newNonCappedRecordStore("local.NOT_oplog.foo")); + unique_ptr rs(harnessHelper.newNonCappedRecordStore("local.NOT_oplog.foo")); - scoped_ptr opCtx(harnessHelper.newOperationContext()); + unique_ptr opCtx(harnessHelper.newOperationContext()); BSONObj obj = BSON( "ts" << Timestamp(2,-1) ); { @@ -639,13 +638,13 @@ namespace { } TEST(WiredTigerRecordStoreTest, CappedOrder) { - scoped_ptr harnessHelper( new WiredTigerHarnessHelper() ); - scoped_ptr rs(harnessHelper->newCappedRecordStore("a.b", 100000,10000)); + unique_ptr harnessHelper( new WiredTigerHarnessHelper() ); + unique_ptr rs(harnessHelper->newCappedRecordStore("a.b", 100000,10000)); RecordId loc1; { // first insert a document - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->insertRecord( opCtx.get(), "a", 2, false ); @@ -656,7 +655,7 @@ namespace { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); auto cursor = rs->getCursor(opCtx.get()); auto record = cursor->seekExact(loc1); ASSERT_EQ( loc1, record->id ); @@ -666,13 +665,13 @@ namespace { { // now we insert 2 docs, but commit the 2nd one fiirst // we make sure we can't find the 2nd until the first is commited - scoped_ptr t1( harnessHelper->newOperationContext() ); - scoped_ptr w1( new WriteUnitOfWork( t1.get() ) ); + unique_ptr t1( harnessHelper->newOperationContext() ); + unique_ptr w1( new WriteUnitOfWork( t1.get() ) ); rs->insertRecord( t1.get(), "b", 2, false ); // do not commit yet { // create 2nd doc - scoped_ptr t2( harnessHelper->newOperationContext() ); + unique_ptr t2( harnessHelper->newOperationContext() ); { WriteUnitOfWork w2( t2.get() ); rs->insertRecord( t2.get(), "c", 2, false ); @@ -681,7 +680,7 @@ namespace { } { // state should be the same - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); auto cursor = rs->getCursor(opCtx.get()); auto record = cursor->seekExact(loc1); ASSERT_EQ( loc1, record->id ); @@ -692,7 +691,7 @@ namespace { } { // now all 3 docs should be visible - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); auto cursor = rs->getCursor(opCtx.get()); auto record = cursor->seekExact(loc1); ASSERT_EQ( loc1, record->id ); @@ -703,11 +702,11 @@ namespace { } TEST(WiredTigerRecordStoreTest, CappedCursorRollover) { - scoped_ptr harnessHelper( new WiredTigerHarnessHelper() ); - scoped_ptr rs(harnessHelper->newCappedRecordStore("a.b", 10000, 5)); + unique_ptr harnessHelper( new WiredTigerHarnessHelper() ); + unique_ptr rs(harnessHelper->newCappedRecordStore("a.b", 10000, 5)); { // first insert 3 documents - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); for ( int i = 0; i < 3; ++i ) { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->insertRecord( opCtx.get(), "a", 2, false ); @@ -717,14 +716,14 @@ namespace { } // set up our cursor that should rollover - scoped_ptr cursorCtx( harnessHelper->newOperationContext() ); + unique_ptr cursorCtx( harnessHelper->newOperationContext() ); auto cursor = rs->getCursor(cursorCtx.get()); ASSERT(cursor->next()); cursor->savePositioned(); cursorCtx->recoveryUnit()->abandonSnapshot(); { // insert 100 documents which causes rollover - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); for ( int i = 0; i < 100; i++ ) { WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->insertRecord( opCtx.get(), "a", 2, false ); @@ -739,7 +738,7 @@ namespace { } RecordId _oplogOrderInsertOplog( OperationContext* txn, - scoped_ptr& rs, + unique_ptr& rs, int inc ) { Timestamp opTime = Timestamp(5,inc); WiredTigerRecordStore* wrs = checked_cast(rs.get()); @@ -752,8 +751,8 @@ namespace { } TEST(WiredTigerRecordStoreTest, OplogOrder) { - scoped_ptr harnessHelper( new WiredTigerHarnessHelper() ); - scoped_ptr rs(harnessHelper->newCappedRecordStore("local.oplog.foo", + unique_ptr harnessHelper( new WiredTigerHarnessHelper() ); + unique_ptr rs(harnessHelper->newCappedRecordStore("local.oplog.foo", 100000, -1)); @@ -766,7 +765,7 @@ namespace { RecordId loc1; { // first insert a document - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); loc1 = _oplogOrderInsertOplog( opCtx.get(), rs, 1 ); @@ -775,7 +774,7 @@ namespace { } { - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); auto cursor = rs->getCursor(opCtx.get()); auto record = cursor->seekExact(loc1); ASSERT_EQ( loc1, record->id ); @@ -785,13 +784,13 @@ namespace { { // now we insert 2 docs, but commit the 2nd one fiirst // we make sure we can't find the 2nd until the first is commited - scoped_ptr t1( harnessHelper->newOperationContext() ); - scoped_ptr w1( new WriteUnitOfWork( t1.get() ) ); + unique_ptr t1( harnessHelper->newOperationContext() ); + unique_ptr w1( new WriteUnitOfWork( t1.get() ) ); _oplogOrderInsertOplog( t1.get(), rs, 2 ); // do not commit yet { // create 2nd doc - scoped_ptr t2( harnessHelper->newOperationContext() ); + unique_ptr t2( harnessHelper->newOperationContext() ); { WriteUnitOfWork w2( t2.get() ); _oplogOrderInsertOplog( t2.get(), rs, 3 ); @@ -800,7 +799,7 @@ namespace { } { // state should be the same - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); auto cursor = rs->getCursor(opCtx.get()); auto record = cursor->seekExact(loc1); ASSERT_EQ( loc1, record->id ); @@ -811,7 +810,7 @@ namespace { } { // now all 3 docs should be visible - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); auto cursor = rs->getCursor(opCtx.get()); auto record = cursor->seekExact(loc1); ASSERT_EQ( loc1, record->id ); @@ -823,17 +822,17 @@ namespace { TEST(WiredTigerRecordStoreTest, StorageSizeStatisticsDisabled) { WiredTigerHarnessHelper harnessHelper("statistics=(none)"); - scoped_ptr rs(harnessHelper.newNonCappedRecordStore("a.b")); + unique_ptr rs(harnessHelper.newNonCappedRecordStore("a.b")); - scoped_ptr opCtx(harnessHelper.newOperationContext()); + unique_ptr opCtx(harnessHelper.newOperationContext()); ASSERT_THROWS(rs->storageSize(opCtx.get()), UserException); } TEST(WiredTigerRecordStoreTest, AppendCustomStatsMetadata) { WiredTigerHarnessHelper harnessHelper; - scoped_ptr rs(harnessHelper.newNonCappedRecordStore("a.b")); + unique_ptr rs(harnessHelper.newNonCappedRecordStore("a.b")); - scoped_ptr opCtx(harnessHelper.newOperationContext()); + unique_ptr opCtx(harnessHelper.newOperationContext()); BSONObjBuilder builder; rs->appendCustomStats(opCtx.get(), &builder, 1.0); BSONObj customStats = builder.obj(); @@ -854,13 +853,13 @@ namespace { } TEST(WiredTigerRecordStoreTest, CappedCursorYieldFirst) { - scoped_ptr harnessHelper( new WiredTigerHarnessHelper() ); - scoped_ptr rs(harnessHelper->newCappedRecordStore("a.b", 10000, 50)); + unique_ptr harnessHelper( new WiredTigerHarnessHelper() ); + unique_ptr rs(harnessHelper->newCappedRecordStore("a.b", 10000, 50)); RecordId loc1; { // first insert a document - scoped_ptr opCtx( harnessHelper->newOperationContext() ); + unique_ptr opCtx( harnessHelper->newOperationContext() ); WriteUnitOfWork uow( opCtx.get() ); StatusWith res = rs->insertRecord( opCtx.get(), "a", 2, false ); ASSERT_OK( res.getStatus() ); @@ -868,7 +867,7 @@ namespace { uow.commit(); } - scoped_ptr cursorCtx( harnessHelper->newOperationContext() ); + unique_ptr cursorCtx( harnessHelper->newOperationContext() ); auto cursor = rs->getCursor(cursorCtx.get()); // See that things work if you yield before you first call getNext(). diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h index a11e4333d6e..4dcb216c060 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h @@ -34,7 +34,6 @@ #include -#include #include "mongo/base/owned_pointer_vector.h" #include "mongo/db/operation_context.h" diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_server_status.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_server_status.cpp index 25f68dfeb72..d546a4997da 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_server_status.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_server_status.cpp @@ -33,8 +33,6 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_server_status.h" -#include "boost/scoped_ptr.hpp" - #include "mongo/base/checked_cast.h" #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h" diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_util_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_util_test.cpp index 75472f6fcc5..d699c3903ba 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_util_test.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_util_test.cpp @@ -30,7 +30,6 @@ #include "mongo/platform/basic.h" -#include #include #include @@ -116,8 +115,8 @@ namespace mongo { ASSERT_OK(wtRCToStatus(wtSession->create(wtSession, getURI(), config))); } private: - boost::scoped_ptr _harnessHelper; - boost::scoped_ptr _opCtx; + std::unique_ptr _harnessHelper; + std::unique_ptr _opCtx; }; TEST_F(WiredTigerUtilMetadataTest, GetConfigurationStringInvalidURI) { -- cgit v1.2.1