summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2015-06-10 18:08:48 -0400
committerAndrew Morrow <acm@mongodb.com>2015-06-10 22:37:49 -0400
commitd7d1fdb75966c684e9a42150e6e9b69c4a10ee08 (patch)
treed28b0767cbd8c1a09535f1676152e7ac57e829ce /src/mongo/db/storage
parenta9b6612f5322f916298c19a6728817a1034c6aab (diff)
downloadmongo-d7d1fdb75966c684e9a42150e6e9b69c4a10ee08.tar.gz
SERVER-17308 Replace boost::scoped_ptr<T> with std::unique_ptr<T>
Diffstat (limited to 'src/mongo/db/storage')
-rw-r--r--src/mongo/db/storage/in_memory/in_memory_engine_test.cpp2
-rw-r--r--src/mongo/db/storage/kv/kv_catalog.cpp15
-rw-r--r--src/mongo/db/storage/kv/kv_catalog.h1
-rw-r--r--src/mongo/db/storage/kv/kv_collection_catalog_entry.h2
-rw-r--r--src/mongo/db/storage/kv/kv_engine_test_harness.cpp47
-rw-r--r--src/mongo/db/storage/kv/kv_storage_engine.h7
-rw-r--r--src/mongo/db/storage/mmap_v1/btree/btree_interface.cpp7
-rw-r--r--src/mongo/db/storage/mmap_v1/catalog/namespace_details_rsv1_metadata.cpp3
-rw-r--r--src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/catalog/namespace_index.h3
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp3
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h5
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_init_test.cpp3
-rw-r--r--src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp3
-rw-r--r--src/mongo/db/storage/mmap_v1/record_store_v1_base.h3
-rw-r--r--src/mongo/db/storage/mmap_v1/repair_database.cpp9
-rw-r--r--src/mongo/db/storage/record_store_test_datafor.cpp27
-rw-r--r--src/mongo/db/storage/record_store_test_datasize.cpp23
-rw-r--r--src/mongo/db/storage/record_store_test_deleterecord.cpp31
-rw-r--r--src/mongo/db/storage/record_store_test_harness.cpp103
-rw-r--r--src/mongo/db/storage/record_store_test_insertrecord.cpp43
-rw-r--r--src/mongo/db/storage/record_store_test_manyiter.cpp23
-rw-r--r--src/mongo/db/storage/record_store_test_recorditer.cpp75
-rw-r--r--src/mongo/db/storage/record_store_test_recordstore.cpp15
-rw-r--r--src/mongo/db/storage/record_store_test_repairiter.cpp35
-rw-r--r--src/mongo/db/storage/record_store_test_storagesize.cpp15
-rw-r--r--src/mongo/db/storage/record_store_test_touch.cpp43
-rw-r--r--src/mongo/db/storage/record_store_test_truncate.cpp27
-rw-r--r--src/mongo/db/storage/record_store_test_updaterecord.cpp45
-rw-r--r--src/mongo/db/storage/record_store_test_updatewithdamages.cpp59
-rw-r--r--src/mongo/db/storage/record_store_test_validate.cpp43
-rw-r--r--src/mongo/db/storage/record_store_test_validate.h11
-rw-r--r--src/mongo/db/storage/storage_engine_lock_file.h4
-rw-r--r--src/mongo/db/storage/storage_engine_lock_file_test.cpp1
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_index_test.cpp1
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp3
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h5
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp2
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp3
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store.h1
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store_test.cpp153
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.h1
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_server_status.cpp2
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_util_test.cpp5
45 files changed, 438 insertions, 478 deletions
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<InMemoryEngine> _engine;
+ std::unique_ptr<InMemoryEngine> _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 <boost/scoped_ptr.hpp>
#include <stdlib.h>
#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>(SecureRandom::create())->nextInt64();
+ << std::unique_ptr<SecureRandom>(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<Lock::ResourceLock> rLk;
+ std::unique_ptr<Lock::ResourceLock> 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<Lock::ResourceLock> rLk;
+ std::unique_ptr<Lock::ResourceLock> 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<Lock::ResourceLock> rLk;
+ std::unique_ptr<Lock::ResourceLock> 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<Lock::ResourceLock> rLk;
+ std::unique_ptr<Lock::ResourceLock> 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<Lock::ResourceLock> rLk;
+ std::unique_ptr<Lock::ResourceLock> 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 <map>
#include <string>
-#include <boost/scoped_ptr.hpp>
#include <boost/thread/mutex.hpp>
#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> _recordStore; // owned
+ std::unique_ptr<RecordStore> _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 <boost/scoped_ptr.hpp>
#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<KVHarnessHelper> helper( KVHarnessHelper::create() );
+ unique_ptr<KVHarnessHelper> helper( KVHarnessHelper::create() );
KVEngine* engine = helper->getEngine();
ASSERT( engine );
string ns = "a.b";
- scoped_ptr<RecordStore> rs;
+ unique_ptr<RecordStore> rs;
{
MyOperationContext opCtx( engine );
ASSERT_OK( engine->createRecordStore( &opCtx, ns, ns, CollectionOptions() ) );
@@ -94,7 +93,7 @@ namespace mongo {
}
TEST( KVEngineTestHarness, Restart1 ) {
- scoped_ptr<KVHarnessHelper> helper( KVHarnessHelper::create() );
+ unique_ptr<KVHarnessHelper> 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<RecordStore> rs;
+ unique_ptr<RecordStore> rs;
{
MyOperationContext opCtx( engine );
ASSERT_OK( engine->createRecordStore( &opCtx, ns, ns, CollectionOptions() ) );
@@ -129,7 +128,7 @@ namespace mongo {
engine = helper->restartEngine();
{
- scoped_ptr<RecordStore> rs;
+ unique_ptr<RecordStore> 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<KVHarnessHelper> helper( KVHarnessHelper::create() );
+ unique_ptr<KVHarnessHelper> helper( KVHarnessHelper::create() );
KVEngine* engine = helper->getEngine();
ASSERT( engine );
string ident = "abc";
IndexDescriptor desc( NULL, "", BSON( "key" << BSON( "a" << 1 ) ) );
- scoped_ptr<SortedDataInterface> sorted;
+ unique_ptr<SortedDataInterface> sorted;
{
MyOperationContext opCtx( engine );
ASSERT_OK( engine->createSortedDataInterface( &opCtx, ident, &desc ) );
@@ -168,11 +167,11 @@ namespace mongo {
}
TEST( KVCatalogTest, Coll1 ) {
- scoped_ptr<KVHarnessHelper> helper( KVHarnessHelper::create() );
+ unique_ptr<KVHarnessHelper> helper( KVHarnessHelper::create() );
KVEngine* engine = helper->getEngine();
- scoped_ptr<RecordStore> rs;
- scoped_ptr<KVCatalog> catalog;
+ unique_ptr<RecordStore> rs;
+ unique_ptr<KVCatalog> catalog;
{
MyOperationContext opCtx( engine );
WriteUnitOfWork uow( &opCtx );
@@ -212,11 +211,11 @@ namespace mongo {
TEST( KVCatalogTest, Idx1 ) {
- scoped_ptr<KVHarnessHelper> helper( KVHarnessHelper::create() );
+ unique_ptr<KVHarnessHelper> helper( KVHarnessHelper::create() );
KVEngine* engine = helper->getEngine();
- scoped_ptr<RecordStore> rs;
- scoped_ptr<KVCatalog> catalog;
+ unique_ptr<RecordStore> rs;
+ unique_ptr<KVCatalog> catalog;
{
MyOperationContext opCtx( engine );
WriteUnitOfWork uow( &opCtx );
@@ -284,11 +283,11 @@ namespace mongo {
}
TEST( KVCatalogTest, DirectoryPerDb1 ) {
- scoped_ptr<KVHarnessHelper> helper( KVHarnessHelper::create() );
+ unique_ptr<KVHarnessHelper> helper( KVHarnessHelper::create() );
KVEngine* engine = helper->getEngine();
- scoped_ptr<RecordStore> rs;
- scoped_ptr<KVCatalog> catalog;
+ unique_ptr<RecordStore> rs;
+ unique_ptr<KVCatalog> catalog;
{
MyOperationContext opCtx( engine );
WriteUnitOfWork uow( &opCtx );
@@ -326,11 +325,11 @@ namespace mongo {
}
TEST( KVCatalogTest, Split1 ) {
- scoped_ptr<KVHarnessHelper> helper( KVHarnessHelper::create() );
+ unique_ptr<KVHarnessHelper> helper( KVHarnessHelper::create() );
KVEngine* engine = helper->getEngine();
- scoped_ptr<RecordStore> rs;
- scoped_ptr<KVCatalog> catalog;
+ unique_ptr<RecordStore> rs;
+ unique_ptr<KVCatalog> catalog;
{
MyOperationContext opCtx( engine );
WriteUnitOfWork uow( &opCtx );
@@ -368,11 +367,11 @@ namespace mongo {
}
TEST( KVCatalogTest, DirectoryPerAndSplit1 ) {
- scoped_ptr<KVHarnessHelper> helper( KVHarnessHelper::create() );
+ unique_ptr<KVHarnessHelper> helper( KVHarnessHelper::create() );
KVEngine* engine = helper->getEngine();
- scoped_ptr<RecordStore> rs;
- scoped_ptr<KVCatalog> catalog;
+ unique_ptr<RecordStore> rs;
+ unique_ptr<KVCatalog> 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 <map>
#include <string>
-#include <boost/scoped_ptr.hpp>
#include <boost/thread/mutex.hpp>
#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<KVEngine> _engine;
+ std::unique_ptr<KVEngine> _engine;
const bool _supportsDocLocking;
- boost::scoped_ptr<RecordStore> _catalogRecordStore;
- boost::scoped_ptr<KVCatalog> _catalog;
+ std::unique_ptr<RecordStore> _catalogRecordStore;
+ std::unique_ptr<KVCatalog> _catalog;
typedef std::map<std::string,KVDatabaseCatalogEntry*> 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 <boost/scoped_ptr.hpp>
#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<typename BtreeLogic<OnDiskFormat>::Builder> _builder;
+ std::unique_ptr<typename BtreeLogic<OnDiskFormat>::Builder> _builder;
// Not owned here.
OperationContext* _trans;
@@ -349,7 +348,7 @@ namespace {
}
private:
- scoped_ptr<BtreeLogic<OnDiskFormat> > _btree;
+ unique_ptr<BtreeLogic<OnDiskFormat> > _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 <boost/scoped_ptr.hpp>
#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 <boost/scoped_ptr.hpp>
#include <list>
#include <string>
@@ -87,7 +86,7 @@ namespace mongo {
const std::string _database;
DurableMappedFile _f;
- boost::scoped_ptr<NamespaceHashTable> _ht;
+ std::unique_ptr<NamespaceHashTable> _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 <boost/scoped_ptr.hpp>
#include <utility>
#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 <boost/scoped_ptr.hpp>
#include <map>
#include <string>
@@ -137,8 +136,8 @@ namespace mongo {
// RecoveryUnit to ensure correct handling of rollback.
struct Entry {
- boost::scoped_ptr<CollectionCatalogEntry> catalogEntry;
- boost::scoped_ptr<RecordStoreV1Base> recordStore;
+ std::unique_ptr<CollectionCatalogEntry> catalogEntry;
+ std::unique_ptr<RecordStoreV1Base> recordStore;
};
typedef std::map<std::string, Entry*> 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<LockMongoFilesShared> _filesLock;
+ std::unique_ptr<LockMongoFilesShared> _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 <boost/scoped_ptr.hpp>
#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<StorageFactoriesIterator> sfi(getGlobalServiceContext()->
+ std::unique_ptr<StorageFactoriesIterator> 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 <boost/scoped_ptr.hpp>
#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 <boost/scoped_ptr.hpp>
#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<RecordStoreV1MetaData> _details;
+ std::unique_ptr<RecordStoreV1MetaData> _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 <boost/filesystem/operations.hpp>
-#include <boost/scoped_ptr.hpp>
#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> repairFileDeleter;
+ unique_ptr<RepairFileDeleter> 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<MMAPV1DatabaseCatalogEntry> dbEntry;
- scoped_ptr<Database> tempDatabase;
+ unique_ptr<MMAPV1DatabaseCatalogEntry> dbEntry;
+ unique_ptr<Database> 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 <boost/scoped_ptr.hpp>
#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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
string data = "record-";
RecordId loc;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->insertRecord( opCtx.get(),
@@ -72,12 +71,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
RecordData record = rs->dataFor( opCtx.get(), loc );
ASSERT_EQUALS( data.size() + 1, static_cast<size_t>( 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
stringstream ss;
ss << "record----" << i;
@@ -118,12 +117,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) );
}
for ( int i = 0; i < nToInsert; i++ ) {
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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 <boost/scoped_ptr.hpp>
#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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT( rs->dataSize( opCtx.get() ) == 0 );
}
}
// Verify that a nonempty collection takes up some space.
TEST( RecordStoreTestHarness, DataSizeNonEmpty ) {
- scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
int nToInsert = 10;
for ( int i = 0; i < nToInsert; i++ ) {
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
stringstream ss;
ss << "record " << i;
@@ -87,12 +86,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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 <boost/scoped_ptr.hpp>
#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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
string data = "my record";
RecordId loc;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->insertRecord( opCtx.get(),
@@ -71,12 +70,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
rs->deleteRecord( opCtx.get(), loc );
@@ -85,25 +84,25 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
}
// Insert multiple records and try to delete them.
TEST( RecordStoreTestHarness, DeleteMultipleRecords ) {
- scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
stringstream ss;
ss << "record " << i;
@@ -121,12 +120,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) );
}
for ( int i = 0; i < nToInsert; i++ ) {
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
rs->deleteRecord( opCtx.get(), locs[i] );
@@ -135,7 +134,7 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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 <boost/scoped_ptr.hpp>
#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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
@@ -54,7 +53,7 @@ namespace mongo {
RecordId loc1;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->insertRecord( opCtx.get(), s.c_str(), s.size() + 1, false );
@@ -67,7 +66,7 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->insertRecord( opCtx.get(), s.c_str(), s.size() + 1, false );
@@ -91,7 +90,7 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 2, rs->numRecords( opCtx.get() ) );
}
}
@@ -111,13 +110,13 @@ namespace mongo {
TEST( RecordStoreTestHarness, Simple1InsertDocWroter ) {
- scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
RecordId loc1;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
@@ -133,11 +132,11 @@ namespace mongo {
}
TEST( RecordStoreTestHarness, Delete1 ) {
- scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
@@ -145,7 +144,7 @@ namespace mongo {
RecordId loc;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
@@ -160,12 +159,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
@@ -179,11 +178,11 @@ namespace mongo {
}
TEST( RecordStoreTestHarness, Delete2 ) {
- scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
@@ -191,7 +190,7 @@ namespace mongo {
RecordId loc;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
@@ -206,13 +205,13 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( s, rs->dataFor( opCtx.get(), loc ).data() );
ASSERT_EQUALS( 2, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
rs->deleteRecord( opCtx.get(), loc );
@@ -222,11 +221,11 @@ namespace mongo {
}
TEST( RecordStoreTestHarness, Update1 ) {
- scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
@@ -235,7 +234,7 @@ namespace mongo {
RecordId loc;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->insertRecord( opCtx.get(),
@@ -249,12 +248,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( s1, rs->dataFor( opCtx.get(), loc ).data() );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->updateRecord( opCtx.get(), loc,
@@ -268,7 +267,7 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->insertRecord( opCtx.get(),
@@ -303,12 +302,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( s1, rs->dataFor( opCtx.get(), loc ).data() );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
const char* damageSource = "222";
@@ -328,18 +327,18 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( s2, rs->dataFor( opCtx.get(), loc ).data() );
}
}
TEST( RecordStoreTestHarness, Truncate1 ) {
- scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
@@ -347,7 +346,7 @@ namespace mongo {
RecordId loc;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->insertRecord( opCtx.get(), s.c_str(), s.size() + 1, false );
@@ -360,17 +359,17 @@ namespace mongo {
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( s, rs->dataFor( opCtx.get(), loc ).data() );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
rs->truncate( opCtx.get() );
@@ -380,7 +379,7 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
for ( int i = 0; i < N; i++ ) {
@@ -410,13 +409,13 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( N, rs->numRecords( opCtx.get() ) );
}
{
int x = 0;
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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 <boost/scoped_ptr.hpp>
#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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
string data = "my record";
RecordId loc;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->insertRecord( opCtx.get(),
@@ -72,7 +71,7 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
stringstream ss;
ss << "record " << i;
@@ -109,7 +108,7 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
RecordId loc;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
StringDocWriter docWriter( "my record", false );
@@ -142,7 +141,7 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
stringstream ss;
ss << "record " << i;
@@ -178,7 +177,7 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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 <boost/scoped_ptr.hpp>
#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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
stringstream ss;
ss << "record " << i;
@@ -96,13 +95,13 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) );
}
set<RecordId> remain( locs, locs + nToInsert );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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 <algorithm>
-#include <boost/scoped_ptr.hpp>
#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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
stringstream ss;
ss << "record " << i;
@@ -80,13 +79,13 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
stringstream ss;
ss << "record " << i;
@@ -133,13 +132,13 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
stringstream ss;
ss << "record " << i;
@@ -186,13 +185,13 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
stringstream ss;
ss << "record " << i;
@@ -240,13 +239,13 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
StringBuilder sb;
sb << "record " << i;
@@ -295,12 +294,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
StringBuilder sb;
sb << "record " << i;
@@ -370,12 +369,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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 <boost/scoped_ptr.hpp>
#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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> 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 <boost/scoped_ptr.hpp>
#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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
stringstream ss;
ss << "record " << i;
@@ -97,13 +96,13 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) );
}
set<RecordId> remain( locs, locs + nToInsert );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper(newHarnessHelper());
- scoped_ptr<RecordStore> rs(harnessHelper->newNonCappedRecordStore());
+ unique_ptr<HarnessHelper> harnessHelper(newHarnessHelper());
+ unique_ptr<RecordStore> rs(harnessHelper->newNonCappedRecordStore());
{
- scoped_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
ASSERT_EQ(0, rs->numRecords(opCtx.get()));
}
// Insert one record.
RecordId idToInvalidate;
{
- scoped_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
WriteUnitOfWork uow(opCtx.get());
StatusWith<RecordId> 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<OperationContext> opCtx(harnessHelper->newOperationContext());
+ unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
ASSERT_EQ(1, rs->numRecords(opCtx.get()));
}
{
- scoped_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ unique_ptr<OperationContext> 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 <boost/scoped_ptr.hpp>
#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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
int nToInsert = 10;
for ( int i = 0; i < nToInsert; i++ ) {
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
stringstream ss;
ss << "record " << i;
@@ -70,12 +69,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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 <boost/scoped_ptr.hpp>
#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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
int nToInsert = 10;
for ( int i = 0; i < nToInsert; i++ ) {
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
stringstream ss;
ss << "record " << i;
@@ -91,12 +90,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
int nToInsert = 10;
for ( int i = 0; i < nToInsert; i++ ) {
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
stringstream ss;
ss << "record " << i;
@@ -155,12 +154,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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 <boost/scoped_ptr.hpp>
#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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
ASSERT_OK( rs->truncate( opCtx.get() ) );
@@ -61,7 +60,7 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
int nToInsert = 10;
for ( int i = 0; i < nToInsert; i++ ) {
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
stringstream ss;
ss << "record " << i;
@@ -96,12 +95,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
ASSERT_OK( rs->truncate( opCtx.get() ) );
@@ -110,7 +109,7 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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 <boost/scoped_ptr.hpp>
#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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
string data = "my record";
RecordId loc;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->insertRecord( opCtx.get(),
@@ -71,13 +70,13 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) );
}
data = "updated record-";
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->updateRecord( opCtx.get(),
@@ -93,7 +92,7 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
RecordData record = rs->dataFor( opCtx.get(), loc );
ASSERT_EQUALS( data.size() + 1, static_cast<size_t>( record.size() ) );
@@ -104,18 +103,18 @@ namespace mongo {
// Insert multiple records and try to update them.
TEST( RecordStoreTestHarness, UpdateMultipleRecords ) {
- scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
stringstream ss;
ss << "record " << i;
@@ -133,12 +132,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) );
}
for ( int i = 0; i < nToInsert; i++ ) {
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
stringstream ss;
ss << "update record-" << i;
@@ -158,7 +157,7 @@ namespace mongo {
}
for ( int i = 0; i < nToInsert; i++ ) {
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
string oldData = "my record";
RecordId loc;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->insertRecord( opCtx.get(),
@@ -198,13 +197,13 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) );
}
string newData = "my updated record--";
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
UpdateNotifierSpy umn( opCtx.get(), loc, oldData.c_str(), oldData.size() );
@@ -233,7 +232,7 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
RecordData record = rs->dataFor( opCtx.get(), loc );
ASSERT_EQUALS( newData.size() + 1, static_cast<size_t>( 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 <boost/scoped_ptr.hpp>
#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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
if (!rs->updateWithDamagesSupported())
return;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->insertRecord( opCtx.get(),
@@ -73,12 +72,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
mutablebson::DamageVector dv( 3 );
dv[0].sourceOffset = 5;
@@ -99,7 +98,7 @@ namespace mongo {
data = "11101000";
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
if (!rs->updateWithDamagesSupported())
return;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->insertRecord( opCtx.get(),
@@ -139,12 +138,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
mutablebson::DamageVector dv( 2 );
dv[0].sourceOffset = 3;
@@ -162,7 +161,7 @@ namespace mongo {
data = "10100010";
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
if (!rs->updateWithDamagesSupported())
return;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->insertRecord( opCtx.get(),
@@ -203,12 +202,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
mutablebson::DamageVector dv( 2 );
dv[0].sourceOffset = 0;
@@ -226,7 +225,7 @@ namespace mongo {
data = "10111010";
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
if (!rs->updateWithDamagesSupported())
return;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->insertRecord( opCtx.get(),
@@ -265,12 +264,12 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 1, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
mutablebson::DamageVector dv;
@@ -281,7 +280,7 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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 <boost/scoped_ptr.hpp>
#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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
ValidateAdaptorSpy adaptor;
ValidateResults results;
@@ -165,7 +164,7 @@ namespace {
// should not be used.
TEST_F( ValidateTest, ValidateNonEmpty ) {
{
- scoped_ptr<OperationContext> opCtx( newOperationContext() );
+ unique_ptr<OperationContext> opCtx( newOperationContext() );
{
ValidateAdaptorSpy adaptor;
ValidateResults results;
@@ -187,7 +186,7 @@ namespace {
// should not be used.
TEST_F( ValidateTest, ValidateAndScanDataNonEmpty ) {
{
- scoped_ptr<OperationContext> opCtx( newOperationContext() );
+ unique_ptr<OperationContext> opCtx( newOperationContext() );
{
ValidateAdaptorSpy adaptor;
ValidateResults results;
@@ -209,7 +208,7 @@ namespace {
// should not be used.
TEST_F( ValidateTest, FullValidateNonEmpty ) {
{
- scoped_ptr<OperationContext> opCtx( newOperationContext() );
+ unique_ptr<OperationContext> opCtx( newOperationContext() );
{
ValidateAdaptorSpy adaptor;
ValidateResults results;
@@ -230,7 +229,7 @@ namespace {
// returns an OK status.
TEST_F( ValidateTest, FullValidateNonEmptyAndScanData ) {
{
- scoped_ptr<OperationContext> opCtx( newOperationContext() );
+ unique_ptr<OperationContext> 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 <boost/scoped_ptr.hpp>
#include "mongo/db/storage/record_data.h"
#include "mongo/db/storage/record_store.h"
@@ -81,13 +80,13 @@ namespace {
void setUp() {
{
- boost::scoped_ptr<OperationContext> opCtx( newOperationContext() );
+ std::unique_ptr<OperationContext> opCtx( newOperationContext() );
ASSERT_EQUALS( 0, _rs->numRecords( opCtx.get() ) );
}
int nToInsert = 10;
for ( int i = 0; i < nToInsert; i++ ) {
- boost::scoped_ptr<OperationContext> opCtx( newOperationContext() );
+ std::unique_ptr<OperationContext> opCtx( newOperationContext() );
{
std::stringstream ss;
ss << "record " << i;
@@ -105,14 +104,14 @@ namespace {
}
{
- boost::scoped_ptr<OperationContext> opCtx( newOperationContext() );
+ std::unique_ptr<OperationContext> opCtx( newOperationContext() );
ASSERT_EQUALS( nToInsert, _rs->numRecords( opCtx.get() ) );
}
}
private:
- boost::scoped_ptr<HarnessHelper> _harnessHelper;
- boost::scoped_ptr<RecordStore> _rs;
+ std::unique_ptr<HarnessHelper> _harnessHelper;
+ std::unique_ptr<RecordStore> _rs;
std::set<std::string> _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 <boost/scoped_ptr.hpp>
+#include <memory>
#include <string>
#include "mongo/base/disallow_copying.h"
@@ -89,7 +89,7 @@ namespace mongo {
bool _uncleanShutdown;
class LockFileHandle;
- boost::scoped_ptr<LockFileHandle> _lockFileHandle;
+ std::unique_ptr<LockFileHandle> _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 <boost/filesystem.hpp>
-#include <boost/scoped_ptr.hpp>
#include <fstream>
#include <ostream>
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 <boost/scoped_ptr.hpp>
#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 <boost/scoped_ptr.hpp>
#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<StorageFactoriesIterator> sfi(getGlobalServiceContext()->
+ std::unique_ptr<StorageFactoriesIterator> 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 <set>
#include <string>
-#include <boost/scoped_ptr.hpp>
#include <boost/thread/mutex.hpp>
#include <wiredtiger.h>
@@ -140,7 +139,7 @@ namespace mongo {
WT_CONNECTION* _conn;
WT_EVENT_HANDLER _eventHandler;
- boost::scoped_ptr<WiredTigerSessionCache> _sessionCache;
+ std::unique_ptr<WiredTigerSessionCache> _sessionCache;
std::string _path;
bool _durable;
@@ -150,7 +149,7 @@ namespace mongo {
std::set<std::string> _identToDrop;
mutable boost::mutex _identToDropMutex;
- boost::scoped_ptr<WiredTigerSizeStorer> _sizeStorer;
+ std::unique_ptr<WiredTigerSizeStorer> _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<WiredTigerKVEngine> _engine;
+ std::unique_ptr<WiredTigerKVEngine> _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 <boost/scoped_ptr.hpp>
#include <boost/shared_array.hpp>
#include <wiredtiger.h>
@@ -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 <set>
#include <string>
-#include <boost/scoped_ptr.hpp>
#include <boost/thread/mutex.hpp>
#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 <boost/scoped_ptr.hpp>
#include <sstream>
#include <string>
@@ -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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
RecordId loc1;
RecordId loc2;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
@@ -214,11 +213,11 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> t1( harnessHelper->newOperationContext() );
- scoped_ptr<OperationContext> t2( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> t1( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> t2( harnessHelper->newOperationContext() );
- scoped_ptr<WriteUnitOfWork> w1( new WriteUnitOfWork( t1.get() ) );
- scoped_ptr<WriteUnitOfWork> w2( new WriteUnitOfWork( t2.get() ) );
+ unique_ptr<WriteUnitOfWork> w1( new WriteUnitOfWork( t1.get() ) );
+ unique_ptr<WriteUnitOfWork> 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> harnessHelper( newHarnessHelper() );
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
RecordId loc1;
RecordId loc2;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
@@ -265,8 +264,8 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> t1( harnessHelper->newOperationContext() );
- scoped_ptr<OperationContext> t2( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> t1( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> t2( harnessHelper->newOperationContext() );
// ensure we start transactions
rs->dataFor( t1.get(), loc2 );
@@ -295,8 +294,8 @@ namespace mongo {
}
TEST(WiredTigerRecordStoreTest, SizeStorer1 ) {
- scoped_ptr<WiredTigerHarnessHelper> harnessHelper(new WiredTigerHarnessHelper());
- scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
+ unique_ptr<WiredTigerHarnessHelper> harnessHelper(new WiredTigerHarnessHelper());
+ unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() );
string uri = checked_cast<WiredTigerRecordStore*>( rs.get() )->getURI();
@@ -307,7 +306,7 @@ namespace mongo {
int N = 12;
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
for ( int i = 0; i < N; i++ ) {
@@ -319,7 +318,7 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( N, rs->numRecords( opCtx.get() ) );
}
@@ -333,18 +332,18 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
rs.reset( new WiredTigerRecordStore( opCtx.get(), "a.b", uri,
false, -1, -1, NULL, &ss ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
ASSERT_EQUALS( N, rs->numRecords( opCtx.get() ) );
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
WiredTigerRecoveryUnit* ru =
checked_cast<WiredTigerRecoveryUnit*>( opCtx->recoveryUnit() );
@@ -359,7 +358,7 @@ namespace mongo {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx(harnessHelper->newOperationContext());
+ unique_ptr<OperationContext> 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<WiredTigerHarnessHelper> harnessHelper;
- boost::scoped_ptr<WiredTigerSizeStorer> sizeStorer;
- boost::scoped_ptr<RecordStore> rs;
+ std::unique_ptr<WiredTigerHarnessHelper> harnessHelper;
+ std::unique_ptr<WiredTigerSizeStorer> sizeStorer;
+ std::unique_ptr<RecordStore> 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<OperationContext> opCtx(harnessHelper->newOperationContext());
+ unique_ptr<OperationContext> 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<OperationContext> opCtx(harnessHelper->newOperationContext());
+ unique_ptr<OperationContext> 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<OperationContext> opCtx(harnessHelper->newOperationContext());
+ unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
BadValidateAdaptor adaptor;
ValidateResults results;
BSONObjBuilder output;
@@ -489,7 +488,7 @@ namespace {
TEST_F(SizeStorerValidateTest, InvalidSizeStorerAtCreation) {
rs.reset(NULL);
- scoped_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ unique_ptr<OperationContext> 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<RecordId> insertBSON(scoped_ptr<OperationContext>& opCtx,
- scoped_ptr<RecordStore>& rs,
+ StatusWith<RecordId> insertBSON(unique_ptr<OperationContext>& opCtx,
+ unique_ptr<RecordStore>& 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<RecordStore> rs(harnessHelper.newNonCappedRecordStore("local.oplog.foo"));
+ unique_ptr<RecordStore> rs(harnessHelper.newNonCappedRecordStore("local.oplog.foo"));
{
- scoped_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
+ unique_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
// always illegal
ASSERT_EQ(insertBSON(opCtx, rs, Timestamp(2,-1)).getStatus(),
@@ -571,7 +570,7 @@ namespace {
}
{
- scoped_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
+ unique_ptr<OperationContext> 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<OperationContext> opCtx(harnessHelper.newOperationContext());
+ unique_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
rs->temp_cappedTruncateAfter(opCtx.get(), RecordId(2,2), false); // no-op
}
{
- scoped_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
+ unique_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
ASSERT_EQ(rs->oplogStartHack(opCtx.get(), RecordId(2,3)), RecordId(2,2));
}
{
- scoped_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
+ unique_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
rs->temp_cappedTruncateAfter(opCtx.get(), RecordId(1,2), false); // deletes 2,2
}
{
- scoped_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
+ unique_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
ASSERT_EQ(rs->oplogStartHack(opCtx.get(), RecordId(2,3)), RecordId(1,2));
}
{
- scoped_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
+ unique_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
rs->temp_cappedTruncateAfter(opCtx.get(), RecordId(1,2), true); // deletes 1,2
}
{
- scoped_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
+ unique_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
ASSERT_EQ(rs->oplogStartHack(opCtx.get(), RecordId(2,3)), RecordId(1,1));
}
{
- scoped_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
+ unique_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
WriteUnitOfWork wuow(opCtx.get());
ASSERT_OK(rs->truncate(opCtx.get())); // deletes 1,1 and leaves collection empty
wuow.commit();
}
{
- scoped_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
+ unique_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
ASSERT_EQ(rs->oplogStartHack(opCtx.get(), RecordId(2,3)), RecordId());
}
}
TEST(WiredTigerRecordStoreTest, OplogHackOnNonOplog) {
WiredTigerHarnessHelper harnessHelper;
- scoped_ptr<RecordStore> rs(harnessHelper.newNonCappedRecordStore("local.NOT_oplog.foo"));
+ unique_ptr<RecordStore> rs(harnessHelper.newNonCappedRecordStore("local.NOT_oplog.foo"));
- scoped_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
+ unique_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
BSONObj obj = BSON( "ts" << Timestamp(2,-1) );
{
@@ -639,13 +638,13 @@ namespace {
}
TEST(WiredTigerRecordStoreTest, CappedOrder) {
- scoped_ptr<WiredTigerHarnessHelper> harnessHelper( new WiredTigerHarnessHelper() );
- scoped_ptr<RecordStore> rs(harnessHelper->newCappedRecordStore("a.b", 100000,10000));
+ unique_ptr<WiredTigerHarnessHelper> harnessHelper( new WiredTigerHarnessHelper() );
+ unique_ptr<RecordStore> rs(harnessHelper->newCappedRecordStore("a.b", 100000,10000));
RecordId loc1;
{ // first insert a document
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->insertRecord( opCtx.get(), "a", 2, false );
@@ -656,7 +655,7 @@ namespace {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> t1( harnessHelper->newOperationContext() );
- scoped_ptr<WriteUnitOfWork> w1( new WriteUnitOfWork( t1.get() ) );
+ unique_ptr<OperationContext> t1( harnessHelper->newOperationContext() );
+ unique_ptr<WriteUnitOfWork> w1( new WriteUnitOfWork( t1.get() ) );
rs->insertRecord( t1.get(), "b", 2, false );
// do not commit yet
{ // create 2nd doc
- scoped_ptr<OperationContext> t2( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<WiredTigerHarnessHelper> harnessHelper( new WiredTigerHarnessHelper() );
- scoped_ptr<RecordStore> rs(harnessHelper->newCappedRecordStore("a.b", 10000, 5));
+ unique_ptr<WiredTigerHarnessHelper> harnessHelper( new WiredTigerHarnessHelper() );
+ unique_ptr<RecordStore> rs(harnessHelper->newCappedRecordStore("a.b", 10000, 5));
{ // first insert 3 documents
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
for ( int i = 0; i < 3; ++i ) {
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->insertRecord( opCtx.get(), "a", 2, false );
@@ -717,14 +716,14 @@ namespace {
}
// set up our cursor that should rollover
- scoped_ptr<OperationContext> cursorCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
for ( int i = 0; i < 100; i++ ) {
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->insertRecord( opCtx.get(), "a", 2, false );
@@ -739,7 +738,7 @@ namespace {
}
RecordId _oplogOrderInsertOplog( OperationContext* txn,
- scoped_ptr<RecordStore>& rs,
+ unique_ptr<RecordStore>& rs,
int inc ) {
Timestamp opTime = Timestamp(5,inc);
WiredTigerRecordStore* wrs = checked_cast<WiredTigerRecordStore*>(rs.get());
@@ -752,8 +751,8 @@ namespace {
}
TEST(WiredTigerRecordStoreTest, OplogOrder) {
- scoped_ptr<WiredTigerHarnessHelper> harnessHelper( new WiredTigerHarnessHelper() );
- scoped_ptr<RecordStore> rs(harnessHelper->newCappedRecordStore("local.oplog.foo",
+ unique_ptr<WiredTigerHarnessHelper> harnessHelper( new WiredTigerHarnessHelper() );
+ unique_ptr<RecordStore> rs(harnessHelper->newCappedRecordStore("local.oplog.foo",
100000,
-1));
@@ -766,7 +765,7 @@ namespace {
RecordId loc1;
{ // first insert a document
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
{
WriteUnitOfWork uow( opCtx.get() );
loc1 = _oplogOrderInsertOplog( opCtx.get(), rs, 1 );
@@ -775,7 +774,7 @@ namespace {
}
{
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> t1( harnessHelper->newOperationContext() );
- scoped_ptr<WriteUnitOfWork> w1( new WriteUnitOfWork( t1.get() ) );
+ unique_ptr<OperationContext> t1( harnessHelper->newOperationContext() );
+ unique_ptr<WriteUnitOfWork> w1( new WriteUnitOfWork( t1.get() ) );
_oplogOrderInsertOplog( t1.get(), rs, 2 );
// do not commit yet
{ // create 2nd doc
- scoped_ptr<OperationContext> t2( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> t2( harnessHelper->newOperationContext() );
{
WriteUnitOfWork w2( t2.get() );
_oplogOrderInsertOplog( t2.get(), rs, 3 );
@@ -800,7 +799,7 @@ namespace {
}
{ // state should be the same
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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<RecordStore> rs(harnessHelper.newNonCappedRecordStore("a.b"));
+ unique_ptr<RecordStore> rs(harnessHelper.newNonCappedRecordStore("a.b"));
- scoped_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
+ unique_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
ASSERT_THROWS(rs->storageSize(opCtx.get()), UserException);
}
TEST(WiredTigerRecordStoreTest, AppendCustomStatsMetadata) {
WiredTigerHarnessHelper harnessHelper;
- scoped_ptr<RecordStore> rs(harnessHelper.newNonCappedRecordStore("a.b"));
+ unique_ptr<RecordStore> rs(harnessHelper.newNonCappedRecordStore("a.b"));
- scoped_ptr<OperationContext> opCtx(harnessHelper.newOperationContext());
+ unique_ptr<OperationContext> 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<WiredTigerHarnessHelper> harnessHelper( new WiredTigerHarnessHelper() );
- scoped_ptr<RecordStore> rs(harnessHelper->newCappedRecordStore("a.b", 10000, 50));
+ unique_ptr<WiredTigerHarnessHelper> harnessHelper( new WiredTigerHarnessHelper() );
+ unique_ptr<RecordStore> rs(harnessHelper->newCappedRecordStore("a.b", 10000, 50));
RecordId loc1;
{ // first insert a document
- scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
WriteUnitOfWork uow( opCtx.get() );
StatusWith<RecordId> res = rs->insertRecord( opCtx.get(), "a", 2, false );
ASSERT_OK( res.getStatus() );
@@ -868,7 +867,7 @@ namespace {
uow.commit();
}
- scoped_ptr<OperationContext> cursorCtx( harnessHelper->newOperationContext() );
+ unique_ptr<OperationContext> 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 <memory.h>
-#include <boost/scoped_ptr.hpp>
#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 <boost/scoped_ptr.hpp>
#include <sstream>
#include <string>
@@ -116,8 +115,8 @@ namespace mongo {
ASSERT_OK(wtRCToStatus(wtSession->create(wtSession, getURI(), config)));
}
private:
- boost::scoped_ptr<WiredTigerUtilHarnessHelper> _harnessHelper;
- boost::scoped_ptr<OperationContext> _opCtx;
+ std::unique_ptr<WiredTigerUtilHarnessHelper> _harnessHelper;
+ std::unique_ptr<OperationContext> _opCtx;
};
TEST_F(WiredTigerUtilMetadataTest, GetConfigurationStringInvalidURI) {