summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/sorted_data_interface_test_insert.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/storage/sorted_data_interface_test_insert.cpp')
-rw-r--r--src/mongo/db/storage/sorted_data_interface_test_insert.cpp476
1 files changed, 239 insertions, 237 deletions
diff --git a/src/mongo/db/storage/sorted_data_interface_test_insert.cpp b/src/mongo/db/storage/sorted_data_interface_test_insert.cpp
index 2aa254f2f3f..71ec797cc17 100644
--- a/src/mongo/db/storage/sorted_data_interface_test_insert.cpp
+++ b/src/mongo/db/storage/sorted_data_interface_test_insert.cpp
@@ -37,325 +37,327 @@
namespace mongo {
- // Insert a key and verify that the number of entries in the index equals 1.
- TEST( SortedDataInterface, Insert ) {
- 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() ) );
- }
+// Insert a key and verify that the number of entries in the index equals 1.
+TEST(SortedDataInterface, Insert) {
+ 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()));
+ }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
{
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- {
- WriteUnitOfWork uow( opCtx.get() );
- ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) );
- uow.commit();
- }
+ WriteUnitOfWork uow(opCtx.get());
+ ASSERT_OK(sorted->insert(opCtx.get(), key1, loc1, true));
+ uow.commit();
}
+ }
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT_EQUALS( 1, sorted->numEntries( opCtx.get() ) );
- }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT_EQUALS(1, sorted->numEntries(opCtx.get()));
}
+}
- // Insert a compound key and verify that the number of entries in the index equals 1.
- TEST( SortedDataInterface, InsertCompoundKey ) {
- const std::unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
- const std::unique_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) );
+// Insert a compound key and verify that the number of entries in the index equals 1.
+TEST(SortedDataInterface, InsertCompoundKey) {
+ 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() ) );
- }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT(sorted->isEmpty(opCtx.get()));
+ }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
{
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- {
- WriteUnitOfWork uow( opCtx.get() );
- ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1a, loc1, true ) );
- uow.commit();
- }
+ WriteUnitOfWork uow(opCtx.get());
+ ASSERT_OK(sorted->insert(opCtx.get(), compoundKey1a, loc1, true));
+ uow.commit();
}
+ }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT_EQUALS(1, sorted->numEntries(opCtx.get()));
+ }
+}
+
+// Insert multiple, distinct keys at the same RecordId and verify that the
+// number of entries in the index equals the number that were inserted, even
+// when duplicates are not allowed.
+TEST(SortedDataInterface, InsertSameDiskLoc) {
+ 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()));
+ }
+
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
{
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT_EQUALS( 1, sorted->numEntries( opCtx.get() ) );
+ WriteUnitOfWork uow(opCtx.get());
+ ASSERT_OK(sorted->insert(opCtx.get(), key1, loc1, true));
+ ASSERT_OK(sorted->insert(opCtx.get(), key2, loc1, true));
+ uow.commit();
}
}
- // Insert multiple, distinct keys at the same RecordId and verify that the
- // number of entries in the index equals the number that were inserted, even
- // when duplicates are not allowed.
- TEST( SortedDataInterface, InsertSameDiskLoc ) {
- 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_EQUALS(2, sorted->numEntries(opCtx.get()));
+ }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
{
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT( sorted->isEmpty( opCtx.get() ) );
+ WriteUnitOfWork uow(opCtx.get());
+ ASSERT_OK(sorted->insert(opCtx.get(), key3, loc1, true));
+ uow.commit();
}
+ }
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- {
- WriteUnitOfWork uow( opCtx.get() );
- ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) );
- ASSERT_OK( sorted->insert( opCtx.get(), key2, loc1, true ) );
- uow.commit();
- }
- }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT_EQUALS(3, sorted->numEntries(opCtx.get()));
+ }
+}
+
+// Insert multiple, distinct keys at the same RecordId and verify that the
+// number of entries in the index equals the number that were inserted, even
+// when duplicates are allowed.
+TEST(SortedDataInterface, InsertSameDiskLocWithDupsAllowed) {
+ const std::unique_ptr<HarnessHelper> harnessHelper(newHarnessHelper());
+ const std::unique_ptr<SortedDataInterface> sorted(harnessHelper->newSortedDataInterface(true));
+
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT(sorted->isEmpty(opCtx.get()));
+ }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
{
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT_EQUALS( 2, sorted->numEntries( opCtx.get() ) );
+ WriteUnitOfWork uow(opCtx.get());
+ ASSERT_OK(sorted->insert(opCtx.get(), key1, loc1, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), key2, loc1, true /* allow duplicates */));
+ uow.commit();
}
+ }
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- {
- WriteUnitOfWork uow( opCtx.get() );
- ASSERT_OK( sorted->insert( opCtx.get(), key3, loc1, true ) );
- uow.commit();
- }
- }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT_EQUALS(2, sorted->numEntries(opCtx.get()));
+ }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
{
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT_EQUALS( 3, sorted->numEntries( opCtx.get() ) );
+ WriteUnitOfWork uow(opCtx.get());
+ ASSERT_OK(sorted->insert(opCtx.get(), key3, loc1, true /* allow duplicates */));
+ uow.commit();
}
}
- // Insert multiple, distinct keys at the same RecordId and verify that the
- // number of entries in the index equals the number that were inserted, even
- // when duplicates are allowed.
- TEST( SortedDataInterface, InsertSameDiskLocWithDupsAllowed ) {
- const std::unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
- const std::unique_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) );
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT_EQUALS(3, sorted->numEntries(opCtx.get()));
+ }
+}
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT( sorted->isEmpty( opCtx.get() ) );
- }
+// Insert the same key multiple times and verify that only 1 entry exists
+// in the index when duplicates are not allowed.
+TEST(SortedDataInterface, InsertSameKey) {
+ const std::unique_ptr<HarnessHelper> harnessHelper(newHarnessHelper());
+ const std::unique_ptr<SortedDataInterface> sorted(harnessHelper->newSortedDataInterface(true));
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- {
- WriteUnitOfWork uow( opCtx.get() );
- ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) );
- ASSERT_OK( sorted->insert( opCtx.get(), key2, loc1, true /* allow duplicates */ ) );
- uow.commit();
- }
- }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT(sorted->isEmpty(opCtx.get()));
+ }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
{
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT_EQUALS( 2, sorted->numEntries( opCtx.get() ) );
+ WriteUnitOfWork uow(opCtx.get());
+ ASSERT_OK(sorted->insert(opCtx.get(), key1, loc1, false));
+ ASSERT_NOT_OK(sorted->insert(opCtx.get(), key1, loc2, false));
+ uow.commit();
}
+ }
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- {
- WriteUnitOfWork uow( opCtx.get() );
- ASSERT_OK( sorted->insert( opCtx.get(), key3, loc1, true /* allow duplicates */ ) );
- uow.commit();
- }
- }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT_EQUALS(1, sorted->numEntries(opCtx.get()));
+ }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
{
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT_EQUALS( 3, sorted->numEntries( opCtx.get() ) );
+ WriteUnitOfWork uow(opCtx.get());
+ ASSERT_NOT_OK(sorted->insert(opCtx.get(), key1, loc2, false));
+ uow.commit();
}
}
- // Insert the same key multiple times and verify that only 1 entry exists
- // in the index when duplicates are not allowed.
- TEST( SortedDataInterface, InsertSameKey ) {
- const std::unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
- const std::unique_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) );
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT_EQUALS(1, sorted->numEntries(opCtx.get()));
+ }
+}
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT( sorted->isEmpty( opCtx.get() ) );
- }
+namespace {
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- {
- WriteUnitOfWork uow( opCtx.get() );
- ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) );
- ASSERT_NOT_OK( sorted->insert( opCtx.get(), key1, loc2, false ) );
- uow.commit();
- }
- }
+// Insert the same key multiple times and verify that all entries exists
+// in the index when duplicates are allowed. Since it is illegal to open a cursor to an unique
+// index while the unique constraint is violated, this is tested by running the test 3 times,
+// removing all but one loc each time and verifying the correct loc remains.
+void _testInsertSameKeyWithDupsAllowed(const RecordId locs[3]) {
+ for (int keeper = 0; keeper < 3; keeper++) {
+ const std::unique_ptr<HarnessHelper> harnessHelper(newHarnessHelper());
+ const std::unique_ptr<SortedDataInterface> sorted(
+ harnessHelper->newSortedDataInterface(true));
{
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT_EQUALS( 1, sorted->numEntries( opCtx.get() ) );
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT(sorted->isEmpty(opCtx.get()));
}
{
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
{
- WriteUnitOfWork uow( opCtx.get() );
- ASSERT_NOT_OK( sorted->insert( opCtx.get(), key1, loc2, false ) );
+ WriteUnitOfWork uow(opCtx.get());
+ ASSERT_OK(sorted->insert(opCtx.get(), key1, locs[0], false));
+ ASSERT_OK(sorted->insert(opCtx.get(), key1, locs[1], true));
+ ASSERT_OK(sorted->insert(opCtx.get(), key1, locs[2], true));
uow.commit();
}
}
{
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT_EQUALS( 1, sorted->numEntries( opCtx.get() ) );
- }
- }
-
-namespace {
-
- // Insert the same key multiple times and verify that all entries exists
- // in the index when duplicates are allowed. Since it is illegal to open a cursor to an unique
- // index while the unique constraint is violated, this is tested by running the test 3 times,
- // removing all but one loc each time and verifying the correct loc remains.
- void _testInsertSameKeyWithDupsAllowed(const RecordId locs[3]) {
- for (int keeper = 0; keeper < 3; keeper++) {
- const std::unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
- const std::unique_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) );
-
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
{
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT( sorted->isEmpty( opCtx.get() ) );
- }
-
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- {
- WriteUnitOfWork uow( opCtx.get() );
- ASSERT_OK(sorted->insert(opCtx.get(), key1, locs[0], false));
- ASSERT_OK(sorted->insert(opCtx.get(), key1, locs[1], true));
- ASSERT_OK(sorted->insert(opCtx.get(), key1, locs[2], true));
- uow.commit();
- }
- }
-
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- {
- WriteUnitOfWork uow( opCtx.get() );
- for (int i = 0; i < 3; i++) {
- if (i != keeper) {
- sorted->unindex(opCtx.get(), key1, locs[i], true);
- }
+ WriteUnitOfWork uow(opCtx.get());
+ for (int i = 0; i < 3; i++) {
+ if (i != keeper) {
+ sorted->unindex(opCtx.get(), key1, locs[i], true);
}
- uow.commit();
}
+ uow.commit();
}
+ }
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT_EQUALS( 1, sorted->numEntries( opCtx.get() ) );
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT_EQUALS(1, sorted->numEntries(opCtx.get()));
- const std::unique_ptr<SortedDataInterface::Cursor> cursor(sorted->newCursor(opCtx.get()));
- ASSERT_EQ(cursor->seek(key1, true), IndexKeyEntry(key1, locs[keeper]));
- }
+ const std::unique_ptr<SortedDataInterface::Cursor> cursor(
+ sorted->newCursor(opCtx.get()));
+ ASSERT_EQ(cursor->seek(key1, true), IndexKeyEntry(key1, locs[keeper]));
}
}
+}
} // namespace
- TEST( SortedDataInterface, InsertSameKeyWithDupsAllowedLocsAscending ) {
- const RecordId locs[3] = {loc1, loc2, loc3};
- _testInsertSameKeyWithDupsAllowed(locs);
+TEST(SortedDataInterface, InsertSameKeyWithDupsAllowedLocsAscending) {
+ const RecordId locs[3] = {loc1, loc2, loc3};
+ _testInsertSameKeyWithDupsAllowed(locs);
+}
+
+TEST(SortedDataInterface, InsertSameKeyWithDupsAllowedLocsDescending) {
+ const RecordId locs[3] = {loc3, loc2, loc1};
+ _testInsertSameKeyWithDupsAllowed(locs);
+}
+
+// Insert multiple keys and verify that the number of entries
+// in the index equals the number that were inserted.
+TEST(SortedDataInterface, InsertMultiple) {
+ const std::unique_ptr<HarnessHelper> harnessHelper(newHarnessHelper());
+ const std::unique_ptr<SortedDataInterface> sorted(harnessHelper->newSortedDataInterface(true));
+
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT(sorted->isEmpty(opCtx.get()));
}
- TEST( SortedDataInterface, InsertSameKeyWithDupsAllowedLocsDescending ) {
- const RecordId locs[3] = {loc3, loc2, loc1};
- _testInsertSameKeyWithDupsAllowed(locs);
- }
-
- // Insert multiple keys and verify that the number of entries
- // in the index equals the number that were inserted.
- TEST( SortedDataInterface, InsertMultiple ) {
- const std::unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
- const std::unique_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) );
-
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
{
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT( sorted->isEmpty( opCtx.get() ) );
- }
-
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- {
- WriteUnitOfWork uow( opCtx.get() );
- ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) );
- ASSERT_OK( sorted->insert( opCtx.get(), key2, loc2, false ) );
- uow.commit();
- }
+ WriteUnitOfWork uow(opCtx.get());
+ ASSERT_OK(sorted->insert(opCtx.get(), key1, loc1, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), key2, loc2, false));
+ uow.commit();
}
+ }
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT_EQUALS( 2, sorted->numEntries( opCtx.get() ) );
- }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT_EQUALS(2, sorted->numEntries(opCtx.get()));
+ }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
{
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- {
- WriteUnitOfWork uow( opCtx.get() );
- ASSERT_OK( sorted->insert( opCtx.get(), key3, loc3, false ) );
- uow.commit();
- }
+ WriteUnitOfWork uow(opCtx.get());
+ ASSERT_OK(sorted->insert(opCtx.get(), key3, loc3, false));
+ uow.commit();
}
+ }
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT_EQUALS( 3, sorted->numEntries( opCtx.get() ) );
- }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT_EQUALS(3, sorted->numEntries(opCtx.get()));
}
+}
- // Insert multiple compound keys and verify that the number of entries
- // in the index equals the number that were inserted.
- TEST( SortedDataInterface, InsertMultipleCompoundKeys ) {
- const std::unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
- const std::unique_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) );
+// Insert multiple compound keys and verify that the number of entries
+// in the index equals the number that were inserted.
+TEST(SortedDataInterface, InsertMultipleCompoundKeys) {
+ const std::unique_ptr<HarnessHelper> harnessHelper(newHarnessHelper());
+ const std::unique_ptr<SortedDataInterface> sorted(harnessHelper->newSortedDataInterface(true));
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT( sorted->isEmpty( opCtx.get() ) );
- }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT(sorted->isEmpty(opCtx.get()));
+ }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
{
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- {
- WriteUnitOfWork uow( opCtx.get() );
- ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1a, loc1, false ) );
- ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1b, loc2, false ) );
- ASSERT_OK( sorted->insert( opCtx.get(), compoundKey2b, loc3, false ) );
- uow.commit();
- }
+ WriteUnitOfWork uow(opCtx.get());
+ ASSERT_OK(sorted->insert(opCtx.get(), compoundKey1a, loc1, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), compoundKey1b, loc2, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), compoundKey2b, loc3, false));
+ uow.commit();
}
+ }
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT_EQUALS( 3, sorted->numEntries( opCtx.get() ) );
- }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT_EQUALS(3, sorted->numEntries(opCtx.get()));
+ }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
{
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- {
- WriteUnitOfWork uow( opCtx.get() );
- ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1c, loc4, false ) );
- ASSERT_OK( sorted->insert( opCtx.get(), compoundKey3a, loc5, false ) );
- uow.commit();
- }
+ WriteUnitOfWork uow(opCtx.get());
+ ASSERT_OK(sorted->insert(opCtx.get(), compoundKey1c, loc4, false));
+ ASSERT_OK(sorted->insert(opCtx.get(), compoundKey3a, loc5, false));
+ uow.commit();
}
+ }
- {
- const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
- ASSERT_EQUALS( 5, sorted->numEntries( opCtx.get() ) );
- }
+ {
+ const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext());
+ ASSERT_EQUALS(5, sorted->numEntries(opCtx.get()));
}
+}
-} // namespace mongo
+} // namespace mongo