summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/sorted_data_interface_test_spaceused.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/storage/sorted_data_interface_test_spaceused.cpp')
-rw-r--r--src/mongo/db/storage/sorted_data_interface_test_spaceused.cpp106
1 files changed, 53 insertions, 53 deletions
diff --git a/src/mongo/db/storage/sorted_data_interface_test_spaceused.cpp b/src/mongo/db/storage/sorted_data_interface_test_spaceused.cpp
index 49914ff161c..64171093fb2 100644
--- a/src/mongo/db/storage/sorted_data_interface_test_spaceused.cpp
+++ b/src/mongo/db/storage/sorted_data_interface_test_spaceused.cpp
@@ -37,67 +37,67 @@
namespace mongo {
- // Verify that an empty index takes up no space.
- TEST( SortedDataInterface, GetSpaceUsedBytesEmpty ) {
- const std::unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
- const std::unique_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) );
+// Verify that an empty index takes up no space.
+TEST(SortedDataInterface, GetSpaceUsedBytesEmpty) {
+ const std::unique_ptr<HarnessHelper> harnessHelper(newHarnessHelper());
+ const std::unique_ptr<SortedDataInterface> sorted(harnessHelper->newSortedDataInterface(false));
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT( sorted->isEmpty( opCtx.get() ) );
- }
-
- // SERVER-15416 mmapv1 test harness does not use SimpleRecordStoreV1 as its record store
- // and HeapRecordStoreBtree::dataSize does not have an actual implementation
- // {
- // const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- // ASSERT( sorted->getSpaceUsedBytes( opCtx.get() ) == 0 );
- // }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT(sorted->isEmpty(opCtx.get()));
}
- // Verify that a nonempty index takes up some space.
- TEST( SortedDataInterface, GetSpaceUsedBytesNonEmpty ) {
- const std::unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
- const std::unique_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) );
+ // SERVER-15416 mmapv1 test harness does not use SimpleRecordStoreV1 as its record store
+ // and HeapRecordStoreBtree::dataSize does not have an actual implementation
+ // {
+ // const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ // ASSERT( sorted->getSpaceUsedBytes( opCtx.get() ) == 0 );
+ // }
+}
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT( sorted->isEmpty( opCtx.get() ) );
- }
+// Verify that a nonempty index takes up some space.
+TEST(SortedDataInterface, GetSpaceUsedBytesNonEmpty) {
+ const std::unique_ptr<HarnessHelper> harnessHelper(newHarnessHelper());
+ const std::unique_ptr<SortedDataInterface> sorted(harnessHelper->newSortedDataInterface(false));
- int nToInsert = 10;
- for ( int i = 0; i < nToInsert; i++ ) {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- {
- WriteUnitOfWork uow( opCtx.get() );
- BSONObj key = BSON( "" << i );
- RecordId loc( 42, i * 2 );
- ASSERT_OK( sorted->insert( opCtx.get(), key, loc, true ) );
- uow.commit();
- }
- }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT(sorted->isEmpty(opCtx.get()));
+ }
+ int nToInsert = 10;
+ for (int i = 0; i < nToInsert; i++) {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
{
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT_EQUALS( nToInsert, sorted->numEntries( opCtx.get() ) );
+ WriteUnitOfWork uow(opCtx.get());
+ BSONObj key = BSON("" << i);
+ RecordId loc(42, i * 2);
+ ASSERT_OK(sorted->insert(opCtx.get(), key, loc, true));
+ uow.commit();
}
+ }
- // SERVER-15416 mmapv1 test harness does not use SimpleRecordStoreV1 as its record store
- // and HeapRecordStoreBtree::dataSize does not have an actual implementation
- // long long spaceUsedBytes;
- // {
- // const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- // spaceUsedBytes = sorted->getSpaceUsedBytes( opCtx.get() );
- // ASSERT( spaceUsedBytes > 0 );
- // }
-
- // {
- // // getSpaceUsedBytes() returns the same value when called multiple times
- // // and there were not interleaved write operations.
- // const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- // ASSERT_EQUALS( spaceUsedBytes, sorted->getSpaceUsedBytes( opCtx.get() ) );
- // ASSERT_EQUALS( spaceUsedBytes, sorted->getSpaceUsedBytes( opCtx.get() ) );
- // }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT_EQUALS(nToInsert, sorted->numEntries(opCtx.get()));
}
-} // namespace mongo
+ // SERVER-15416 mmapv1 test harness does not use SimpleRecordStoreV1 as its record store
+ // and HeapRecordStoreBtree::dataSize does not have an actual implementation
+ // long long spaceUsedBytes;
+ // {
+ // const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ // spaceUsedBytes = sorted->getSpaceUsedBytes( opCtx.get() );
+ // ASSERT( spaceUsedBytes > 0 );
+ // }
+
+ // {
+ // // getSpaceUsedBytes() returns the same value when called multiple times
+ // // and there were not interleaved write operations.
+ // const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ // ASSERT_EQUALS( spaceUsedBytes, sorted->getSpaceUsedBytes( opCtx.get() ) );
+ // ASSERT_EQUALS( spaceUsedBytes, sorted->getSpaceUsedBytes( opCtx.get() ) );
+ // }
+}
+
+} // namespace mongo