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 --- src/mongo/base/owned_pointer_vector_test.cpp | 4 +- src/mongo/bson/json.cpp | 7 +- src/mongo/bson/mutable/document.cpp | 3 +- src/mongo/bson/mutable/document.h | 3 +- src/mongo/bson/oid.cpp | 7 +- src/mongo/client/dbclient_rs.h | 3 +- src/mongo/client/dbclient_rs_test.cpp | 13 +- src/mongo/client/dbclientinterface.h | 5 +- src/mongo/client/native_sasl_client_session.cpp | 2 +- src/mongo/client/native_sasl_client_session.h | 3 +- src/mongo/client/parallel.h | 5 +- src/mongo/client/sasl_client_authenticate_impl.cpp | 3 +- .../client/sasl_scramsha1_client_conversation.cpp | 5 +- src/mongo/client/scoped_db_conn_test.cpp | 3 +- src/mongo/client/syncclusterconnection.h | 3 +- src/mongo/crypto/mechanism_scram.cpp | 5 +- .../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 +- src/mongo/dbtests/basictests.cpp | 3 +- src/mongo/dbtests/config_server_fixture.cpp | 5 +- src/mongo/dbtests/indexupdatetests.cpp | 5 +- src/mongo/dbtests/jstests.cpp | 17 ++- src/mongo/dbtests/mock/mock_conn_registry.cpp | 2 +- src/mongo/dbtests/mock/mock_conn_registry.h | 3 +- src/mongo/dbtests/mock/mock_dbclient_cursor.h | 3 +- src/mongo/dbtests/mock_dbclient_conn_test.cpp | 1 - src/mongo/dbtests/oplogstarttests.cpp | 9 +- src/mongo/dbtests/plan_ranking.cpp | 43 +++--- src/mongo/dbtests/query_multi_plan_runner.cpp | 11 +- src/mongo/dbtests/query_plan_executor.cpp | 13 +- src/mongo/dbtests/query_stage_and.cpp | 43 +++--- src/mongo/dbtests/query_stage_collscan.cpp | 15 +- src/mongo/dbtests/query_stage_count.cpp | 5 +- src/mongo/dbtests/query_stage_delete.cpp | 5 +- src/mongo/dbtests/query_stage_ixscan.cpp | 8 +- src/mongo/dbtests/query_stage_limit_skip.cpp | 7 +- src/mongo/dbtests/query_stage_merge_sort.cpp | 12 +- src/mongo/dbtests/query_stage_sort.cpp | 4 +- src/mongo/dbtests/query_stage_subplan.cpp | 8 +- src/mongo/dbtests/query_stage_tests.cpp | 2 +- src/mongo/dbtests/query_stage_update.cpp | 19 ++- src/mongo/dbtests/replica_set_monitor_test.cpp | 7 +- src/mongo/dbtests/rollbacktests.cpp | 3 +- src/mongo/logger/console_appender.h | 3 +- src/mongo/logger/log_domain.h | 1 - src/mongo/logger/message_log_domain.h | 1 - src/mongo/logger/rotatable_file_appender.h | 3 +- src/mongo/logger/rotatable_file_writer.cpp | 6 +- src/mongo/logger/rotatable_file_writer.h | 3 +- src/mongo/logger/syslog_appender.h | 3 +- src/mongo/s/balance.cpp | 3 +- src/mongo/s/balance.h | 3 +- .../s/catalog/legacy/cluster_client_internal.cpp | 9 +- src/mongo/s/catalog/legacy/config_upgrade.cpp | 5 +- .../s/catalog/legacy/config_upgrade_helpers.cpp | 3 +- src/mongo/s/catalog/legacy/distlock.cpp | 7 +- src/mongo/s/chunk_manager.cpp | 2 +- src/mongo/s/client/dbclient_multi_command.cpp | 5 +- src/mongo/s/client/multi_host_query_test.cpp | 9 +- src/mongo/s/client/shard_connection_test.cpp | 1 - src/mongo/s/cluster_write.h | 5 +- src/mongo/s/collection_metadata_test.cpp | 83 ++++++----- .../s/commands/cluster_list_databases_cmd.cpp | 7 +- src/mongo/s/commands/cluster_move_chunk_cmd.cpp | 5 +- src/mongo/s/commands/cluster_pipeline_cmd.cpp | 3 +- src/mongo/s/commands/commands_public.cpp | 3 +- src/mongo/s/config.cpp | 3 +- src/mongo/s/cursors.cpp | 5 +- src/mongo/s/metadata_loader_test.cpp | 25 ++-- src/mongo/s/shard_key_pattern.cpp | 5 +- src/mongo/s/strategy.cpp | 5 +- src/mongo/s/write_ops/batch_upconvert.cpp | 5 +- src/mongo/s/write_ops/batch_write_exec.h | 1 - src/mongo/s/write_ops/batch_write_exec_test.cpp | 5 +- src/mongo/s/write_ops/batch_write_op.h | 3 +- src/mongo/s/write_ops/batched_command_request.h | 7 +- src/mongo/s/write_ops/batched_command_response.h | 7 +- src/mongo/s/write_ops/batched_delete_request.h | 3 +- src/mongo/s/write_ops/batched_insert_request.h | 3 +- src/mongo/s/write_ops/batched_request_metadata.cpp | 2 +- src/mongo/s/write_ops/batched_request_metadata.h | 3 +- src/mongo/s/write_ops/batched_update_request.h | 3 +- src/mongo/s/write_ops/write_op.h | 7 +- src/mongo/s/write_ops/write_op_test.cpp | 9 +- .../scripting/bson_template_evaluator_test.cpp | 2 +- src/mongo/scripting/engine.cpp | 5 +- src/mongo/scripting/engine_v8-3.25.h | 3 +- src/mongo/scripting/v8-3.25_utils.cpp | 7 +- src/mongo/scripting/v8_db.cpp | 2 +- src/mongo/scripting/v8_utils.cpp | 7 +- src/mongo/shell/bench.cpp | 6 +- src/mongo/shell/bench.h | 3 +- src/mongo/shell/shell_utils.cpp | 2 +- src/mongo/unittest/unittest.h | 1 - src/mongo/util/background.h | 4 +- src/mongo/util/fail_point.cpp | 3 +- src/mongo/util/fail_point_service.cpp | 5 +- src/mongo/util/net/message_server_port.cpp | 5 +- src/mongo/util/net/sock.h | 3 +- src/mongo/util/unowned_ptr.h | 4 - src/mongo/util/unowned_ptr_test.cpp | 6 +- 309 files changed, 1124 insertions(+), 1375 deletions(-) (limited to 'src') diff --git a/src/mongo/base/owned_pointer_vector_test.cpp b/src/mongo/base/owned_pointer_vector_test.cpp index ad00dad0ec0..3684da00c7e 100644 --- a/src/mongo/base/owned_pointer_vector_test.cpp +++ b/src/mongo/base/owned_pointer_vector_test.cpp @@ -272,7 +272,7 @@ namespace { TEST(OwnedPointerVectorTest, ReleaseAt) { DestructionLogger::destroyedNames().clear(); - boost::scoped_ptr holder; + std::unique_ptr holder; { // names are order of deletion OwnedPointerVector owned; @@ -315,7 +315,7 @@ namespace { { // transfer ownership of "third" to holder - boost::scoped_ptr holder(owned.popAndReleaseBack()); + std::unique_ptr holder(owned.popAndReleaseBack()); ASSERT_EQUALS( 0U, DestructionLogger::destroyedNames().size() ); ASSERT_EQUALS( 2U, owned.size() ); // holder destroyed diff --git a/src/mongo/bson/json.cpp b/src/mongo/bson/json.cpp index 3bf5c531cd0..961033570da 100644 --- a/src/mongo/bson/json.cpp +++ b/src/mongo/bson/json.cpp @@ -29,7 +29,6 @@ #include "mongo/bson/json.h" -#include #include "mongo/base/parse_number.h" #include "mongo/db/jsobj.h" @@ -43,7 +42,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::ostringstream; using std::string; @@ -325,7 +324,7 @@ namespace mongo { // Only create a sub builder if this is not the base object BSONObjBuilder* objBuilder = &builder; - scoped_ptr subObjBuilder; + unique_ptr subObjBuilder; if (subObject) { subObjBuilder.reset(new BSONObjBuilder(builder.subobjStart(fieldName))); objBuilder = subObjBuilder.get(); @@ -710,7 +709,7 @@ namespace mongo { } BSONObjBuilder* arrayBuilder = &builder; - scoped_ptr subObjBuilder; + unique_ptr subObjBuilder; if (subObject) { subObjBuilder.reset(new BSONObjBuilder(builder.subarrayStart(fieldName))); arrayBuilder = subObjBuilder.get(); diff --git a/src/mongo/bson/mutable/document.cpp b/src/mongo/bson/mutable/document.cpp index db7fa0bec5e..ddff3e694f2 100644 --- a/src/mongo/bson/mutable/document.cpp +++ b/src/mongo/bson/mutable/document.cpp @@ -29,7 +29,6 @@ #include "mongo/bson/mutable/document.h" -#include #include #include #include @@ -2651,7 +2650,7 @@ namespace mutablebson { } inline Document::Impl& Document::getImpl() { - // Don't use scoped_ptr::operator* since it may generate assertions that the + // Don't use unique_ptr::operator* since it may generate assertions that the // pointer is non-null, but we already know that to be always and forever true, and // otherwise the assertion code gets spammed into every method that inlines the call to // this function. We just dereference the pointer returned from 'get' ourselves. diff --git a/src/mongo/bson/mutable/document.h b/src/mongo/bson/mutable/document.h index 2abfc1ca527..9655daddfab 100644 --- a/src/mongo/bson/mutable/document.h +++ b/src/mongo/bson/mutable/document.h @@ -27,7 +27,6 @@ #pragma once -#include #include "mongo/base/disallow_copying.h" #include "mongo/base/string_data.h" @@ -509,7 +508,7 @@ namespace mutablebson { Element makeRootElement(const BSONObj& value); Element makeElement(ConstElement element, const StringData* fieldName); - const boost::scoped_ptr _impl; + const std::unique_ptr _impl; // The root element of this document. const Element _root; diff --git a/src/mongo/bson/oid.cpp b/src/mongo/bson/oid.cpp index e9c6b87eb3a..209d43a8a38 100644 --- a/src/mongo/bson/oid.cpp +++ b/src/mongo/bson/oid.cpp @@ -32,7 +32,6 @@ #include "mongo/bson/oid.h" #include -#include #include "mongo/base/init.h" #include "mongo/bson/bsonobjbuilder.h" @@ -43,7 +42,7 @@ namespace mongo { namespace { - boost::scoped_ptr counter; + std::unique_ptr counter; const std::size_t kTimestampOffset = 0; const std::size_t kInstanceUniqueOffset = kTimestampOffset + @@ -55,7 +54,7 @@ namespace { MONGO_INITIALIZER_GENERAL(OIDGeneration, MONGO_NO_PREREQUISITES, ("default")) (InitializerContext* context) { - boost::scoped_ptr entropy(SecureRandom::create()); + std::unique_ptr entropy(SecureRandom::create()); counter.reset(new AtomicUInt32(uint32_t(entropy->nextInt64()))); _instanceUnique = OID::InstanceUnique::generate(*entropy); return Status::OK(); @@ -120,7 +119,7 @@ namespace { } void OID::regenMachineId() { - boost::scoped_ptr entropy(SecureRandom::create()); + std::unique_ptr entropy(SecureRandom::create()); _instanceUnique = InstanceUnique::generate(*entropy); } diff --git a/src/mongo/client/dbclient_rs.h b/src/mongo/client/dbclient_rs.h index ac32ccd4964..ac2fd24f161 100644 --- a/src/mongo/client/dbclient_rs.h +++ b/src/mongo/client/dbclient_rs.h @@ -29,7 +29,6 @@ #pragma once -#include #include #include @@ -269,7 +268,7 @@ namespace mongo { std::string _setName; HostAndPort _masterHost; - boost::scoped_ptr _master; + std::unique_ptr _master; // Last used host in a slaveOk query (can be a primary). HostAndPort _lastSlaveOkHost; diff --git a/src/mongo/client/dbclient_rs_test.cpp b/src/mongo/client/dbclient_rs_test.cpp index 34abf413d5b..dbd6b9bcf25 100644 --- a/src/mongo/client/dbclient_rs_test.cpp +++ b/src/mongo/client/dbclient_rs_test.cpp @@ -31,7 +31,6 @@ * the DBClientReplicaSet talks to, so the tests only covers the client side logic. */ -#include #include #include #include @@ -48,7 +47,7 @@ #include "mongo/util/assert_util.h" namespace { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::map; using std::make_pair; @@ -98,7 +97,7 @@ namespace { } private: - boost::scoped_ptr _replSet; + std::unique_ptr _replSet; }; TEST_F(BasicRS, ReadFromPrimary) { @@ -189,7 +188,7 @@ namespace { } private: - boost::scoped_ptr _replSet; + std::unique_ptr _replSet; }; TEST_F(AllNodesDown, ReadFromPrimary) { @@ -262,7 +261,7 @@ namespace { } private: - boost::scoped_ptr _replSet; + std::unique_ptr _replSet; }; TEST_F(PrimaryDown, ReadFromPrimary) { @@ -350,7 +349,7 @@ namespace { } private: - boost::scoped_ptr _replSet; + std::unique_ptr _replSet; }; TEST_F(SecondaryDown, ReadFromPrimary) { @@ -528,7 +527,7 @@ namespace { private: ConnectionString::ConnectionHook* _originalConnectionHook; - boost::scoped_ptr _replSet; + std::unique_ptr _replSet; }; TEST_F(TaggedFiveMemberRS, ConnShouldPinIfSameSettings) { diff --git a/src/mongo/client/dbclientinterface.h b/src/mongo/client/dbclientinterface.h index 0aae9081a13..1e42a381d1e 100644 --- a/src/mongo/client/dbclientinterface.h +++ b/src/mongo/client/dbclientinterface.h @@ -29,7 +29,6 @@ #pragma once #include -#include #include "mongo/base/string_data.h" #include "mongo/client/connection_string.h" @@ -1111,8 +1110,8 @@ namespace mongo { virtual void _auth(const BSONObj& params); virtual void sayPiggyBack( Message &toSend ); - boost::scoped_ptr p; - boost::scoped_ptr server; + std::unique_ptr p; + std::unique_ptr server; bool _failed; const bool autoReconnect; Backoff autoReconnectBackoff; diff --git a/src/mongo/client/native_sasl_client_session.cpp b/src/mongo/client/native_sasl_client_session.cpp index cb04918ea23..8824ddcbfc2 100644 --- a/src/mongo/client/native_sasl_client_session.cpp +++ b/src/mongo/client/native_sasl_client_session.cpp @@ -53,7 +53,7 @@ namespace { SaslClientSession(), _step(0), _done(false), - _saslConversation(NULL) { + _saslConversation(nullptr) { } NativeSaslClientSession::~NativeSaslClientSession() {} diff --git a/src/mongo/client/native_sasl_client_session.h b/src/mongo/client/native_sasl_client_session.h index 0849c463a78..dca7c80b03c 100644 --- a/src/mongo/client/native_sasl_client_session.h +++ b/src/mongo/client/native_sasl_client_session.h @@ -25,7 +25,6 @@ * then also delete it in the license file. */ -#include #include "mongo/client/sasl_client_session.h" @@ -58,7 +57,7 @@ namespace mongo { bool _done; /// The client side of a SASL authentication conversation. - boost::scoped_ptr _saslConversation; + std::unique_ptr _saslConversation; }; } // namespace mongo diff --git a/src/mongo/client/parallel.h b/src/mongo/client/parallel.h index d530dc88a04..25b1993631a 100644 --- a/src/mongo/client/parallel.h +++ b/src/mongo/client/parallel.h @@ -31,7 +31,6 @@ #pragma once -#include #include #include "mongo/db/namespace_string.h" @@ -336,10 +335,10 @@ namespace mongo { int _options; BSONObj _cmd; DBClientBase * _conn; - boost::scoped_ptr _connHolder; // used if not provided a connection + std::unique_ptr _connHolder; // used if not provided a connection bool _useShardConn; - boost::scoped_ptr _cursor; + std::unique_ptr _cursor; BSONObj _res; bool _ok; diff --git a/src/mongo/client/sasl_client_authenticate_impl.cpp b/src/mongo/client/sasl_client_authenticate_impl.cpp index 930db45a4f7..a2447e2c507 100644 --- a/src/mongo/client/sasl_client_authenticate_impl.cpp +++ b/src/mongo/client/sasl_client_authenticate_impl.cpp @@ -36,7 +36,6 @@ #include "mongo/platform/basic.h" -#include #include #include "mongo/base/init.h" @@ -207,7 +206,7 @@ namespace { return status; } - boost::scoped_ptr session(SaslClientSession::create(mechanism)); + std::unique_ptr session(SaslClientSession::create(mechanism)); status = configureSession(session.get(), client, targetDatabase, saslParameters); if (!status.isOK()) diff --git a/src/mongo/client/sasl_scramsha1_client_conversation.cpp b/src/mongo/client/sasl_scramsha1_client_conversation.cpp index 50e54734a8f..149fa4d4346 100644 --- a/src/mongo/client/sasl_scramsha1_client_conversation.cpp +++ b/src/mongo/client/sasl_scramsha1_client_conversation.cpp @@ -31,7 +31,6 @@ #include "mongo/client/sasl_scramsha1_client_conversation.h" #include -#include #include "mongo/base/parse_number.h" #include "mongo/client/sasl_client_session.h" @@ -43,7 +42,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::string; SaslSCRAMSHA1ClientConversation::SaslSCRAMSHA1ClientConversation( @@ -103,7 +102,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/client/scoped_db_conn_test.cpp b/src/mongo/client/scoped_db_conn_test.cpp index f55c666a7f6..ef68972dabc 100644 --- a/src/mongo/client/scoped_db_conn_test.cpp +++ b/src/mongo/client/scoped_db_conn_test.cpp @@ -41,7 +41,6 @@ #include "mongo/unittest/unittest.h" #include -#include #include /** @@ -51,7 +50,7 @@ * connection). */ -using boost::scoped_ptr; +using std::unique_ptr; using mongo::DBClientBase; using mongo::FailPoint; using mongo::ScopedDbConnection; diff --git a/src/mongo/client/syncclusterconnection.h b/src/mongo/client/syncclusterconnection.h index b47d4cfe0eb..86ad8421ff1 100644 --- a/src/mongo/client/syncclusterconnection.h +++ b/src/mongo/client/syncclusterconnection.h @@ -30,7 +30,6 @@ #pragma once -#include #include "mongo/bson/bsonelement.h" #include "mongo/bson/bsonobj.h" @@ -162,7 +161,7 @@ namespace mongo { std::vector _lastErrors; // Optionally attached by user - boost::scoped_ptr _customQueryHandler; + std::unique_ptr _customQueryHandler; mongo::mutex _mutex; std::map _lockTypes; diff --git a/src/mongo/crypto/mechanism_scram.cpp b/src/mongo/crypto/mechanism_scram.cpp index 3bca59f4664..39695ca4bac 100644 --- a/src/mongo/crypto/mechanism_scram.cpp +++ b/src/mongo/crypto/mechanism_scram.cpp @@ -30,7 +30,6 @@ #include "mongo/crypto/mechanism_scram.h" -#include #include #include "mongo/crypto/crypto.h" @@ -40,7 +39,7 @@ namespace mongo { namespace scram { - using boost::scoped_ptr; + using std::unique_ptr; // Compute the SCRAM step Hi() as defined in RFC5802 static void HMACIteration(const unsigned char input[], @@ -149,7 +148,7 @@ namespace scram { // Generate salt uint64_t userSalt[saltLenQWords]; - scoped_ptr sr(SecureRandom::create()); + unique_ptr sr(SecureRandom::create()); userSalt[0] = sr->nextInt64(); userSalt[1] = sr->nextInt64(); 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) { diff --git a/src/mongo/dbtests/basictests.cpp b/src/mongo/dbtests/basictests.cpp index 93ac8d0a1c3..907389d3403 100644 --- a/src/mongo/dbtests/basictests.cpp +++ b/src/mongo/dbtests/basictests.cpp @@ -31,7 +31,6 @@ #include "mongo/platform/basic.h" -#include #include #include @@ -48,7 +47,7 @@ namespace BasicTests { - using boost::scoped_ptr; + using std::unique_ptr; using boost::shared_ptr; using std::cout; using std::dec; diff --git a/src/mongo/dbtests/config_server_fixture.cpp b/src/mongo/dbtests/config_server_fixture.cpp index ad3dc3b9e7b..a0e382c266f 100644 --- a/src/mongo/dbtests/config_server_fixture.cpp +++ b/src/mongo/dbtests/config_server_fixture.cpp @@ -32,7 +32,6 @@ #include "mongo/dbtests/config_server_fixture.h" -#include #include #include "mongo/dbtests/dbtests.h" @@ -45,7 +44,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::endl; using std::list; using std::string; @@ -100,7 +99,7 @@ namespace mongo { { const string& collection = *it; - scoped_ptr cursor(_client.query(collection, BSONObj()).release()); + unique_ptr cursor(_client.query(collection, BSONObj()).release()); ASSERT(cursor.get() != NULL); log() << "Dumping collection " << collection << endl; diff --git a/src/mongo/dbtests/indexupdatetests.cpp b/src/mongo/dbtests/indexupdatetests.cpp index 1141009a5ea..77d7b7edf59 100644 --- a/src/mongo/dbtests/indexupdatetests.cpp +++ b/src/mongo/dbtests/indexupdatetests.cpp @@ -28,7 +28,6 @@ * then also delete it in the license file. */ -#include #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/index_catalog.h" @@ -45,7 +44,7 @@ namespace IndexUpdateTests { - using boost::scoped_ptr; + using std::unique_ptr; static const char* const _ns = "unittests.indexupdate"; @@ -248,7 +247,7 @@ namespace IndexUpdateTests { // The index's root is set after the build is complete. ASSERT( !id->getHead().isNull() ); // Create a cursor over the index. - scoped_ptr cursor( + unique_ptr cursor( BtreeCursor::make( nsdetails( _ns ), id->getOnDisk(), BSON( "" << -1 ), // startKey below minimum key. diff --git a/src/mongo/dbtests/jstests.cpp b/src/mongo/dbtests/jstests.cpp index fcd271bd3fc..c715db5e76d 100644 --- a/src/mongo/dbtests/jstests.cpp +++ b/src/mongo/dbtests/jstests.cpp @@ -33,7 +33,6 @@ #include "mongo/platform/basic.h" -#include #include #include @@ -47,7 +46,7 @@ #include "mongo/util/log.h" #include "mongo/util/timer.h" -using boost::scoped_ptr; +using std::unique_ptr; using std::unique_ptr; using std::cout; using std::endl; @@ -68,7 +67,7 @@ namespace JSTests { class BasicScope { public: void run() { - scoped_ptr s; + unique_ptr s; s.reset( globalScriptEngine->newScope() ); s->setNumber( "x" , 5 ); @@ -108,7 +107,7 @@ namespace JSTests { public: void run() { // Test falsy javascript values - scoped_ptr s; + unique_ptr s; s.reset( globalScriptEngine->newScope() ); ASSERT( ! s->getBoolean( "notSet" ) ); @@ -838,7 +837,7 @@ namespace JSTests { class ExecTimeout { public: void run() { - scoped_ptr scope(globalScriptEngine->newScope()); + unique_ptr scope(globalScriptEngine->newScope()); // assert timeout occurred ASSERT(!scope->exec("var a = 1; while (true) { ; }", @@ -852,7 +851,7 @@ namespace JSTests { class ExecNoTimeout { public: void run() { - scoped_ptr scope(globalScriptEngine->newScope()); + unique_ptr scope(globalScriptEngine->newScope()); // assert no timeout occurred ASSERT(scope->exec("var a = function() { return 1; }", @@ -866,7 +865,7 @@ namespace JSTests { class InvokeTimeout { public: void run() { - scoped_ptr scope(globalScriptEngine->newScope()); + unique_ptr scope(globalScriptEngine->newScope()); // scope timeout after 500ms bool caught = false; @@ -888,7 +887,7 @@ namespace JSTests { class InvokeNoTimeout { public: void run() { - scoped_ptr scope(globalScriptEngine->newScope()); + unique_ptr scope(globalScriptEngine->newScope()); // invoke completes before timeout scope->invokeSafe("function() { " @@ -2004,7 +2003,7 @@ namespace JSTests { DBDirectClient client(&txn); client.update( "test.system.js" , query.obj() , update.obj() , true /* upsert */ ); - scoped_ptr s( globalScriptEngine->newScope() ); + unique_ptr s( globalScriptEngine->newScope() ); client.eval( "test" , "invalidstoredjs1()" ); BSONObj info; diff --git a/src/mongo/dbtests/mock/mock_conn_registry.cpp b/src/mongo/dbtests/mock/mock_conn_registry.cpp index 92f1382c542..67b27cb2316 100644 --- a/src/mongo/dbtests/mock/mock_conn_registry.cpp +++ b/src/mongo/dbtests/mock/mock_conn_registry.cpp @@ -35,7 +35,7 @@ namespace mongo { using std::string; - boost::scoped_ptr MockConnRegistry::_instance; + std::unique_ptr MockConnRegistry::_instance; MONGO_INITIALIZER(MockConnRegistry)(InitializerContext* context) { return MockConnRegistry::init(); diff --git a/src/mongo/dbtests/mock/mock_conn_registry.h b/src/mongo/dbtests/mock/mock_conn_registry.h index f87196748ab..a4177ae5592 100644 --- a/src/mongo/dbtests/mock/mock_conn_registry.h +++ b/src/mongo/dbtests/mock/mock_conn_registry.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/base/status.h" #include "mongo/client/dbclientinterface.h" @@ -111,7 +110,7 @@ namespace mongo { MockConnRegistry(); - static boost::scoped_ptr _instance; + static std::unique_ptr _instance; MockConnHook _mockConnStrHook; diff --git a/src/mongo/dbtests/mock/mock_dbclient_cursor.h b/src/mongo/dbtests/mock/mock_dbclient_cursor.h index c8aa3a38bcf..22fec61898b 100644 --- a/src/mongo/dbtests/mock/mock_dbclient_cursor.h +++ b/src/mongo/dbtests/mock/mock_dbclient_cursor.h @@ -29,7 +29,6 @@ #pragma once -#include #include "mongo/client/dbclientcursor.h" #include "mongo/client/dbclientmockcursor.h" @@ -54,7 +53,7 @@ namespace mongo { mongo::BSONObj next(); private: - boost::scoped_ptr _cursor; + std::unique_ptr _cursor; mongo::BSONObj _resultSet; }; } diff --git a/src/mongo/dbtests/mock_dbclient_conn_test.cpp b/src/mongo/dbtests/mock_dbclient_conn_test.cpp index e88bf1f5054..c69fb80134a 100644 --- a/src/mongo/dbtests/mock_dbclient_conn_test.cpp +++ b/src/mongo/dbtests/mock_dbclient_conn_test.cpp @@ -35,7 +35,6 @@ #include "mongo/unittest/unittest.h" #include "mongo/util/timer.h" -#include #include #include #include diff --git a/src/mongo/dbtests/oplogstarttests.cpp b/src/mongo/dbtests/oplogstarttests.cpp index 9cf68150fb5..9c3efe42afe 100644 --- a/src/mongo/dbtests/oplogstarttests.cpp +++ b/src/mongo/dbtests/oplogstarttests.cpp @@ -22,7 +22,6 @@ #include "mongo/dbtests/dbtests.h" -#include #include "mongo/db/catalog/collection.h" #include "mongo/db/db.h" @@ -37,7 +36,7 @@ namespace OplogStartTests { - using boost::scoped_ptr; + using std::unique_ptr; using std::string; class Base { @@ -98,9 +97,9 @@ namespace OplogStartTests { ASSERT_EQUALS(idEl.numberInt(), expectedId); } - scoped_ptr _cq; - scoped_ptr _oplogws; - scoped_ptr _stage; + unique_ptr _cq; + unique_ptr _oplogws; + unique_ptr _stage; private: // The order of these is important in order to ensure order of destruction diff --git a/src/mongo/dbtests/plan_ranking.cpp b/src/mongo/dbtests/plan_ranking.cpp index f5a0320d3d6..db937935c83 100644 --- a/src/mongo/dbtests/plan_ranking.cpp +++ b/src/mongo/dbtests/plan_ranking.cpp @@ -30,7 +30,6 @@ * This file tests db/query/plan_ranker.cpp and db/query/multi_plan_runner.cpp. */ -#include #include #include "mongo/client/dbclientcursor.h" @@ -61,7 +60,7 @@ namespace mongo { namespace PlanRankingTests { - using boost::scoped_ptr; + using std::unique_ptr; using std::vector; static const char* ns = "unittests.PlanRankingTests"; @@ -119,7 +118,7 @@ namespace PlanRankingTests { // Fill out the MPR. _mps.reset(new MultiPlanStage(&_txn, collection, cq)); - boost::scoped_ptr ws(new WorkingSet()); + std::unique_ptr ws(new WorkingSet()); // Put each solution from the planner into the MPR. for (size_t i = 0; i < solutions.size(); ++i) { PlanStage* root; @@ -164,7 +163,7 @@ namespace PlanRankingTests { // of the test. bool _enableHashIntersection; - scoped_ptr _mps; + unique_ptr _mps; DBDirectClient _client; }; @@ -191,7 +190,7 @@ namespace PlanRankingTests { CanonicalQuery* cq; verify(CanonicalQuery::canonicalize(ns, BSON("a" << 100 << "b" << 1), &cq).isOK()); ASSERT(NULL != cq); - boost::scoped_ptr killCq(cq); + std::unique_ptr killCq(cq); // {a:100} is super selective so choose that. // Takes ownership of cq. @@ -206,7 +205,7 @@ namespace PlanRankingTests { // And run the same query again. ASSERT(CanonicalQuery::canonicalize(ns, BSON("a" << 100 << "b" << 1), &cq).isOK()); - boost::scoped_ptr killCq2(cq); + std::unique_ptr killCq2(cq); // With the "ranking picks ixisect always" option we pick an intersection plan that uses // both the {a:1} and {b:1} indices even though it performs poorly. @@ -241,7 +240,7 @@ namespace PlanRankingTests { verify(CanonicalQuery::canonicalize(ns, BSON("a" << 1 << "b" << BSON("$gt" << 1)), &cq).isOK()); ASSERT(NULL != cq); - boost::scoped_ptr killCq(cq); + std::unique_ptr killCq(cq); // Turn on the "force intersect" option. // This will be reverted by PlanRankingTestBase's destructor when the test completes. @@ -284,7 +283,7 @@ namespace PlanRankingTests { BSON("_id" << 0 << "a" << 1 << "b" << 1), &cq).isOK()); ASSERT(NULL != cq); - boost::scoped_ptr killCq(cq); + std::unique_ptr killCq(cq); // Takes ownership of cq. QuerySolution* soln = pickBestPlan(cq); @@ -318,7 +317,7 @@ namespace PlanRankingTests { BSONObj queryObj = BSON("a" << 1 << "b" << 1 << "c" << 99); ASSERT(CanonicalQuery::canonicalize(ns, queryObj, &cq).isOK()); ASSERT(NULL != cq); - boost::scoped_ptr killCq(cq); + std::unique_ptr killCq(cq); // Takes ownership of cq. QuerySolution* soln = pickBestPlan(cq); @@ -361,7 +360,7 @@ namespace PlanRankingTests { BSON("_id" << 0 << "a" << 1 << "b" << 1), &cq).isOK()); ASSERT(NULL != cq); - boost::scoped_ptr killCq(cq); + std::unique_ptr killCq(cq); // Takes ownership of cq. QuerySolution* soln = pickBestPlan(cq); @@ -393,7 +392,7 @@ namespace PlanRankingTests { CanonicalQuery* cq; verify(CanonicalQuery::canonicalize(ns, BSON("a" << N + 1 << "b" << 1), &cq).isOK()); ASSERT(NULL != cq); - boost::scoped_ptr killCq(cq); + std::unique_ptr killCq(cq); // {a: 100} is super selective so choose that. // Takes ownership of cq. @@ -430,7 +429,7 @@ namespace PlanRankingTests { verify(CanonicalQuery::canonicalize(ns, BSON("a" << BSON("$gte" << N + 1) << "b" << 1), &cq).isOK()); ASSERT(NULL != cq); - boost::scoped_ptr killCq(cq); + std::unique_ptr killCq(cq); // {a: 100} is super selective so choose that. // Takes ownership of cq. @@ -465,7 +464,7 @@ namespace PlanRankingTests { sortObj, projObj, &cq).isOK()); - boost::scoped_ptr killCq(cq); + std::unique_ptr killCq(cq); // Takes ownership of cq. QuerySolution* soln = pickBestPlan(cq); @@ -494,7 +493,7 @@ namespace PlanRankingTests { CanonicalQuery* cq; verify(CanonicalQuery::canonicalize(ns, BSON("foo" << 2001), &cq).isOK()); ASSERT(NULL != cq); - boost::scoped_ptr killCq(cq); + std::unique_ptr killCq(cq); // Takes ownership of cq. QuerySolution* soln = pickBestPlan(cq); @@ -531,7 +530,7 @@ namespace PlanRankingTests { BSON("_id" << 0 << "a" << 1 << "b" << 1), &cq).isOK()); ASSERT(NULL != cq); - boost::scoped_ptr killCq(cq); + std::unique_ptr killCq(cq); // We should choose an ixisect plan because it requires fewer fetches. // Takes ownership of cq. @@ -568,7 +567,7 @@ namespace PlanRankingTests { BSON("a" << 1 << "b" << 1), &cq).isOK()); ASSERT(NULL != cq); - boost::scoped_ptr killCq(cq); + std::unique_ptr killCq(cq); // The intersection is large, and ixisect does not make the // query covered. We should NOT choose an intersection plan. @@ -620,7 +619,7 @@ namespace PlanRankingTests { fromjson("{a: 1, b: 1}"), &cq).isOK()); ASSERT(NULL != cq); - boost::scoped_ptr killCq(cq); + std::unique_ptr killCq(cq); QuerySolution* soln = pickBestPlan(cq); ASSERT(QueryPlannerTestLib::solutionMatches( @@ -661,7 +660,7 @@ namespace PlanRankingTests { fromjson("{a: 1, b: 1}"), &cq).isOK()); ASSERT(NULL != cq); - boost::scoped_ptr killCq(cq); + std::unique_ptr killCq(cq); // Choose the index intersection plan. QuerySolution* soln = pickBestPlan(cq); @@ -704,7 +703,7 @@ namespace PlanRankingTests { fromjson("{a: 1, b: 1, c: 1}"), &cq).isOK()); ASSERT(NULL != cq); - boost::scoped_ptr killCq(cq); + std::unique_ptr killCq(cq); // Intersection between 'b' and 'c' should hit EOF while the // other plans are busy fetching documents. @@ -742,7 +741,7 @@ namespace PlanRankingTests { BSONObj(), // projection &cq).isOK()); ASSERT(NULL != cq); - boost::scoped_ptr killCq(cq); + std::unique_ptr killCq(cq); // No results will be returned during the trial period, // so we expect to choose {d: 1, e: 1}, as it allows us @@ -779,7 +778,7 @@ namespace PlanRankingTests { fromjson("{a: 1, b: 1, c: {$gte: 5000}}"), &cq).isOK()); ASSERT(NULL != cq); - boost::scoped_ptr killCq(cq); + std::unique_ptr killCq(cq); // Use index on 'b'. QuerySolution* soln = pickBestPlan(cq); @@ -812,7 +811,7 @@ namespace PlanRankingTests { fromjson("{a: 9, b: {$ne: 10}, c: 9}"), &cq).isOK()); ASSERT(NULL != cq); - boost::scoped_ptr killCq(cq); + std::unique_ptr killCq(cq); // Expect to use index {a: 1, b: 1}. QuerySolution* soln = pickBestPlan(cq); diff --git a/src/mongo/dbtests/query_multi_plan_runner.cpp b/src/mongo/dbtests/query_multi_plan_runner.cpp index c43b5ab111b..6e033631f02 100644 --- a/src/mongo/dbtests/query_multi_plan_runner.cpp +++ b/src/mongo/dbtests/query_multi_plan_runner.cpp @@ -26,7 +26,6 @@ * then also delete it in the license file. */ -#include #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" @@ -57,7 +56,7 @@ namespace mongo { namespace QueryMultiPlanRunner { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::vector; @@ -170,7 +169,7 @@ namespace QueryMultiPlanRunner { Status status = PlanExecutor::make(&_txn, sharedWs.release(), mps, cq, coll, PlanExecutor::YIELD_MANUAL, &rawExec); ASSERT_OK(status); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); // Get all our results out. int results = 0; @@ -207,7 +206,7 @@ namespace QueryMultiPlanRunner { BSONObj(), // proj &cq).isOK()); ASSERT(NULL != cq); - boost::scoped_ptr killCq(cq); + std::unique_ptr killCq(cq); // Force index intersection. bool forceIxisectOldValue = internalQueryForceIntersectionPlans; @@ -229,8 +228,8 @@ namespace QueryMultiPlanRunner { ASSERT_EQUALS(solutions.size(), 3U); // Fill out the MultiPlanStage. - scoped_ptr mps(new MultiPlanStage(&_txn, collection, cq)); - scoped_ptr ws(new WorkingSet()); + unique_ptr mps(new MultiPlanStage(&_txn, collection, cq)); + unique_ptr ws(new WorkingSet()); // Put each solution from the planner into the MPR. for (size_t i = 0; i < solutions.size(); ++i) { PlanStage* root; diff --git a/src/mongo/dbtests/query_plan_executor.cpp b/src/mongo/dbtests/query_plan_executor.cpp index e79c9980898..137ee3b9984 100644 --- a/src/mongo/dbtests/query_plan_executor.cpp +++ b/src/mongo/dbtests/query_plan_executor.cpp @@ -26,7 +26,6 @@ * then also delete it in the license file. */ -#include #include #include "mongo/db/catalog/collection.h" @@ -51,7 +50,7 @@ namespace QueryPlanExecutor { - using boost::scoped_ptr; + using std::unique_ptr; using boost::shared_ptr; using std::unique_ptr; using std::string; @@ -210,7 +209,7 @@ namespace QueryPlanExecutor { BSONObj filterObj = fromjson("{_id: {$gt: 0}}"); Collection* coll = ctx.getCollection(); - scoped_ptr exec(makeCollScanExec(coll, filterObj)); + unique_ptr exec(makeCollScanExec(coll, filterObj)); registerExec(exec.get()); BSONObj objOut; @@ -239,7 +238,7 @@ namespace QueryPlanExecutor { BSONObj indexSpec = BSON("a" << 1); addIndex(indexSpec); - scoped_ptr exec(makeIndexScanExec(ctx.db(), indexSpec, 7, 10)); + unique_ptr exec(makeIndexScanExec(ctx.db(), indexSpec, 7, 10)); registerExec(exec.get()); BSONObj objOut; @@ -293,7 +292,7 @@ namespace QueryPlanExecutor { Status status = PlanExecutor::make(&_txn, ws.release(), proxy.release(), collection, PlanExecutor::YIELD_MANUAL, &rawExec); ASSERT_OK(status); - boost::scoped_ptr outerExec(rawExec); + std::unique_ptr outerExec(rawExec); // Only the outer executor gets registered. registerExec(outerExec.get()); @@ -363,7 +362,7 @@ namespace QueryPlanExecutor { BSONObj filterObj = fromjson("{a: {$gte: 2}}"); Collection* coll = ctx.getCollection(); - scoped_ptr exec(makeCollScanExec(coll, filterObj)); + unique_ptr exec(makeCollScanExec(coll, filterObj)); BSONObj objOut; ASSERT_EQUALS(PlanExecutor::ADVANCED, exec->getNext(&objOut, NULL)); @@ -390,7 +389,7 @@ namespace QueryPlanExecutor { addIndex(indexSpec); BSONObj filterObj = fromjson("{a: {$gte: 2}}"); - scoped_ptr exec(makeIndexScanExec(ctx.db(), indexSpec, 2, 5)); + unique_ptr exec(makeIndexScanExec(ctx.db(), indexSpec, 2, 5)); BSONObj objOut; ASSERT_EQUALS(PlanExecutor::ADVANCED, exec->getNext(&objOut, NULL)); diff --git a/src/mongo/dbtests/query_stage_and.cpp b/src/mongo/dbtests/query_stage_and.cpp index 8b59cc7304b..5b421b5807a 100644 --- a/src/mongo/dbtests/query_stage_and.cpp +++ b/src/mongo/dbtests/query_stage_and.cpp @@ -31,7 +31,6 @@ * so we cannot test it outside of a dbtest. */ -#include #include #include "mongo/client/dbclientcursor.h" @@ -54,7 +53,7 @@ namespace QueryStageAnd { - using boost::scoped_ptr; + using std::unique_ptr; using boost::shared_ptr; using std::unique_ptr; using std::set; @@ -179,7 +178,7 @@ namespace QueryStageAnd { addIndex(BSON("bar" << 1)); WorkingSet ws; - scoped_ptr ah(new AndHashStage(&ws, NULL, coll)); + unique_ptr ah(new AndHashStage(&ws, NULL, coll)); // Foo <= 20 IndexScanParams params; @@ -283,7 +282,7 @@ namespace QueryStageAnd { addIndex(BSON("baz" << 1)); WorkingSet ws; - scoped_ptr ah(new AndHashStage(&ws, NULL, coll)); + unique_ptr ah(new AndHashStage(&ws, NULL, coll)); // Foo <= 20 (descending) IndexScanParams params; @@ -370,7 +369,7 @@ namespace QueryStageAnd { addIndex(BSON("bar" << 1)); WorkingSet ws; - scoped_ptr ah(new AndHashStage(&ws, NULL, coll)); + unique_ptr ah(new AndHashStage(&ws, NULL, coll)); // Foo <= 20 IndexScanParams params; @@ -425,7 +424,7 @@ namespace QueryStageAnd { // before hashed AND is done reading the first child (stage has to // hold 21 keys in buffer for Foo <= 20). WorkingSet ws; - scoped_ptr ah(new AndHashStage(&ws, NULL, coll, 20 * big.size())); + unique_ptr ah(new AndHashStage(&ws, NULL, coll, 20 * big.size())); // Foo <= 20 IndexScanParams params; @@ -478,7 +477,7 @@ namespace QueryStageAnd { // keys in last child's index are not buffered. There are 6 keys // that satisfy the criteria Foo <= 20 and Bar >= 10 and 5 <= baz <= 15. WorkingSet ws; - scoped_ptr ah(new AndHashStage(&ws, NULL, coll, 5 * big.size())); + unique_ptr ah(new AndHashStage(&ws, NULL, coll, 5 * big.size())); // Foo <= 20 IndexScanParams params; @@ -526,7 +525,7 @@ namespace QueryStageAnd { addIndex(BSON("baz" << 1)); WorkingSet ws; - scoped_ptr ah(new AndHashStage(&ws, NULL, coll)); + unique_ptr ah(new AndHashStage(&ws, NULL, coll)); // Foo <= 20 IndexScanParams params; @@ -593,7 +592,7 @@ namespace QueryStageAnd { // before hashed AND is done reading the second child (stage has to // hold 11 keys in buffer for Foo <= 20 and Bar >= 10). WorkingSet ws; - scoped_ptr ah(new AndHashStage(&ws, NULL, coll, 10 * big.size())); + unique_ptr ah(new AndHashStage(&ws, NULL, coll, 10 * big.size())); // Foo <= 20 IndexScanParams params; @@ -647,7 +646,7 @@ namespace QueryStageAnd { addIndex(BSON("bar" << 1)); WorkingSet ws; - scoped_ptr ah(new AndHashStage(&ws, NULL, coll)); + unique_ptr ah(new AndHashStage(&ws, NULL, coll)); // Foo <= 20 IndexScanParams params; @@ -708,7 +707,7 @@ namespace QueryStageAnd { addIndex(BSON("bar" << 1)); WorkingSet ws; - scoped_ptr ah(new AndHashStage(&ws, NULL, coll)); + unique_ptr ah(new AndHashStage(&ws, NULL, coll)); // Foo >= 100 IndexScanParams params; @@ -760,7 +759,7 @@ namespace QueryStageAnd { StatusWithMatchExpression swme = MatchExpressionParser::parse(filter); verify(swme.isOK()); unique_ptr filterExpr(swme.getValue()); - scoped_ptr ah(new AndHashStage(&ws, filterExpr.get(), coll)); + unique_ptr ah(new AndHashStage(&ws, filterExpr.get(), coll)); // Foo <= 20 IndexScanParams params; @@ -809,7 +808,7 @@ namespace QueryStageAnd { addIndex(BSON("bar" << 1)); WorkingSet ws; - scoped_ptr ah(new AndHashStage(&ws, NULL, coll)); + unique_ptr ah(new AndHashStage(&ws, NULL, coll)); // Foo <= 20 IndexScanParams params; @@ -868,7 +867,7 @@ namespace QueryStageAnd { addIndex(BSON("bar" << 1)); WorkingSet ws; - scoped_ptr ah(new AndHashStage(&ws, NULL, coll)); + unique_ptr ah(new AndHashStage(&ws, NULL, coll)); // Foo <= 20 IndexScanParams params; @@ -1069,7 +1068,7 @@ namespace QueryStageAnd { addIndex(BSON("bar" << 1)); WorkingSet ws; - scoped_ptr ah(new AndSortedStage(&ws, NULL, coll)); + unique_ptr ah(new AndSortedStage(&ws, NULL, coll)); // Scan over foo == 1 IndexScanParams params; @@ -1196,7 +1195,7 @@ namespace QueryStageAnd { addIndex(BSON("baz" << 1)); WorkingSet ws; - scoped_ptr ah(new AndSortedStage(&ws, NULL, coll)); + unique_ptr ah(new AndSortedStage(&ws, NULL, coll)); // Scan over foo == 1 IndexScanParams params; @@ -1241,7 +1240,7 @@ namespace QueryStageAnd { addIndex(BSON("bar" << 1)); WorkingSet ws; - scoped_ptr ah(new AndSortedStage(&ws, NULL, coll)); + unique_ptr ah(new AndSortedStage(&ws, NULL, coll)); // Foo == 7. Should be EOF. IndexScanParams params; @@ -1290,7 +1289,7 @@ namespace QueryStageAnd { addIndex(BSON("bar" << 1)); WorkingSet ws; - scoped_ptr ah(new AndSortedStage(&ws, NULL, coll)); + unique_ptr ah(new AndSortedStage(&ws, NULL, coll)); // foo == 7. IndexScanParams params; @@ -1339,7 +1338,7 @@ namespace QueryStageAnd { StatusWithMatchExpression swme = MatchExpressionParser::parse(filterObj); verify(swme.isOK()); unique_ptr filterExpr(swme.getValue()); - scoped_ptr ah(new AndSortedStage(&ws, filterExpr.get(), coll)); + unique_ptr ah(new AndSortedStage(&ws, filterExpr.get(), coll)); // Scan over foo == 1 IndexScanParams params; @@ -1381,7 +1380,7 @@ namespace QueryStageAnd { addIndex(BSON("bar" << 1)); WorkingSet ws; - scoped_ptr ah(new AndHashStage(&ws, NULL, coll)); + unique_ptr ah(new AndHashStage(&ws, NULL, coll)); // Scan over foo == 1 IndexScanParams params; @@ -1445,7 +1444,7 @@ namespace QueryStageAnd { addIndex(BSON("bar" << 1)); WorkingSet ws; - scoped_ptr as(new AndSortedStage(&ws, NULL, coll)); + unique_ptr as(new AndSortedStage(&ws, NULL, coll)); // Scan over foo == 1 IndexScanParams params; @@ -1499,7 +1498,7 @@ namespace QueryStageAnd { addIndex(BSON("bar" << 1)); WorkingSet ws; - scoped_ptr as(new AndSortedStage(&ws, NULL, coll)); + unique_ptr as(new AndSortedStage(&ws, NULL, coll)); // Scan over foo == 1 IndexScanParams params; diff --git a/src/mongo/dbtests/query_stage_collscan.cpp b/src/mongo/dbtests/query_stage_collscan.cpp index ffb204c2623..b190e852df8 100644 --- a/src/mongo/dbtests/query_stage_collscan.cpp +++ b/src/mongo/dbtests/query_stage_collscan.cpp @@ -30,7 +30,6 @@ * This file tests db/exec/collection_scan.cpp. */ -#include #include "mongo/client/dbclientcursor.h" #include "mongo/db/catalog/collection.h" @@ -49,7 +48,7 @@ namespace QueryStageCollectionScan { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::vector; @@ -100,7 +99,7 @@ namespace QueryStageCollectionScan { Status status = PlanExecutor::make(&_txn, ws, ps, params.collection, PlanExecutor::YIELD_MANUAL, &rawExec); ASSERT_OK(status); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); // Use the runner to count the number of objects scanned. int count = 0; @@ -118,7 +117,7 @@ namespace QueryStageCollectionScan { params.direction = direction; params.tailable = false; - scoped_ptr scan(new CollectionScan(&_txn, params, &ws, NULL)); + unique_ptr scan(new CollectionScan(&_txn, params, &ws, NULL)); while (!scan->isEOF()) { WorkingSetID id = WorkingSet::INVALID_ID; PlanStage::StageState state = scan->work(&id); @@ -210,7 +209,7 @@ namespace QueryStageCollectionScan { Status status = PlanExecutor::make(&_txn, ws, ps, params.collection, PlanExecutor::YIELD_MANUAL, &rawExec); ASSERT_OK(status); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); int count = 0; for (BSONObj obj; PlanExecutor::ADVANCED == exec->getNext(&obj, NULL); ) { @@ -244,7 +243,7 @@ namespace QueryStageCollectionScan { Status status = PlanExecutor::make(&_txn, ws, ps, params.collection, PlanExecutor::YIELD_MANUAL, &rawExec); ASSERT_OK(status); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); int count = 0; for (BSONObj obj; PlanExecutor::ADVANCED == exec->getNext(&obj, NULL); ) { @@ -279,7 +278,7 @@ namespace QueryStageCollectionScan { params.tailable = false; WorkingSet ws; - scoped_ptr scan(new CollectionScan(&_txn, params, &ws, NULL)); + unique_ptr scan(new CollectionScan(&_txn, params, &ws, NULL)); int count = 0; while (count < 10) { @@ -340,7 +339,7 @@ namespace QueryStageCollectionScan { params.tailable = false; WorkingSet ws; - scoped_ptr scan(new CollectionScan(&_txn, params, &ws, NULL)); + unique_ptr scan(new CollectionScan(&_txn, params, &ws, NULL)); int count = 0; while (count < 10) { diff --git a/src/mongo/dbtests/query_stage_count.cpp b/src/mongo/dbtests/query_stage_count.cpp index 7adc5b6996f..09f64990bda 100644 --- a/src/mongo/dbtests/query_stage_count.cpp +++ b/src/mongo/dbtests/query_stage_count.cpp @@ -26,7 +26,6 @@ * it in the license file. */ -#include #include #include "mongo/db/db_raii.h" @@ -43,7 +42,7 @@ namespace QueryStageCount { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::vector; @@ -97,7 +96,7 @@ namespace QueryStageCount { params.direction = CollectionScanParams::FORWARD; params.tailable = false; - scoped_ptr scan(new CollectionScan(&_txn, params, &ws, NULL)); + unique_ptr scan(new CollectionScan(&_txn, params, &ws, NULL)); while (!scan->isEOF()) { WorkingSetID id = WorkingSet::INVALID_ID; PlanStage::StageState state = scan->work(&id); diff --git a/src/mongo/dbtests/query_stage_delete.cpp b/src/mongo/dbtests/query_stage_delete.cpp index f5c8ec18913..624be2a75f4 100644 --- a/src/mongo/dbtests/query_stage_delete.cpp +++ b/src/mongo/dbtests/query_stage_delete.cpp @@ -30,7 +30,6 @@ * This file tests db/exec/delete.cpp. */ -#include #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" @@ -47,7 +46,7 @@ namespace QueryStageDelete { - using boost::scoped_ptr; + using std::unique_ptr; using std::vector; // @@ -86,7 +85,7 @@ namespace QueryStageDelete { params.direction = direction; params.tailable = false; - scoped_ptr scan(new CollectionScan(&_txn, params, &ws, NULL)); + unique_ptr scan(new CollectionScan(&_txn, params, &ws, NULL)); while (!scan->isEOF()) { WorkingSetID id = WorkingSet::INVALID_ID; PlanStage::StageState state = scan->work(&id); diff --git a/src/mongo/dbtests/query_stage_ixscan.cpp b/src/mongo/dbtests/query_stage_ixscan.cpp index e56ba1128f4..e6e78f8b824 100644 --- a/src/mongo/dbtests/query_stage_ixscan.cpp +++ b/src/mongo/dbtests/query_stage_ixscan.cpp @@ -181,7 +181,7 @@ namespace QueryStageIxscan { insert(fromjson("{_id: 2, x: 6}")); insert(fromjson("{_id: 3, x: 12}")); - boost::scoped_ptr ixscan(createIndexScan(BSON("x" << 5), + std::unique_ptr ixscan(createIndexScan(BSON("x" << 5), BSON("x" << 10), true, true)); @@ -220,7 +220,7 @@ namespace QueryStageIxscan { insert(fromjson("{_id: 2, x: 6}")); insert(fromjson("{_id: 3, x: 10}")); - boost::scoped_ptr ixscan(createIndexScan(BSON("x" << 5), + std::unique_ptr ixscan(createIndexScan(BSON("x" << 5), BSON("x" << 10), false, false)); @@ -255,7 +255,7 @@ namespace QueryStageIxscan { insert(fromjson("{_id: 2, x: 6}")); insert(fromjson("{_id: 3, x: 12}")); - boost::scoped_ptr ixscan(createIndexScan(BSON("x" << 5), + std::unique_ptr ixscan(createIndexScan(BSON("x" << 5), BSON("x" << 10), false, false)); @@ -287,7 +287,7 @@ namespace QueryStageIxscan { insert(fromjson("{_id: 2, x: 8}")); insert(fromjson("{_id: 3, x: 3}")); - boost::scoped_ptr ixscan(createIndexScan(BSON("x" << 10), + std::unique_ptr ixscan(createIndexScan(BSON("x" << 10), BSON("x" << 5), true, true, diff --git a/src/mongo/dbtests/query_stage_limit_skip.cpp b/src/mongo/dbtests/query_stage_limit_skip.cpp index afb4436e4b9..b7561d12f8b 100644 --- a/src/mongo/dbtests/query_stage_limit_skip.cpp +++ b/src/mongo/dbtests/query_stage_limit_skip.cpp @@ -30,7 +30,6 @@ * This file tests db/exec/limit.cpp and db/exec/skip.cpp. */ -#include #include "mongo/client/dbclientcursor.h" #include "mongo/db/exec/limit.h" @@ -45,7 +44,7 @@ using namespace mongo; namespace { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::max; using std::min; @@ -89,10 +88,10 @@ namespace { for (int i = 0; i < 2 * N; ++i) { WorkingSet ws; - scoped_ptr skip(new SkipStage(i, &ws, getMS(&ws))); + unique_ptr skip(new SkipStage(i, &ws, getMS(&ws))); ASSERT_EQUALS(max(0, N - i), countResults(skip.get())); - scoped_ptr limit(new LimitStage(i, &ws, getMS(&ws))); + unique_ptr limit(new LimitStage(i, &ws, getMS(&ws))); ASSERT_EQUALS(min(N, i), countResults(limit.get())); } } diff --git a/src/mongo/dbtests/query_stage_merge_sort.cpp b/src/mongo/dbtests/query_stage_merge_sort.cpp index f4fa4ea9bd7..b05799b8588 100644 --- a/src/mongo/dbtests/query_stage_merge_sort.cpp +++ b/src/mongo/dbtests/query_stage_merge_sort.cpp @@ -159,7 +159,7 @@ namespace QueryStageMergeSortTests { Status status = PlanExecutor::make(&_txn, ws, new FetchStage(&_txn, ws, ms, NULL, coll), coll, PlanExecutor::YIELD_MANUAL, &rawExec); ASSERT_OK(status); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); for (int i = 0; i < N; ++i) { BSONObj first, second; @@ -227,7 +227,7 @@ namespace QueryStageMergeSortTests { Status status = PlanExecutor::make(&_txn, ws, new FetchStage(&_txn, ws, ms, NULL, coll), coll, PlanExecutor::YIELD_MANUAL, &rawExec); ASSERT_OK(status); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); for (int i = 0; i < N; ++i) { BSONObj first, second; @@ -295,7 +295,7 @@ namespace QueryStageMergeSortTests { Status status = PlanExecutor::make(&_txn, ws, new FetchStage(&_txn, ws, ms, NULL, coll), coll, PlanExecutor::YIELD_MANUAL, &rawExec); ASSERT_OK(status); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); for (int i = 0; i < N; ++i) { BSONObj first, second; @@ -366,7 +366,7 @@ namespace QueryStageMergeSortTests { Status status = PlanExecutor::make(&_txn, ws, new FetchStage(&_txn, ws, ms, NULL, coll), coll, PlanExecutor::YIELD_MANUAL, &rawExec); ASSERT_OK(status); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); for (int i = 0; i < N; ++i) { BSONObj first, second; @@ -436,7 +436,7 @@ namespace QueryStageMergeSortTests { Status status = PlanExecutor::make(&_txn, ws, new FetchStage(&_txn, ws, ms, NULL, coll), coll, PlanExecutor::YIELD_MANUAL, &rawExec); ASSERT_OK(status); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); // Only getting results from the a:1 index scan. for (int i = 0; i < N; ++i) { @@ -494,7 +494,7 @@ namespace QueryStageMergeSortTests { Status status = PlanExecutor::make(&_txn, ws, new FetchStage(&_txn, ws, ms, NULL, coll), coll, PlanExecutor::YIELD_MANUAL, &rawExec); ASSERT_OK(status); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); for (int i = 0; i < numIndices; ++i) { BSONObj obj; diff --git a/src/mongo/dbtests/query_stage_sort.cpp b/src/mongo/dbtests/query_stage_sort.cpp index b9b34bda21f..eac35313223 100644 --- a/src/mongo/dbtests/query_stage_sort.cpp +++ b/src/mongo/dbtests/query_stage_sort.cpp @@ -161,7 +161,7 @@ namespace QueryStageSortTests { new SortStage(params, ws, ms), NULL, coll), coll, PlanExecutor::YIELD_MANUAL, &rawExec); ASSERT_OK(status); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); // Look at pairs of objects to make sure that the sort order is pairwise (and therefore // totally) correct. @@ -533,7 +533,7 @@ namespace QueryStageSortTests { ws, new SortStage(params, ws, ms), NULL, coll), coll, PlanExecutor::YIELD_MANUAL, &rawExec); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); PlanExecutor::ExecState runnerState = exec->getNext(NULL, NULL); ASSERT_EQUALS(PlanExecutor::FAILURE, runnerState); diff --git a/src/mongo/dbtests/query_stage_subplan.cpp b/src/mongo/dbtests/query_stage_subplan.cpp index f7cd4e8ba51..d5afbbabc7b 100644 --- a/src/mongo/dbtests/query_stage_subplan.cpp +++ b/src/mongo/dbtests/query_stage_subplan.cpp @@ -85,7 +85,7 @@ namespace QueryStageSubplan { CanonicalQuery* rawCq; ASSERT_OK(CanonicalQuery::canonicalize(ns(), query, &rawCq)); - boost::scoped_ptr cq(rawCq); + std::unique_ptr cq(rawCq); Collection* collection = ctx.getCollection(); @@ -94,7 +94,7 @@ namespace QueryStageSubplan { fillOutPlannerParams(&_txn, collection, cq.get(), &plannerParams); WorkingSet ws; - boost::scoped_ptr subplan(new SubplanStage(&_txn, collection, &ws, + std::unique_ptr subplan(new SubplanStage(&_txn, collection, &ws, plannerParams, cq.get())); // Plan selection should succeed due to falling back on regular planning. @@ -128,14 +128,14 @@ namespace QueryStageSubplan { CanonicalQuery* rawCq; ASSERT_OK(CanonicalQuery::canonicalize(ns(), query, &rawCq)); - boost::scoped_ptr cq(rawCq); + std::unique_ptr cq(rawCq); // Get planner params. QueryPlannerParams plannerParams; fillOutPlannerParams(&_txn, collection, cq.get(), &plannerParams); WorkingSet ws; - boost::scoped_ptr subplan(new SubplanStage(&_txn, collection, &ws, + std::unique_ptr subplan(new SubplanStage(&_txn, collection, &ws, plannerParams, cq.get())); PlanYieldPolicy yieldPolicy(NULL, PlanExecutor::YIELD_MANUAL); diff --git a/src/mongo/dbtests/query_stage_tests.cpp b/src/mongo/dbtests/query_stage_tests.cpp index c5365d140ae..4bf744f705d 100644 --- a/src/mongo/dbtests/query_stage_tests.cpp +++ b/src/mongo/dbtests/query_stage_tests.cpp @@ -90,7 +90,7 @@ namespace QueryStageTests { PlanExecutor::YIELD_MANUAL, &rawExec); ASSERT_OK(status); - boost::scoped_ptr exec(rawExec); + std::unique_ptr exec(rawExec); int count = 0; for (RecordId dl; PlanExecutor::ADVANCED == exec->getNext(NULL, &dl); ) { diff --git a/src/mongo/dbtests/query_stage_update.cpp b/src/mongo/dbtests/query_stage_update.cpp index 92f95f5fdb6..edc3c952fca 100644 --- a/src/mongo/dbtests/query_stage_update.cpp +++ b/src/mongo/dbtests/query_stage_update.cpp @@ -30,7 +30,6 @@ * This file tests db/exec/update.cpp (UpdateStage). */ -#include #include "mongo/db/catalog/collection.h" #include "mongo/db/catalog/database.h" @@ -54,7 +53,7 @@ namespace QueryStageUpdate { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::vector; @@ -120,7 +119,7 @@ namespace QueryStageUpdate { params.direction = CollectionScanParams::FORWARD; params.tailable = false; - scoped_ptr scan(new CollectionScan(&_txn, params, &ws, NULL)); + unique_ptr scan(new CollectionScan(&_txn, params, &ws, NULL)); while (!scan->isEOF()) { WorkingSetID id = WorkingSet::INVALID_ID; PlanStage::StageState state = scan->work(&id); @@ -142,7 +141,7 @@ namespace QueryStageUpdate { params.direction = direction; params.tailable = false; - scoped_ptr scan(new CollectionScan(&_txn, params, &ws, NULL)); + unique_ptr scan(new CollectionScan(&_txn, params, &ws, NULL)); while (!scan->isEOF()) { WorkingSetID id = WorkingSet::INVALID_ID; PlanStage::StageState state = scan->work(&id); @@ -215,13 +214,13 @@ namespace QueryStageUpdate { // Setup update params. UpdateStageParams params(&request, &driver, opDebug); - scoped_ptr cq(canonicalize(query)); + unique_ptr cq(canonicalize(query)); params.canonicalQuery = cq.get(); - scoped_ptr ws(new WorkingSet()); + unique_ptr ws(new WorkingSet()); unique_ptr eofStage(new EOFStage()); - scoped_ptr updateStage( + unique_ptr updateStage( new UpdateStage(&_txn, params, ws.get(), collection, eofStage.release())); runUpdate(updateStage.get()); @@ -292,14 +291,14 @@ namespace QueryStageUpdate { // Configure the update. UpdateStageParams updateParams(&request, &driver, opDebug); - scoped_ptr cq(canonicalize(query)); + unique_ptr cq(canonicalize(query)); updateParams.canonicalQuery = cq.get(); - scoped_ptr ws(new WorkingSet()); + unique_ptr ws(new WorkingSet()); unique_ptr cs( new CollectionScan(&_txn, collScanParams, ws.get(), cq->root())); - scoped_ptr updateStage( + unique_ptr updateStage( new UpdateStage(&_txn, updateParams, ws.get(), coll, cs.release())); const UpdateStats* stats = diff --git a/src/mongo/dbtests/replica_set_monitor_test.cpp b/src/mongo/dbtests/replica_set_monitor_test.cpp index 33d489b2973..12b814f4ad2 100644 --- a/src/mongo/dbtests/replica_set_monitor_test.cpp +++ b/src/mongo/dbtests/replica_set_monitor_test.cpp @@ -35,7 +35,6 @@ #include "mongo/dbtests/mock/mock_replica_set.h" #include "mongo/unittest/unittest.h" -#include #include #include @@ -47,7 +46,7 @@ namespace { using std::vector; using std::set; using std::string; - using boost::scoped_ptr; + using std::unique_ptr; // TODO: Port these existing tests here: replmonitor_bad_seed.js, repl_monitor_refresh.js @@ -77,7 +76,7 @@ namespace { private: ConnectionString::ConnectionHook* _originalConnectionHook; - boost::scoped_ptr _replSet; + std::unique_ptr _replSet; }; TEST_F(ReplicaSetMonitorTest, SeedWithPriOnlySecDown) { @@ -245,7 +244,7 @@ namespace { private: ConnectionString::ConnectionHook* _originalConnectionHook; - boost::scoped_ptr _replSet; + std::unique_ptr _replSet; }; // Tests the case where the connection to secondary went bad and the replica set diff --git a/src/mongo/dbtests/rollbacktests.cpp b/src/mongo/dbtests/rollbacktests.cpp index 74078abf1b1..cd832d9dba8 100644 --- a/src/mongo/dbtests/rollbacktests.cpp +++ b/src/mongo/dbtests/rollbacktests.cpp @@ -28,7 +28,6 @@ * then also delete it in the license file. */ -#include #include "mongo/bson/bsonobj.h" #include "mongo/db/catalog/collection.h" @@ -42,7 +41,7 @@ #include "mongo/dbtests/dbtests.h" #include "mongo/unittest/unittest.h" -using boost::scoped_ptr; +using std::unique_ptr; using std::list; using std::string; diff --git a/src/mongo/logger/console_appender.h b/src/mongo/logger/console_appender.h index bf5072cdea8..36cc6b5c85d 100644 --- a/src/mongo/logger/console_appender.h +++ b/src/mongo/logger/console_appender.h @@ -27,7 +27,6 @@ #pragma once -#include #include "mongo/base/disallow_copying.h" #include "mongo/base/status.h" @@ -58,7 +57,7 @@ namespace logger { } private: - boost::scoped_ptr _encoder; + std::unique_ptr _encoder; }; } // namespace logger diff --git a/src/mongo/logger/log_domain.h b/src/mongo/logger/log_domain.h index 715e5822ed0..0313985b2f1 100644 --- a/src/mongo/logger/log_domain.h +++ b/src/mongo/logger/log_domain.h @@ -27,7 +27,6 @@ #pragma once -#include #include #include #include diff --git a/src/mongo/logger/message_log_domain.h b/src/mongo/logger/message_log_domain.h index d5bbc45e951..967856c88dd 100644 --- a/src/mongo/logger/message_log_domain.h +++ b/src/mongo/logger/message_log_domain.h @@ -27,7 +27,6 @@ #pragma once -#include #include #include #include diff --git a/src/mongo/logger/rotatable_file_appender.h b/src/mongo/logger/rotatable_file_appender.h index 777ef4f7fbf..3a2523a8297 100644 --- a/src/mongo/logger/rotatable_file_appender.h +++ b/src/mongo/logger/rotatable_file_appender.h @@ -27,7 +27,6 @@ #pragma once -#include #include "mongo/base/disallow_copying.h" #include "mongo/base/status.h" @@ -67,7 +66,7 @@ namespace logger { } private: - boost::scoped_ptr _encoder; + std::unique_ptr _encoder; RotatableFileWriter* _writer; }; diff --git a/src/mongo/logger/rotatable_file_writer.cpp b/src/mongo/logger/rotatable_file_writer.cpp index 5ed1ef27be5..f657f42c18d 100644 --- a/src/mongo/logger/rotatable_file_writer.cpp +++ b/src/mongo/logger/rotatable_file_writer.cpp @@ -239,7 +239,7 @@ namespace { } // namespace #endif - RotatableFileWriter::RotatableFileWriter() : _stream(NULL) {} + RotatableFileWriter::RotatableFileWriter() : _stream(nullptr) {} RotatableFileWriter::Use::Use(RotatableFileWriter* writer) : _writer(writer), @@ -299,7 +299,7 @@ namespace { using std::swap; #ifdef _WIN32 - boost::scoped_ptr newStream( + std::unique_ptr newStream( new Win32FileOStream(_writer->_fileName, append)); #else std::ios::openmode mode = std::ios::out; @@ -309,7 +309,7 @@ namespace { else { mode |= std::ios::trunc; } - boost::scoped_ptr newStream( + std::unique_ptr newStream( new std::ofstream(_writer->_fileName.c_str(), mode)); #endif diff --git a/src/mongo/logger/rotatable_file_writer.h b/src/mongo/logger/rotatable_file_writer.h index 59440b38ff8..aee5af4ed42 100644 --- a/src/mongo/logger/rotatable_file_writer.h +++ b/src/mongo/logger/rotatable_file_writer.h @@ -27,7 +27,6 @@ #pragma once -#include #include #include @@ -122,7 +121,7 @@ namespace logger { friend class RotatableFileWriter::Use; boost::mutex _mutex; std::string _fileName; - boost::scoped_ptr _stream; + std::unique_ptr _stream; }; } // namespace logger diff --git a/src/mongo/logger/syslog_appender.h b/src/mongo/logger/syslog_appender.h index 50ce6661002..df0ba489fdf 100644 --- a/src/mongo/logger/syslog_appender.h +++ b/src/mongo/logger/syslog_appender.h @@ -29,7 +29,6 @@ #ifndef _WIN32 // TODO(schwerin): Should be #if MONGO_CONFIG_HAVE_SYSLOG_H? -#include #include #include @@ -74,7 +73,7 @@ namespace logger { // Info() and Log(). return LOG_INFO; } - boost::scoped_ptr _encoder; + std::unique_ptr _encoder; }; } // namespace logger diff --git a/src/mongo/s/balance.cpp b/src/mongo/s/balance.cpp index 89104383807..5275fe25c98 100644 --- a/src/mongo/s/balance.cpp +++ b/src/mongo/s/balance.cpp @@ -33,7 +33,6 @@ #include "mongo/s/balance.h" #include -#include #include "mongo/client/dbclientcursor.h" #include "mongo/db/client.h" @@ -65,7 +64,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using boost::shared_ptr; using std::unique_ptr; using std::map; diff --git a/src/mongo/s/balance.h b/src/mongo/s/balance.h index 9654207e4e2..596ad5ea239 100644 --- a/src/mongo/s/balance.h +++ b/src/mongo/s/balance.h @@ -30,7 +30,6 @@ #pragma once -#include #include #include "mongo/util/background.h" @@ -73,7 +72,7 @@ namespace mongo { int _balancedLastTime; // decide which chunks to move; owned here. - boost::scoped_ptr _policy; + std::unique_ptr _policy; /** * Checks that the balancer can connect to all servers it needs to do its job. diff --git a/src/mongo/s/catalog/legacy/cluster_client_internal.cpp b/src/mongo/s/catalog/legacy/cluster_client_internal.cpp index 3ad791e13ce..d4d92cc4ded 100644 --- a/src/mongo/s/catalog/legacy/cluster_client_internal.cpp +++ b/src/mongo/s/catalog/legacy/cluster_client_internal.cpp @@ -32,7 +32,6 @@ #include "mongo/s/catalog/legacy/cluster_client_internal.h" -#include #include #include "mongo/client/connpool.h" @@ -45,7 +44,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::endl; using std::string; @@ -55,7 +54,7 @@ namespace mongo { Status checkClusterMongoVersions(CatalogManager* catalogManager, const string& minMongoVersion) { - scoped_ptr connPtr; + unique_ptr connPtr; // // Find mongos pings in config server @@ -64,7 +63,7 @@ namespace mongo { try { connPtr.reset(new ScopedDbConnection(catalogManager->connectionString(), 30)); ScopedDbConnection& conn = *connPtr; - scoped_ptr cursor(_safeCursor(conn->query(MongosType::ConfigNS, + unique_ptr cursor(_safeCursor(conn->query(MongosType::ConfigNS, Query()))); while (cursor->more()) { @@ -178,7 +177,7 @@ namespace mongo { log() << "checking that version of host " << serverLoc << " is compatible with " << minMongoVersion << endl; - scoped_ptr serverConnPtr; + unique_ptr serverConnPtr; bool resultOk; BSONObj buildInfo; diff --git a/src/mongo/s/catalog/legacy/config_upgrade.cpp b/src/mongo/s/catalog/legacy/config_upgrade.cpp index 8fb25a4507a..2ed119d914f 100644 --- a/src/mongo/s/catalog/legacy/config_upgrade.cpp +++ b/src/mongo/s/catalog/legacy/config_upgrade.cpp @@ -32,7 +32,6 @@ #include "mongo/s/catalog/legacy/config_upgrade.h" -#include #include "mongo/client/connpool.h" #include "mongo/client/dbclientcursor.h" @@ -53,7 +52,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::make_pair; using std::map; using std::string; @@ -362,7 +361,7 @@ namespace { ScopedDbConnection conn(catalogManager->connectionString(), 30); - scoped_ptr cursor(_safeCursor(conn->query("config.version", + unique_ptr cursor(_safeCursor(conn->query("config.version", BSONObj()))); bool hasConfigData = conn->count(ShardType::ConfigNS) diff --git a/src/mongo/s/catalog/legacy/config_upgrade_helpers.cpp b/src/mongo/s/catalog/legacy/config_upgrade_helpers.cpp index d6b300db8a1..64b6f201f3e 100644 --- a/src/mongo/s/catalog/legacy/config_upgrade_helpers.cpp +++ b/src/mongo/s/catalog/legacy/config_upgrade_helpers.cpp @@ -32,7 +32,6 @@ #include "mongo/s/catalog/legacy/config_upgrade_helpers.h" -#include #include "mongo/client/connpool.h" #include "mongo/db/field_parser.h" @@ -46,7 +45,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::endl; using std::string; diff --git a/src/mongo/s/catalog/legacy/distlock.cpp b/src/mongo/s/catalog/legacy/distlock.cpp index 48379989edc..4bd85c52517 100644 --- a/src/mongo/s/catalog/legacy/distlock.cpp +++ b/src/mongo/s/catalog/legacy/distlock.cpp @@ -31,7 +31,6 @@ #include "mongo/s/catalog/legacy/distlock.h" -#include #include "mongo/db/server_options.h" #include "mongo/client/dbclientcursor.h" @@ -44,7 +43,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::endl; using std::list; @@ -174,7 +173,7 @@ namespace mongo { string errMsg; Milliseconds delay{0}; - scoped_ptr connPtr; + unique_ptr connPtr; try { connPtr.reset( new ScopedDbConnection( server.toString() ) ); ScopedDbConnection& conn = *connPtr; @@ -791,7 +790,7 @@ namespace mongo { while ( ++attempted <= maxAttempts ) { // Awkward, but necessary since the constructor itself throws exceptions - scoped_ptr connPtr; + unique_ptr connPtr; try { diff --git a/src/mongo/s/chunk_manager.cpp b/src/mongo/s/chunk_manager.cpp index ed97da4a645..c02b0fc7e75 100644 --- a/src/mongo/s/chunk_manager.cpp +++ b/src/mongo/s/chunk_manager.cpp @@ -470,7 +470,7 @@ namespace { &canonicalQuery, WhereCallbackNoop()); - boost::scoped_ptr canonicalQueryPtr(canonicalQuery); + std::unique_ptr canonicalQueryPtr(canonicalQuery); uassert(status.code(), status.reason(), status.isOK()); diff --git a/src/mongo/s/client/dbclient_multi_command.cpp b/src/mongo/s/client/dbclient_multi_command.cpp index fba3bdfcf0e..99f6bde3a82 100644 --- a/src/mongo/s/client/dbclient_multi_command.cpp +++ b/src/mongo/s/client/dbclient_multi_command.cpp @@ -30,7 +30,6 @@ #include "mongo/s/client/dbclient_multi_command.h" -#include #include "mongo/db/audit.h" #include "mongo/db/dbmessage.h" @@ -41,7 +40,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::deque; using std::string; @@ -172,7 +171,7 @@ namespace mongo { Status DBClientMultiCommand::recvAny( ConnectionString* endpoint, BSONSerializable* response ) { - scoped_ptr command( _pendingCommands.front() ); + unique_ptr command( _pendingCommands.front() ); _pendingCommands.pop_front(); *endpoint = command->endpoint; diff --git a/src/mongo/s/client/multi_host_query_test.cpp b/src/mongo/s/client/multi_host_query_test.cpp index e44cd1ecd1f..b70dfe9d75a 100644 --- a/src/mongo/s/client/multi_host_query_test.cpp +++ b/src/mongo/s/client/multi_host_query_test.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include #include #include "mongo/base/status_with.h" @@ -39,7 +38,7 @@ namespace { using namespace mongo; - using boost::scoped_ptr; + using std::unique_ptr; using boost::shared_ptr; using std::make_pair; using std::map; @@ -399,12 +398,12 @@ namespace { Notification* nextHostActiveNotify; ConnectionString prevHost; - scoped_ptr prevHostActiveNotify; + unique_ptr prevHostActiveNotify; bool waitForPrevHostIdle; int queryTimeMillis; - scoped_ptr conn; + unique_ptr conn; Notification* hangUntilNotify; Status error; }; @@ -738,7 +737,7 @@ namespace { Notification unhangNotify; // Create a thread pool which detaches itself from outstanding work on cleanup - scoped_ptr threadPool(new HostThreadPools(1, false)); + unique_ptr threadPool(new HostThreadPools(1, false)); MockSystemEnv mockSystem(threadPool.get()); ConnectionString hostA = uassertStatusOK(ConnectionString::parse("$hostA:1000")); diff --git a/src/mongo/s/client/shard_connection_test.cpp b/src/mongo/s/client/shard_connection_test.cpp index ff55380ad44..70257bb217c 100644 --- a/src/mongo/s/client/shard_connection_test.cpp +++ b/src/mongo/s/client/shard_connection_test.cpp @@ -41,7 +41,6 @@ #include "mongo/unittest/unittest.h" #include -#include #include /** diff --git a/src/mongo/s/cluster_write.h b/src/mongo/s/cluster_write.h index e49509f2376..fce2f26564d 100644 --- a/src/mongo/s/cluster_write.h +++ b/src/mongo/s/cluster_write.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/s/write_ops/batch_write_exec.h" #include "mongo/s/write_ops/batched_command_request.h" @@ -52,7 +51,7 @@ namespace mongo { const bool _autoSplit; const int _timeoutMillis; - boost::scoped_ptr _stats; + std::unique_ptr _stats; }; class ClusterWriterStats { @@ -69,7 +68,7 @@ namespace mongo { private: - boost::scoped_ptr _shardStats; + std::unique_ptr _shardStats; }; /** diff --git a/src/mongo/s/collection_metadata_test.cpp b/src/mongo/s/collection_metadata_test.cpp index ac233249729..ed160ed5164 100644 --- a/src/mongo/s/collection_metadata_test.cpp +++ b/src/mongo/s/collection_metadata_test.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include #include #include @@ -48,7 +47,7 @@ namespace { using namespace mongo; - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::make_pair; using std::string; @@ -112,7 +111,7 @@ namespace { } private: - scoped_ptr _dummyConfig; + unique_ptr _dummyConfig; CollectionMetadata _metadata; }; @@ -144,7 +143,7 @@ namespace { string errMsg; const ChunkVersion version( 99, 0, OID() ); - scoped_ptr cloned( getCollMetadata().clonePlusChunk( chunk, + unique_ptr cloned( getCollMetadata().clonePlusChunk( chunk, version, &errMsg ) ); @@ -161,7 +160,7 @@ namespace { chunk.setMax( BSON("a" << 20) ); string errMsg; - scoped_ptr cloned( getCollMetadata() // br + unique_ptr cloned( getCollMetadata() // br .clonePlusChunk( chunk, ChunkVersion( 0, 0, OID() ), &errMsg ) ); ASSERT( cloned == NULL ); @@ -177,7 +176,7 @@ namespace { string errMsg; ChunkType chunk; - scoped_ptr cloned; + unique_ptr cloned; chunk.setMin( BSON("a" << 10) ); chunk.setMax( BSON("a" << 20) ); @@ -197,7 +196,7 @@ namespace { string errMsg; ChunkType chunk; - scoped_ptr cloned; + unique_ptr cloned; chunk.setMin( BSON("a" << 10) ); chunk.setMax( BSON("a" << 20) ); @@ -225,7 +224,7 @@ namespace { string errMsg; ChunkType chunk; - scoped_ptr cloned; + unique_ptr cloned; chunk.setMin( BSON("a" << 10) ); chunk.setMax( BSON("a" << 20) ); @@ -248,7 +247,7 @@ namespace { string errMsg; ChunkType chunk; - scoped_ptr cloned; + unique_ptr cloned; chunk.setMin( BSON("a" << 10) ); chunk.setMax( BSON("a" << 30) ); @@ -276,7 +275,7 @@ namespace { string errMsg; ChunkType chunk; - scoped_ptr cloned; + unique_ptr cloned; chunk.setMin( BSON("a" << 10) ); chunk.setMax( BSON("a" << 30) ); @@ -312,7 +311,7 @@ namespace { string errMsg; ChunkType chunk; - scoped_ptr cloned; + unique_ptr cloned; chunk.setMin( BSON("a" << 10) ); chunk.setMax( BSON("a" << 30) ); @@ -327,7 +326,7 @@ namespace { string errMsg; ChunkType chunk; - scoped_ptr cloned; + unique_ptr cloned; chunk.setMin( BSON("a" << 10) ); chunk.setMax( BSON("a" << 30) ); @@ -350,7 +349,7 @@ namespace { string errMsg; ChunkType chunk; - scoped_ptr cloned; + unique_ptr cloned; chunk.setMin( BSON("a" << 10) ); chunk.setMax( BSON("a" << 20) ); @@ -382,7 +381,7 @@ namespace { TEST_F(NoChunkFixture, MergeChunkEmpty) { string errMsg; - scoped_ptr cloned; + unique_ptr cloned; cloned.reset( getCollMetadata().cloneMerge( BSON( "a" << 15 ), BSON( "a" << 25 ), @@ -436,7 +435,7 @@ namespace { string errMsg; ChunkType chunk; - scoped_ptr cloned; + unique_ptr cloned; chunk.setMin( BSON("a" << 10) ); chunk.setMax( BSON("a" << 20) ); @@ -514,7 +513,7 @@ namespace { } private: - scoped_ptr _dummyConfig; + unique_ptr _dummyConfig; CollectionMetadata _metadata; }; @@ -556,7 +555,7 @@ namespace { string errMsg; const ChunkVersion zeroVersion( 0, 0, getCollMetadata().getShardVersion().epoch() ); - scoped_ptr cloned( getCollMetadata().cloneMigrate( chunk, + unique_ptr cloned( getCollMetadata().cloneMigrate( chunk, zeroVersion, &errMsg ) ); @@ -575,7 +574,7 @@ namespace { string errMsg; ChunkVersion version( 99, 0, OID() ); - scoped_ptr cloned( getCollMetadata().cloneMigrate( chunk, + unique_ptr cloned( getCollMetadata().cloneMigrate( chunk, version, &errMsg ) ); @@ -587,7 +586,7 @@ namespace { string errMsg; ChunkType chunk; - scoped_ptr cloned; + unique_ptr cloned; chunk.setMin( BSON("a" << 20) ); chunk.setMax( BSON("a" << 30) ); @@ -607,7 +606,7 @@ namespace { string errMsg; ChunkType chunk; - scoped_ptr cloned; + unique_ptr cloned; chunk.setMin( BSON("a" << 10) ); chunk.setMax( BSON("a" << 20) ); @@ -622,7 +621,7 @@ namespace { string errMsg; ChunkType chunk; - scoped_ptr cloned; + unique_ptr cloned; chunk.setMin( BSON("a" << 20) ); chunk.setMax( BSON("a" << 30) ); @@ -662,7 +661,7 @@ namespace { splitPoints.push_back(BSON("a" << 14)); string errMsg; - scoped_ptr cloned(getCollMetadata().cloneSplit(chunk, + unique_ptr cloned(getCollMetadata().cloneSplit(chunk, splitPoints, version, &errMsg)); @@ -688,7 +687,7 @@ namespace { TEST_F(SingleChunkFixture, MultiSplit) { string errMsg; ChunkType chunk; - scoped_ptr cloned; + unique_ptr cloned; chunk.setMin( BSON("a" << 10) ); chunk.setMax( BSON("a" << 20) ); @@ -733,7 +732,7 @@ namespace { string errMsg; ChunkType chunk; - scoped_ptr cloned; + unique_ptr cloned; chunk.setMin( BSON("a" << 20) ); chunk.setMax( BSON("a" << 30) ); @@ -771,7 +770,7 @@ namespace { TEST_F(SingleChunkFixture, MergeChunkSingle) { string errMsg; - scoped_ptr cloned; + unique_ptr cloned; cloned.reset( getCollMetadata().cloneMerge( BSON( "a" << 10 ), BSON( "a" << 20 ), @@ -854,7 +853,7 @@ namespace { } private: - scoped_ptr _dummyConfig; + unique_ptr _dummyConfig; CollectionMetadata _metadata; }; @@ -935,7 +934,7 @@ namespace { } private: - scoped_ptr _dummyConfig; + unique_ptr _dummyConfig; CollectionMetadata _metadata; }; @@ -946,7 +945,7 @@ namespace { string errMsg; ChunkVersion version( 1, 0, getCollMetadata().getShardVersion().epoch() ); - scoped_ptr cloned( getCollMetadata().clonePlusChunk( chunk, + unique_ptr cloned( getCollMetadata().clonePlusChunk( chunk, version, &errMsg ) ); @@ -970,7 +969,7 @@ namespace { chunk.setMax( BSON("a" << 25 << "b" << 0) ); string errMsg; - scoped_ptr cloned( getCollMetadata().clonePlusChunk( chunk, + unique_ptr cloned( getCollMetadata().clonePlusChunk( chunk, ChunkVersion( 1, 0, OID() ), @@ -987,7 +986,7 @@ namespace { string errMsg; ChunkVersion version( 2, 0, OID() ); - scoped_ptr cloned( getCollMetadata().cloneMigrate( chunk, + unique_ptr cloned( getCollMetadata().cloneMigrate( chunk, version, &errMsg ) ); @@ -1010,7 +1009,7 @@ namespace { chunk.setMax( BSON("a" << 28 << "b" << 0) ); string errMsg; - scoped_ptr cloned( getCollMetadata().cloneMigrate( chunk, + unique_ptr cloned( getCollMetadata().cloneMigrate( chunk, ChunkVersion( 1, 0, OID() ), @@ -1036,7 +1035,7 @@ namespace { ChunkVersion version( 1, 99, OID() ); // first chunk 1|99 , second 1|100 string errMsg; - scoped_ptr cloned( getCollMetadata().cloneSplit( chunk, + unique_ptr cloned( getCollMetadata().cloneSplit( chunk, splitKeys, version, &errMsg ) ); @@ -1062,7 +1061,7 @@ namespace { splitKeys.push_back( BSON("a" << 5 << "b" << 0) ); string errMsg; - scoped_ptr cloned( getCollMetadata().cloneSplit( chunk, + unique_ptr cloned( getCollMetadata().cloneSplit( chunk, splitKeys, ChunkVersion( 1, 0, @@ -1086,7 +1085,7 @@ namespace { splitKeys.push_back( BSON("a" << 15 << "b" << 0) ); string errMsg; - scoped_ptr cloned( getCollMetadata().cloneSplit( chunk, + unique_ptr cloned( getCollMetadata().cloneSplit( chunk, splitKeys, ChunkVersion( 1, 0, @@ -1123,7 +1122,7 @@ namespace { string errMsg; ChunkType chunk; - scoped_ptr cloned; + unique_ptr cloned; chunk.setMin( BSON( "a" << 20 << "b" << 0 ) ); chunk.setMax( BSON( "a" << 30 << "b" << 0 ) ); @@ -1228,7 +1227,7 @@ namespace { } private: - scoped_ptr _dummyConfig; + unique_ptr _dummyConfig; CollectionMetadata _metadata; }; @@ -1266,7 +1265,7 @@ namespace { TEST_F(ThreeChunkWithRangeGapFixture, MergeChunkHoleInRange) { string errMsg; - scoped_ptr cloned; + unique_ptr cloned; // Try to merge with hole in range ChunkVersion newShardVersion( 5, 0, getCollMetadata().getShardVersion().epoch() ); @@ -1282,7 +1281,7 @@ namespace { TEST_F(ThreeChunkWithRangeGapFixture, MergeChunkDiffEndKey) { string errMsg; - scoped_ptr cloned; + unique_ptr cloned; // Try to merge with different end key ChunkVersion newShardVersion( 5, 0, getCollMetadata().getShardVersion().epoch() ); @@ -1298,7 +1297,7 @@ namespace { TEST_F(ThreeChunkWithRangeGapFixture, MergeChunkMinKey) { string errMsg; - scoped_ptr cloned; + unique_ptr cloned; ASSERT_EQUALS( getCollMetadata().getNumChunks(), 3u ); @@ -1319,7 +1318,7 @@ namespace { TEST_F(ThreeChunkWithRangeGapFixture, MergeChunkMaxKey) { string errMsg; - scoped_ptr cloned; + unique_ptr cloned; ChunkVersion newShardVersion( 5, 0, getCollMetadata().getShardVersion().epoch() ); // Add one chunk to complete the range @@ -1350,7 +1349,7 @@ namespace { TEST_F(ThreeChunkWithRangeGapFixture, MergeChunkFullRange) { string errMsg; - scoped_ptr cloned; + unique_ptr cloned; ChunkVersion newShardVersion( 5, 0, getCollMetadata().getShardVersion().epoch() ); // Add one chunk to complete the range @@ -1382,7 +1381,7 @@ namespace { TEST_F(ThreeChunkWithRangeGapFixture, MergeChunkMiddleRange) { string errMsg; - scoped_ptr cloned; + unique_ptr cloned; ChunkVersion newShardVersion( 5, 0, getCollMetadata().getShardVersion().epoch() ); // Add one chunk to complete the range diff --git a/src/mongo/s/commands/cluster_list_databases_cmd.cpp b/src/mongo/s/commands/cluster_list_databases_cmd.cpp index cc0fc602fd4..5e3559c8281 100644 --- a/src/mongo/s/commands/cluster_list_databases_cmd.cpp +++ b/src/mongo/s/commands/cluster_list_databases_cmd.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include #include #include @@ -42,7 +41,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::map; using std::string; using std::vector; @@ -89,7 +88,7 @@ namespace { BSONObjBuilder& result) { map sizes; - map > dbShardInfo; + map > dbShardInfo; vector shardIds; grid.shardRegistry()->getAllShardIds(&shardIds); @@ -119,7 +118,7 @@ namespace { totalSize += size; } - scoped_ptr& bb = dbShardInfo[name]; + unique_ptr& bb = dbShardInfo[name]; if (!bb.get()) { bb.reset(new BSONObjBuilder()); } diff --git a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp index 9d949c0df57..19aa53538da 100644 --- a/src/mongo/s/commands/cluster_move_chunk_cmd.cpp +++ b/src/mongo/s/commands/cluster_move_chunk_cmd.cpp @@ -31,7 +31,6 @@ #include "mongo/platform/basic.h" #include -#include #include "mongo/db/audit.h" #include "mongo/db/auth/action_set.h" @@ -53,7 +52,7 @@ namespace mongo { using boost::shared_ptr; - using boost::scoped_ptr; + using std::unique_ptr; using std::string; namespace { @@ -239,7 +238,7 @@ namespace { return false; } - scoped_ptr writeConcern(new WriteConcernOptions()); + unique_ptr writeConcern(new WriteConcernOptions()); Status status = writeConcern->parseSecondaryThrottle(cmdObj, NULL); if (!status.isOK()){ diff --git a/src/mongo/s/commands/cluster_pipeline_cmd.cpp b/src/mongo/s/commands/cluster_pipeline_cmd.cpp index a5b039797a7..ebd402eee80 100644 --- a/src/mongo/s/commands/cluster_pipeline_cmd.cpp +++ b/src/mongo/s/commands/cluster_pipeline_cmd.cpp @@ -31,7 +31,6 @@ #include "mongo/platform/basic.h" #include -#include #include #include #include @@ -56,7 +55,7 @@ namespace mongo { using boost::intrusive_ptr; - using boost::scoped_ptr; + using std::unique_ptr; using boost::shared_ptr; using std::string; using std::vector; diff --git a/src/mongo/s/commands/commands_public.cpp b/src/mongo/s/commands/commands_public.cpp index c3c88231c57..733f498c5ab 100644 --- a/src/mongo/s/commands/commands_public.cpp +++ b/src/mongo/s/commands/commands_public.cpp @@ -32,7 +32,6 @@ #include "mongo/platform/basic.h" -#include #include #include "mongo/client/connpool.h" @@ -70,7 +69,7 @@ namespace mongo { using boost::intrusive_ptr; - using boost::scoped_ptr; + using std::unique_ptr; using boost::shared_ptr; using std::list; using std::make_pair; diff --git a/src/mongo/s/config.cpp b/src/mongo/s/config.cpp index 3794d16adf4..506627aaadd 100644 --- a/src/mongo/s/config.cpp +++ b/src/mongo/s/config.cpp @@ -32,7 +32,6 @@ #include "mongo/s/config.h" -#include #include "mongo/client/connpool.h" #include "mongo/db/client.h" @@ -57,7 +56,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::endl; using std::set; diff --git a/src/mongo/s/cursors.cpp b/src/mongo/s/cursors.cpp index e7e623eeed9..32d838dcc1e 100644 --- a/src/mongo/s/cursors.cpp +++ b/src/mongo/s/cursors.cpp @@ -33,7 +33,6 @@ #include "mongo/s/cursors.h" -#include #include #include @@ -55,7 +54,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::endl; using std::string; using std::stringstream; @@ -227,7 +226,7 @@ namespace mongo { true, true); unsigned getCCRandomSeed() { - scoped_ptr sr( SecureRandom::create() ); + unique_ptr sr( SecureRandom::create() ); return sr->nextInt64(); } diff --git a/src/mongo/s/metadata_loader_test.cpp b/src/mongo/s/metadata_loader_test.cpp index 112873824f9..31cd8af70a5 100644 --- a/src/mongo/s/metadata_loader_test.cpp +++ b/src/mongo/s/metadata_loader_test.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include #include #include "mongo/base/status.h" @@ -50,7 +49,7 @@ namespace { using namespace mongo; - using boost::scoped_ptr; + using std::unique_ptr; using std::unique_ptr; using std::string; using std::vector; @@ -215,7 +214,7 @@ namespace { } private: - scoped_ptr _dummyConfig; + unique_ptr _dummyConfig; }; TEST_F(NoChunkFixture, NoChunksIsDropped) { @@ -277,7 +276,7 @@ namespace { } private: - scoped_ptr _dummyConfig; + unique_ptr _dummyConfig; }; TEST_F(NoChunkHereFixture, CheckNumChunk) { @@ -347,7 +346,7 @@ namespace { } private: - scoped_ptr _dummyConfig; + unique_ptr _dummyConfig; ChunkVersion _maxCollVersion; }; @@ -499,8 +498,8 @@ namespace { } private: - scoped_ptr _dummyConfig; - scoped_ptr _loader; + unique_ptr _dummyConfig; + unique_ptr _loader; }; TEST_F(MultipleMetadataFixture, PromotePendingNA) { @@ -531,7 +530,7 @@ namespace { pending.setMin( BSON( "x" << 0 ) ); pending.setMax( BSON( "x" << 10 ) ); - scoped_ptr cloned( afterMetadata.clonePlusPending( pending, &errMsg ) ); + unique_ptr cloned( afterMetadata.clonePlusPending( pending, &errMsg ) ); ASSERT( cloned != NULL ); status = loader().promotePendingChunks( cloned.get(), &remoteMetadata ); @@ -569,7 +568,7 @@ namespace { pending.setMin( BSON( "x" << 0 ) ); pending.setMax( BSON( "x" << 10 ) ); - scoped_ptr cloned( afterMetadata.clonePlusPending( pending, &errMsg ) ); + unique_ptr cloned( afterMetadata.clonePlusPending( pending, &errMsg ) ); ASSERT( cloned != NULL ); status = loader().promotePendingChunks( cloned.get(), &remoteMetadata ); @@ -635,7 +634,7 @@ namespace { pending.setMin( BSON( "x" << MINKEY ) ); pending.setMax( BSON( "x" << 0 ) ); - scoped_ptr cloned( afterMetadata.clonePlusPending( pending, &errMsg ) ); + unique_ptr cloned( afterMetadata.clonePlusPending( pending, &errMsg ) ); ASSERT( cloned != NULL ); pending.setMin( BSON( "x" << 10 ) ); @@ -707,7 +706,7 @@ namespace { pending.setMin( BSON( "x" << MINKEY ) ); pending.setMax( BSON( "x" << 1 ) ); - scoped_ptr cloned( afterMetadata.clonePlusPending( pending, &errMsg ) ); + unique_ptr cloned( afterMetadata.clonePlusPending( pending, &errMsg ) ); ASSERT( cloned != NULL ); cloned.reset( cloned->clonePlusPending( pending, &errMsg ) ); @@ -817,7 +816,7 @@ namespace { } private: - scoped_ptr _dummyConfig; + unique_ptr _dummyConfig; CollectionMetadata _oldMetadata; ChunkVersion _maxCollVersion; @@ -922,7 +921,7 @@ namespace { } private: - scoped_ptr _dummyConfig; + unique_ptr _dummyConfig; CollectionMetadata _oldMetadata; ChunkVersion _maxCollVersion; diff --git a/src/mongo/s/shard_key_pattern.cpp b/src/mongo/s/shard_key_pattern.cpp index 613eb84a2bc..d4c5e105450 100644 --- a/src/mongo/s/shard_key_pattern.cpp +++ b/src/mongo/s/shard_key_pattern.cpp @@ -28,7 +28,6 @@ #include "mongo/s/shard_key_pattern.h" -#include #include #include @@ -42,7 +41,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using boost::shared_ptr; using std::unique_ptr; using std::pair; @@ -289,7 +288,7 @@ namespace mongo { CanonicalQuery::canonicalize("", basicQuery, &rawQuery, WhereCallbackNoop()); if (!queryStatus.isOK()) return StatusWith(queryStatus); - scoped_ptr query(rawQuery); + unique_ptr query(rawQuery); EqualityMatches equalities; // TODO: Build the path set initially? diff --git a/src/mongo/s/strategy.cpp b/src/mongo/s/strategy.cpp index 7839d0cb85c..5fa32cba9bd 100644 --- a/src/mongo/s/strategy.cpp +++ b/src/mongo/s/strategy.cpp @@ -32,7 +32,6 @@ #include "mongo/s/strategy.h" -#include #include "mongo/base/status.h" #include "mongo/base/owned_pointer_vector.h" @@ -70,7 +69,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using boost::shared_ptr; using std::endl; using std::set; @@ -241,7 +240,7 @@ namespace mongo { // Only one shard is used // Remote cursors are stored remotely, we shouldn't need this around. - scoped_ptr cursorDeleter( cursor ); + unique_ptr cursorDeleter( cursor ); ShardPtr shard = cursor->getQueryShard(); verify( shard.get() ); diff --git a/src/mongo/s/write_ops/batch_upconvert.cpp b/src/mongo/s/write_ops/batch_upconvert.cpp index e3c37249255..26a8b8b2da0 100644 --- a/src/mongo/s/write_ops/batch_upconvert.cpp +++ b/src/mongo/s/write_ops/batch_upconvert.cpp @@ -30,7 +30,6 @@ #include "mongo/s/write_ops/batch_upconvert.h" -#include #include "mongo/bson/bsonobj.h" #include "mongo/client/dbclientinterface.h" @@ -44,7 +43,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using mongoutils::str::stream; using std::unique_ptr; using std::string; @@ -174,7 +173,7 @@ namespace mongo { const BatchedCommandResponse& response, LastError* error ) { - scoped_ptr commandError; + unique_ptr commandError; WriteErrorDetail* lastBatchError = NULL; if ( !response.getOk() ) { diff --git a/src/mongo/s/write_ops/batch_write_exec.h b/src/mongo/s/write_ops/batch_write_exec.h index a55f716194a..b7fd6c51e43 100644 --- a/src/mongo/s/write_ops/batch_write_exec.h +++ b/src/mongo/s/write_ops/batch_write_exec.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include diff --git a/src/mongo/s/write_ops/batch_write_exec_test.cpp b/src/mongo/s/write_ops/batch_write_exec_test.cpp index 8c4bc77a660..3e0b2cfb9f3 100644 --- a/src/mongo/s/write_ops/batch_write_exec_test.cpp +++ b/src/mongo/s/write_ops/batch_write_exec_test.cpp @@ -28,7 +28,6 @@ #include "mongo/s/write_ops/batch_write_exec.h" -#include #include "mongo/base/owned_pointer_vector.h" #include "mongo/s/client/mock_multi_write_command.h" @@ -40,7 +39,7 @@ namespace { - using boost::scoped_ptr; + using std::unique_ptr; using std::string; using std::vector; @@ -81,7 +80,7 @@ namespace { MockShardResolver resolver; MockMultiWriteCommand dispatcher; - scoped_ptr exec; + unique_ptr exec; }; // diff --git a/src/mongo/s/write_ops/batch_write_op.h b/src/mongo/s/write_ops/batch_write_op.h index 0638cc43cb0..224d9985ef3 100644 --- a/src/mongo/s/write_ops/batch_write_op.h +++ b/src/mongo/s/write_ops/batch_write_op.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include @@ -180,7 +179,7 @@ namespace mongo { OwnedPointerVector _upsertedIds; // Stats for the entire batch op - boost::scoped_ptr _stats; + std::unique_ptr _stats; }; struct BatchWriteStats { diff --git a/src/mongo/s/write_ops/batched_command_request.h b/src/mongo/s/write_ops/batched_command_request.h index 9cf7fb1a92d..66e178dd5a8 100644 --- a/src/mongo/s/write_ops/batched_command_request.h +++ b/src/mongo/s/write_ops/batched_command_request.h @@ -28,7 +28,6 @@ #pragma once -#include #include "mongo/base/disallow_copying.h" #include "mongo/s/bson_serializable.h" @@ -185,9 +184,9 @@ namespace mongo { private: BatchType _batchType; - boost::scoped_ptr _insertReq; - boost::scoped_ptr _updateReq; - boost::scoped_ptr _deleteReq; + std::unique_ptr _insertReq; + std::unique_ptr _updateReq; + std::unique_ptr _deleteReq; }; /** diff --git a/src/mongo/s/write_ops/batched_command_response.h b/src/mongo/s/write_ops/batched_command_response.h index 57fc0549330..68cee2abaa6 100644 --- a/src/mongo/s/write_ops/batched_command_response.h +++ b/src/mongo/s/write_ops/batched_command_response.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include @@ -175,7 +174,7 @@ namespace mongo { // (O) Array of upserted items' _id's // Should only be present if _singleUpserted is not. - boost::scoped_ptr >_upsertDetails; + std::unique_ptr >_upsertDetails; // (O) Timestamp assigned to the write op when it was written to the oplog. // Normally, getLastError can use Client::_lastOp, but this is not valid for @@ -192,10 +191,10 @@ namespace mongo { bool _isElectionIdSet; // (O) Array of item-level error information - boost::scoped_ptr >_writeErrorDetails; + std::unique_ptr >_writeErrorDetails; // (O) errors that occurred while trying to satisfy the write concern. - boost::scoped_ptr _wcErrDetails; + std::unique_ptr _wcErrDetails; }; } // namespace mongo diff --git a/src/mongo/s/write_ops/batched_delete_request.h b/src/mongo/s/write_ops/batched_delete_request.h index 62fd4f94505..e3846833bec 100644 --- a/src/mongo/s/write_ops/batched_delete_request.h +++ b/src/mongo/s/write_ops/batched_delete_request.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include @@ -151,7 +150,7 @@ namespace mongo { bool _isOrderedSet; // (O) metadata associated with this request for internal use. - boost::scoped_ptr _metadata; + std::unique_ptr _metadata; }; } // namespace mongo diff --git a/src/mongo/s/write_ops/batched_insert_request.h b/src/mongo/s/write_ops/batched_insert_request.h index 0fb6d95d8c5..8b5238b888e 100644 --- a/src/mongo/s/write_ops/batched_insert_request.h +++ b/src/mongo/s/write_ops/batched_insert_request.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include @@ -141,7 +140,7 @@ namespace mongo { bool _isOrderedSet; // (O) metadata associated with this request for internal use. - boost::scoped_ptr _metadata; + std::unique_ptr _metadata; // (O) cached copied of target ns NamespaceString _targetNSS; diff --git a/src/mongo/s/write_ops/batched_request_metadata.cpp b/src/mongo/s/write_ops/batched_request_metadata.cpp index e3403196151..29d4b5e97fc 100644 --- a/src/mongo/s/write_ops/batched_request_metadata.cpp +++ b/src/mongo/s/write_ops/batched_request_metadata.cpp @@ -82,7 +82,7 @@ namespace mongo { _isShardNameSet = fieldState == FieldParser::FIELD_SET; { - boost::scoped_ptr tempChunkVersion(new ChunkVersion); + std::unique_ptr tempChunkVersion(new ChunkVersion); fieldState = FieldParser::extract(source, shardVersion, tempChunkVersion.get(), errMsg); if (fieldState == FieldParser::FIELD_INVALID) return false; diff --git a/src/mongo/s/write_ops/batched_request_metadata.h b/src/mongo/s/write_ops/batched_request_metadata.h index 029e915757e..afe639adfaa 100644 --- a/src/mongo/s/write_ops/batched_request_metadata.h +++ b/src/mongo/s/write_ops/batched_request_metadata.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/disallow_copying.h" @@ -86,7 +85,7 @@ namespace mongo { bool _isShardNameSet; // (O) version for this collection on a given shard - boost::scoped_ptr _shardVersion; + std::unique_ptr _shardVersion; // (O) session number the inserts belong to long long _session; diff --git a/src/mongo/s/write_ops/batched_update_request.h b/src/mongo/s/write_ops/batched_update_request.h index 94f24f089b1..db99188b7b3 100644 --- a/src/mongo/s/write_ops/batched_update_request.h +++ b/src/mongo/s/write_ops/batched_update_request.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include @@ -150,7 +149,7 @@ namespace mongo { bool _shouldBypassValidation; // (O) metadata associated with this request for internal use. - boost::scoped_ptr _metadata; + std::unique_ptr _metadata; }; } // namespace mongo diff --git a/src/mongo/s/write_ops/write_op.h b/src/mongo/s/write_ops/write_op.h index b54ec1718c3..98ccf0d691d 100644 --- a/src/mongo/s/write_ops/write_op.h +++ b/src/mongo/s/write_ops/write_op.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "mongo/base/string_data.h" @@ -183,7 +182,7 @@ namespace mongo { std::vector _childOps; // filled when state == _Error - boost::scoped_ptr _error; + std::unique_ptr _error; // Finished child operations, for debugging std::vector _history; @@ -210,10 +209,10 @@ namespace mongo { TargetedWrite* pendingWrite; // filled when state > _Pending - boost::scoped_ptr endpoint; + std::unique_ptr endpoint; // filled when state == _Error or (optionally) when state == _Cancelled - boost::scoped_ptr error; + std::unique_ptr error; }; // First value is write item index in the batch, second value is child write op index diff --git a/src/mongo/s/write_ops/write_op_test.cpp b/src/mongo/s/write_ops/write_op_test.cpp index 669220c6d24..fc5caa05dfb 100644 --- a/src/mongo/s/write_ops/write_op_test.cpp +++ b/src/mongo/s/write_ops/write_op_test.cpp @@ -28,7 +28,6 @@ #include "mongo/s/write_ops/write_op.h" -#include #include "mongo/base/error_codes.h" #include "mongo/base/owned_pointer_vector.h" @@ -40,7 +39,7 @@ namespace { - using boost::scoped_ptr; + using std::unique_ptr; using std::string; using std::vector; @@ -69,7 +68,7 @@ namespace { WriteOp writeOp( BatchItemRef( &request, 0 ) ); ASSERT_EQUALS( writeOp.getWriteState(), WriteOpState_Ready ); - scoped_ptr error( buildError( ErrorCodes::UnknownError, + unique_ptr error( buildError( ErrorCodes::UnknownError, BSON( "data" << 12345 ), "some message" ) ); @@ -294,7 +293,7 @@ namespace { ASSERT_EQUALS( targeted.size(), 1u ); assertEndpointsEqual( targeted.front()->endpoint, endpoint ); - scoped_ptr error( buildError( ErrorCodes::UnknownError, + unique_ptr error( buildError( ErrorCodes::UnknownError, BSON( "data" << 12345 ), "some message" ) ); @@ -392,7 +391,7 @@ namespace { // Stale exception - scoped_ptr error( buildError( ErrorCodes::StaleShardVersion, + unique_ptr error( buildError( ErrorCodes::StaleShardVersion, BSON( "data" << 12345 ), "some message" ) ); diff --git a/src/mongo/scripting/bson_template_evaluator_test.cpp b/src/mongo/scripting/bson_template_evaluator_test.cpp index c589617f34f..69a1678617d 100644 --- a/src/mongo/scripting/bson_template_evaluator_test.cpp +++ b/src/mongo/scripting/bson_template_evaluator_test.cpp @@ -264,7 +264,7 @@ namespace mongo { TEST(BSONTemplateEvaluatorTest, SEQ_INT) { - boost::scoped_ptr t(new BsonTemplateEvaluator(131415)); + std::unique_ptr t(new BsonTemplateEvaluator(131415)); BSONObj seqObj; BSONObj expectedObj; diff --git a/src/mongo/scripting/engine.cpp b/src/mongo/scripting/engine.cpp index b573dba620d..153df5d7f6d 100644 --- a/src/mongo/scripting/engine.cpp +++ b/src/mongo/scripting/engine.cpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #include "mongo/client/dbclientcursor.h" @@ -50,7 +49,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using boost::shared_ptr; using std::unique_ptr; using std::endl; @@ -221,7 +220,7 @@ namespace { _loadedVersion = lastVersion; string coll = _localDBName + ".system.js"; - scoped_ptr directDBClient(createDirectClient(txn)); + unique_ptr directDBClient(createDirectClient(txn)); unique_ptr c = directDBClient->query(coll, Query(), 0, 0, NULL, QueryOption_SlaveOk, 0); massert(16669, "unable to get db client cursor from query", c.get()); diff --git a/src/mongo/scripting/engine_v8-3.25.h b/src/mongo/scripting/engine_v8-3.25.h index 70a34f93a5e..b81dfcc40f6 100644 --- a/src/mongo/scripting/engine_v8-3.25.h +++ b/src/mongo/scripting/engine_v8-3.25.h @@ -29,7 +29,6 @@ #pragma once -#include #include #include #include @@ -126,7 +125,7 @@ namespace mongo { * @param data Weak callback data. Contains pointer to the TrackedPtr instance. */ static void deleteOnCollect(const v8::WeakCallbackData& data) { - boost::scoped_ptr trackedPtr(data.GetParameter()); + std::unique_ptr trackedPtr(data.GetParameter()); invariant(trackedPtr.get()); trackedPtr->_tracker->_container.erase(trackedPtr.get()); diff --git a/src/mongo/scripting/v8-3.25_utils.cpp b/src/mongo/scripting/v8-3.25_utils.cpp index f0a2e87a6ea..9b183cf0b81 100644 --- a/src/mongo/scripting/v8-3.25_utils.cpp +++ b/src/mongo/scripting/v8-3.25_utils.cpp @@ -32,7 +32,6 @@ #include "mongo/scripting/v8-3.25_utils.h" #include -#include #include #include #include @@ -50,7 +49,7 @@ #include "mongo/util/mongoutils/str.h" using namespace std; -using boost::scoped_ptr; +using std::unique_ptr; namespace mongo { @@ -180,7 +179,7 @@ namespace mongo { void operator()() { try { - scoped_ptr scope( + unique_ptr scope( static_cast(globalScriptEngine->newScope())); v8::Locker v8lock(scope->getIsolate()); v8::Isolate::Scope iscope(scope->getIsolate()); @@ -241,7 +240,7 @@ namespace mongo { bool _started; bool _done; - scoped_ptr _thread; + unique_ptr _thread; boost::shared_ptr _sharedData; }; diff --git a/src/mongo/scripting/v8_db.cpp b/src/mongo/scripting/v8_db.cpp index 57f9ce1a3c7..b14016e86ea 100644 --- a/src/mongo/scripting/v8_db.cpp +++ b/src/mongo/scripting/v8_db.cpp @@ -429,7 +429,7 @@ namespace mongo { std::string hashedPwd = DBClientWithCommands::createPasswordDigest(user, toSTLString(args[4])); - boost::scoped_ptr session(new NativeSaslClientSession()); + std::unique_ptr session(new NativeSaslClientSession()); session->setParameter(SaslClientSession::parameterMechanism, "SCRAM-SHA-1"); session->setParameter(SaslClientSession::parameterUser, user); diff --git a/src/mongo/scripting/v8_utils.cpp b/src/mongo/scripting/v8_utils.cpp index 894d3ecbe27..7a774354c99 100644 --- a/src/mongo/scripting/v8_utils.cpp +++ b/src/mongo/scripting/v8_utils.cpp @@ -32,7 +32,6 @@ #include "mongo/scripting/v8_utils.h" #include -#include #include #include #include @@ -50,7 +49,7 @@ #include "mongo/util/mongoutils/str.h" using namespace std; -using boost::scoped_ptr; +using std::unique_ptr; namespace mongo { @@ -179,7 +178,7 @@ namespace mongo { void operator()() { try { - scoped_ptr scope( + unique_ptr scope( static_cast(globalScriptEngine->newScope())); v8::Locker v8lock(scope->getIsolate()); v8::Isolate::Scope iscope(scope->getIsolate()); @@ -238,7 +237,7 @@ namespace mongo { bool _started; bool _done; - scoped_ptr _thread; + unique_ptr _thread; boost::shared_ptr _sharedData; }; diff --git a/src/mongo/shell/bench.cpp b/src/mongo/shell/bench.cpp index b0ecb34c0bb..151c0a6ed3b 100644 --- a/src/mongo/shell/bench.cpp +++ b/src/mongo/shell/bench.cpp @@ -738,7 +738,7 @@ namespace mongo { void BenchRunWorker::run() { try { BenchRunWorkerStateGuard _workerStateGuard( _brState ); - boost::scoped_ptr conn( _config->createConnection() ); + std::unique_ptr conn( _config->createConnection() ); if ( !_config->username.empty() ) { string errmsg; if (!conn->auth("admin", _config->username, _config->password, errmsg)) { @@ -776,7 +776,7 @@ namespace mongo { void BenchRunner::start( ) { { - boost::scoped_ptr conn( _config->createConnection() ); + std::unique_ptr conn( _config->createConnection() ); // Must authenticate to admin db in order to run serverStatus command if (_config->username != "") { string errmsg; @@ -814,7 +814,7 @@ namespace mongo { delete _brTimer; { - boost::scoped_ptr conn( _config->createConnection() ); + std::unique_ptr conn( _config->createConnection() ); if (_config->username != "") { string errmsg; // this can only fail if admin access was revoked since start of run diff --git a/src/mongo/shell/bench.h b/src/mongo/shell/bench.h index 280d7c1399d..6edd007b6c6 100644 --- a/src/mongo/shell/bench.h +++ b/src/mongo/shell/bench.h @@ -30,7 +30,6 @@ #include -#include #include #include #include @@ -434,7 +433,7 @@ namespace mongo { BenchRunState _brState; Timer *_brTimer; unsigned long long _microsElapsed; - boost::scoped_ptr _config; + std::unique_ptr _config; std::vector _workers; BSONObj before; diff --git a/src/mongo/shell/shell_utils.cpp b/src/mongo/shell/shell_utils.cpp index cd7dd909264..ce951fc92d5 100644 --- a/src/mongo/shell/shell_utils.cpp +++ b/src/mongo/shell/shell_utils.cpp @@ -315,7 +315,7 @@ namespace mongo { const ConnectionString cs(status.getValue()); string errmsg; - boost::scoped_ptr conn( cs.connect( errmsg ) ); + std::unique_ptr conn( cs.connect( errmsg ) ); if ( !conn ) { continue; } diff --git a/src/mongo/unittest/unittest.h b/src/mongo/unittest/unittest.h index 7faa5dcb3bd..fad64609187 100644 --- a/src/mongo/unittest/unittest.h +++ b/src/mongo/unittest/unittest.h @@ -42,7 +42,6 @@ #include #include -#include #include #include "mongo/base/status_with.h" diff --git a/src/mongo/util/background.h b/src/mongo/util/background.h index 4f8ae23ee57..e49bead9491 100644 --- a/src/mongo/util/background.h +++ b/src/mongo/util/background.h @@ -29,8 +29,8 @@ #pragma once -#include #include +#include #include #include @@ -127,7 +127,7 @@ namespace mongo { const bool _selfDelete; struct JobStatus; - const boost::scoped_ptr _status; + const std::unique_ptr _status; void jobBody(); }; diff --git a/src/mongo/util/fail_point.cpp b/src/mongo/util/fail_point.cpp index ef3c2111b2b..0d2a8897123 100644 --- a/src/mongo/util/fail_point.cpp +++ b/src/mongo/util/fail_point.cpp @@ -30,7 +30,6 @@ #include "mongo/util/fail_point.h" -#include #include #include "mongo/platform/random.h" @@ -49,7 +48,7 @@ namespace { class FailPointPRNG { public: FailPointPRNG() : - _prng(boost::scoped_ptr(SecureRandom::create())->nextInt64()) {} + _prng(std::unique_ptr(SecureRandom::create())->nextInt64()) {} void resetSeed(int32_t seed) { _prng = PseudoRandom(seed); diff --git a/src/mongo/util/fail_point_service.cpp b/src/mongo/util/fail_point_service.cpp index 43cf5c44d9b..d948a9e5a7a 100644 --- a/src/mongo/util/fail_point_service.cpp +++ b/src/mongo/util/fail_point_service.cpp @@ -28,15 +28,14 @@ #include "mongo/util/fail_point_service.h" -#include namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; MONGO_FP_DECLARE(dummy); // used by jstests/libs/fail_point.js - scoped_ptr _fpRegistry(NULL); + unique_ptr _fpRegistry(nullptr); MONGO_INITIALIZER(FailPointRegistry)(InitializerContext* context) { _fpRegistry.reset(new FailPointRegistry()); diff --git a/src/mongo/util/net/message_server_port.cpp b/src/mongo/util/net/message_server_port.cpp index 4a4e73fa4b0..e8df178e2af 100644 --- a/src/mongo/util/net/message_server_port.cpp +++ b/src/mongo/util/net/message_server_port.cpp @@ -31,7 +31,6 @@ #include "mongo/platform/basic.h" -#include #include #include @@ -65,7 +64,7 @@ namespace mongo { - using boost::scoped_ptr; + using std::unique_ptr; using std::endl; namespace { @@ -197,7 +196,7 @@ namespace { TicketHolderReleaser connTicketReleaser( &Listener::globalTicketHolder ); invariant(arg); - scoped_ptr portWithHandler( + unique_ptr portWithHandler( static_cast(arg)); MessageHandler* const handler = portWithHandler->getHandler(); diff --git a/src/mongo/util/net/sock.h b/src/mongo/util/net/sock.h index f1da6144d3e..a2aec13c388 100644 --- a/src/mongo/util/net/sock.h +++ b/src/mongo/util/net/sock.h @@ -44,7 +44,6 @@ #endif // not _WIN32 -#include #include #include #include @@ -310,7 +309,7 @@ namespace mongo { time_t _lastValidityCheckAtSecs; #ifdef MONGO_CONFIG_SSL - boost::scoped_ptr _sslConnection; + std::unique_ptr _sslConnection; SSLManagerInterface* _sslManager; #endif logger::LogSeverity _logLevel; // passed to log() when logging errors diff --git a/src/mongo/util/unowned_ptr.h b/src/mongo/util/unowned_ptr.h index 3bbba13b0f6..7bc66dda59b 100644 --- a/src/mongo/util/unowned_ptr.h +++ b/src/mongo/util/unowned_ptr.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include #include @@ -75,9 +74,6 @@ namespace mongo { template> unowned_ptr(const boost::shared_ptr& p) : _p(p.get()) {} - template> - unowned_ptr(const boost::scoped_ptr& p) : _p(p.get()) {} - // // Modifiers // diff --git a/src/mongo/util/unowned_ptr_test.cpp b/src/mongo/util/unowned_ptr_test.cpp index 05579684597..058480e3936 100644 --- a/src/mongo/util/unowned_ptr_test.cpp +++ b/src/mongo/util/unowned_ptr_test.cpp @@ -39,7 +39,7 @@ namespace mongo { //non-const std::unique_ptr p1(new int(1)); std::shared_ptr p2(new int(2)); - boost::scoped_ptr p3(new int(3)); + std::unique_ptr p3(new int(3)); boost::shared_ptr p4(new int(4)); ASSERT_EQUALS(aNullPtr, unowned_ptr()); @@ -52,7 +52,7 @@ namespace mongo { ASSERT_EQUALS(p2.get(), unowned_ptr(unowned_ptr(p2))); //const - boost::scoped_ptr cp1(new int(11)); + std::unique_ptr cp1(new int(11)); boost::shared_ptr cp2(new int(12)); ASSERT_EQUALS(aNullPtr, unowned_ptr()); @@ -80,7 +80,7 @@ namespace mongo { //non-const std::unique_ptr p1(new int(1)); std::shared_ptr p2(new int(2)); - boost::scoped_ptr p3(new int(3)); + std::unique_ptr p3(new int(3)); boost::shared_ptr p4(new int(4)); ASSERT_EQUALS(aNullPtr, (unowned_ptr() = {})); -- cgit v1.2.1