diff options
Diffstat (limited to 'src/mongo/db/storage/record_store_test_repairiter.cpp')
-rw-r--r-- | src/mongo/db/storage/record_store_test_repairiter.cpp | 35 |
1 files changed, 17 insertions, 18 deletions
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) { |