diff options
author | Eliot Horowitz <eliot@10gen.com> | 2014-10-16 09:08:28 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2014-10-16 17:56:42 -0400 |
commit | 34cfe32ab4c0751ceb55b607c05dc593c3dd901c (patch) | |
tree | 708e7fa2ba33df6a195bbae6d957308c07bbf28d | |
parent | 5af2cac9e0de1bf20eba4790ecc3547c679dfd13 (diff) | |
download | mongo-34cfe32ab4c0751ceb55b607c05dc593c3dd901c.tar.gz |
SERVER-13635: pass whether an index is unique or not down through SortedDataInterface
25 files changed, 236 insertions, 221 deletions
diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp index 5da12b6638c..9fe6288a8ea 100644 --- a/src/mongo/db/catalog/index_catalog.cpp +++ b/src/mongo/db/catalog/index_catalog.cpp @@ -970,20 +970,24 @@ namespace { // --------------------------- + namespace { + bool isDupsAllowed( IndexDescriptor* desc ) { + bool isUnique = desc->unique() || KeyPattern::isIdKeyPattern(desc->keyPattern()); + if ( !isUnique ) + return true; + + return repl::getGlobalReplicationCoordinator()->shouldIgnoreUniqueIndex(desc); + } + + } + Status IndexCatalog::_indexRecord(OperationContext* txn, IndexCatalogEntry* index, const BSONObj& obj, const DiskLoc &loc ) { InsertDeleteOptions options; options.logIfError = false; - - bool isUnique = - KeyPattern::isIdKeyPattern(index->descriptor()->keyPattern()) || - index->descriptor()->unique(); - - options.dupsAllowed = - repl::getGlobalReplicationCoordinator()->shouldIgnoreUniqueIndex(index->descriptor()) - || !isUnique; + options.dupsAllowed = isDupsAllowed( index->descriptor() ); int64_t inserted; return index->accessMethod()->insert(txn, obj, loc, options, &inserted); @@ -996,6 +1000,7 @@ namespace { bool logIfError) { InsertDeleteOptions options; options.logIfError = logIfError; + options.dupsAllowed = isDupsAllowed( index->descriptor() ); int64_t removed; Status status = index->accessMethod()->remove(txn, obj, loc, options, &removed); diff --git a/src/mongo/db/index/btree_based_access_method.cpp b/src/mongo/db/index/btree_based_access_method.cpp index d4df4f03562..12fac43e15e 100644 --- a/src/mongo/db/index/btree_based_access_method.cpp +++ b/src/mongo/db/index/btree_based_access_method.cpp @@ -110,7 +110,7 @@ namespace mongo { // Clean up after ourselves. for (BSONObjSet::const_iterator j = keys.begin(); j != i; ++j) { - removeOneKey(txn, *j, loc); + removeOneKey(txn, *j, loc, options.dupsAllowed); *numInserted = 0; } @@ -126,11 +126,12 @@ namespace mongo { bool BtreeBasedAccessMethod::removeOneKey(OperationContext* txn, const BSONObj& key, - const DiskLoc& loc) { + const DiskLoc& loc, + bool dupsAllowed) { bool ret = false; try { - ret = _newInterface->unindex(txn, key, loc); + ret = _newInterface->unindex(txn, key, loc, dupsAllowed); } catch (AssertionException& e) { log() << "Assertion failure: _unindex failed " << _descriptor->indexNamespace() << endl; @@ -160,7 +161,7 @@ namespace mongo { *numDeleted = 0; for (BSONObjSet::const_iterator i = keys.begin(); i != keys.end(); ++i) { - bool thisKeyOK = removeOneKey(txn, *i, loc); + bool thisKeyOK = removeOneKey(txn, *i, loc, options.dupsAllowed); if (thisKeyOK) { ++*numDeleted; @@ -297,7 +298,10 @@ namespace mongo { } for (size_t i = 0; i < data->removed.size(); ++i) { - _newInterface->unindex(txn, *data->removed[i], data->loc); + _newInterface->unindex(txn, + *data->removed[i], + data->loc, + data->dupsAllowed); } for (size_t i = 0; i < data->added.size(); ++i) { diff --git a/src/mongo/db/index/btree_based_access_method.h b/src/mongo/db/index/btree_based_access_method.h index 386d36e2e23..f30a2e946de 100644 --- a/src/mongo/db/index/btree_based_access_method.h +++ b/src/mongo/db/index/btree_based_access_method.h @@ -134,7 +134,8 @@ namespace mongo { private: bool removeOneKey(OperationContext* txn, const BSONObj& key, - const DiskLoc& loc); + const DiskLoc& loc, + bool dupsAllowed); scoped_ptr<SortedDataInterface> _newInterface; }; diff --git a/src/mongo/db/storage/heap1/heap1_btree_impl.cpp b/src/mongo/db/storage/heap1/heap1_btree_impl.cpp index 156e81de0d1..f8f93f3205c 100644 --- a/src/mongo/db/storage/heap1/heap1_btree_impl.cpp +++ b/src/mongo/db/storage/heap1/heap1_btree_impl.cpp @@ -170,7 +170,10 @@ namespace { return Status::OK(); } - virtual bool unindex(OperationContext* txn, const BSONObj& key, const DiskLoc& loc) { + virtual bool unindex(OperationContext* txn, + const BSONObj& key, + const DiskLoc& loc, + bool dupsAllowed) { invariant(!loc.isNull()); invariant(loc.isValid()); invariant(!hasFieldNames(key)); diff --git a/src/mongo/db/storage/heap1/heap1_btree_impl_test.cpp b/src/mongo/db/storage/heap1/heap1_btree_impl_test.cpp index 0e89bc46a7f..32517f4f7b6 100644 --- a/src/mongo/db/storage/heap1/heap1_btree_impl_test.cpp +++ b/src/mongo/db/storage/heap1/heap1_btree_impl_test.cpp @@ -41,7 +41,7 @@ namespace mongo { : _order( Ordering::make( BSONObj() ) ) { } - virtual SortedDataInterface* newSortedDataInterface() { + virtual SortedDataInterface* newSortedDataInterface( bool unique ) { return getHeap1BtreeImpl(_order, &_data); } diff --git a/src/mongo/db/storage/heap1/heap1_recovery_unit.cpp b/src/mongo/db/storage/heap1/heap1_recovery_unit.cpp index f95370851ab..cdbebf37041 100644 --- a/src/mongo/db/storage/heap1/heap1_recovery_unit.cpp +++ b/src/mongo/db/storage/heap1/heap1_recovery_unit.cpp @@ -65,7 +65,7 @@ namespace mongo { const IndexInfo& ii = frame.indexMods[i-1]; SortedDataInterface* idx = ii.idx; if ( ii.insert ) - idx->unindex( NULL, ii.obj, ii.loc ); + idx->unindex( NULL, ii.obj, ii.loc, true ); else idx->insert( NULL, ii.obj, ii.loc, true ); } 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 5bcc4aec02d..6ddb358edf3 100644 --- a/src/mongo/db/storage/mmap_v1/btree/btree_interface.cpp +++ b/src/mongo/db/storage/mmap_v1/btree/btree_interface.cpp @@ -87,7 +87,8 @@ namespace mongo { virtual bool unindex(OperationContext* txn, const BSONObj& key, - const DiskLoc& loc) { + const DiskLoc& loc, + bool dupsAllowed) { return _btree->unindex(txn, key, loc); } diff --git a/src/mongo/db/storage/mmap_v1/btree/btree_interface_test.cpp b/src/mongo/db/storage/mmap_v1/btree/btree_interface_test.cpp index cd7ff76989c..40537c07d89 100644 --- a/src/mongo/db/storage/mmap_v1/btree/btree_interface_test.cpp +++ b/src/mongo/db/storage/mmap_v1/btree/btree_interface_test.cpp @@ -42,7 +42,7 @@ namespace mongo { _order( Ordering::make( BSONObj() ) ) { } - virtual SortedDataInterface* newSortedDataInterface() { + virtual SortedDataInterface* newSortedDataInterface( bool unique ) { auto_ptr<SortedDataInterface> sorted( getMMAPV1Interface( &_headManager, &_recordStore, _order, diff --git a/src/mongo/db/storage/sorted_data_interface.h b/src/mongo/db/storage/sorted_data_interface.h index 32776604374..a7888acad75 100644 --- a/src/mongo/db/storage/sorted_data_interface.h +++ b/src/mongo/db/storage/sorted_data_interface.h @@ -79,7 +79,8 @@ namespace mongo { virtual bool unindex(OperationContext* txn, const BSONObj& key, - const DiskLoc& loc) = 0; + const DiskLoc& loc, + bool dupsAllowed) = 0; // TODO: Hide this by exposing an update method? virtual Status dupKeyCheck(OperationContext* txn, diff --git a/src/mongo/db/storage/sorted_data_interface_test_bulkbuilder.cpp b/src/mongo/db/storage/sorted_data_interface_test_bulkbuilder.cpp index ff0102d28dc..f058d98231d 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_bulkbuilder.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_bulkbuilder.cpp @@ -38,7 +38,7 @@ namespace mongo { // Add a key using a bulk builder. TEST( SortedDataInterface, BuilderAddKey ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -48,7 +48,7 @@ namespace mongo { { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); scoped_ptr<SortedDataBuilderInterface> builder( - sorted->getBulkBuilder( opCtx.get(), false ) ); + sorted->getBulkBuilder( opCtx.get(), true ) ); ASSERT_OK( builder->addKey( key1, loc1 ) ); builder->commit( false ); @@ -63,7 +63,7 @@ namespace mongo { // Add a compound key using a bulk builder. TEST( SortedDataInterface, BuilderAddCompoundKey ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -73,7 +73,7 @@ namespace mongo { { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); scoped_ptr<SortedDataBuilderInterface> builder( - sorted->getBulkBuilder( opCtx.get(), false ) ); + sorted->getBulkBuilder( opCtx.get(), true ) ); ASSERT_OK( builder->addKey( compoundKey1a, loc1 ) ); builder->commit( false ); @@ -90,7 +90,7 @@ namespace mongo { // not allowed. TEST( SortedDataInterface, BuilderAddSameKey ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -117,7 +117,7 @@ namespace mongo { // the returned status is OK when duplicates are allowed. TEST( SortedDataInterface, BuilderAddSameKeyWithDupsAllowed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -143,7 +143,7 @@ namespace mongo { // Add multiple keys using a bulk builder. TEST( SortedDataInterface, BuilderAddMultipleKeys ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -153,7 +153,7 @@ namespace mongo { { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); scoped_ptr<SortedDataBuilderInterface> builder( - sorted->getBulkBuilder( opCtx.get(), false ) ); + sorted->getBulkBuilder( opCtx.get(), true ) ); ASSERT_OK( builder->addKey( key1, loc1 ) ); ASSERT_OK( builder->addKey( key2, loc2 ) ); @@ -170,7 +170,7 @@ namespace mongo { // Add multiple compound keys using a bulk builder. TEST( SortedDataInterface, BuilderAddMultipleCompoundKeys ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -180,7 +180,7 @@ namespace mongo { { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); scoped_ptr<SortedDataBuilderInterface> builder( - sorted->getBulkBuilder( opCtx.get(), false ) ); + sorted->getBulkBuilder( opCtx.get(), true ) ); ASSERT_OK( builder->addKey( compoundKey1a, loc1 ) ); ASSERT_OK( builder->addKey( compoundKey1b, loc2 ) ); diff --git a/src/mongo/db/storage/sorted_data_interface_test_cursor.cpp b/src/mongo/db/storage/sorted_data_interface_test_cursor.cpp index 3a22f66099a..87583fdcdd8 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_cursor.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_cursor.cpp @@ -38,7 +38,7 @@ namespace mongo { // Call getDirection() on a forward cursor and verify the result equals +1. TEST( SortedDataInterface, GetCursorDirection ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -50,7 +50,7 @@ namespace mongo { // Call getDirection() on a reverse cursor and verify the result equals -1. TEST( SortedDataInterface, GetCursorDirectionReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -62,7 +62,7 @@ namespace mongo { // Verify that a forward cursor is positioned at EOF when the index is empty. TEST( SortedDataInterface, CursorIsEOFWhenEmpty ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -85,7 +85,7 @@ namespace mongo { // Verify that a reverse cursor is positioned at EOF when the index is empty. TEST( SortedDataInterface, CursorIsEOFWhenEmptyReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -109,7 +109,7 @@ namespace mongo { // When a cursor positioned at EOF is advanced, it stays at EOF. TEST( SortedDataInterface, ExhaustCursor ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -123,7 +123,7 @@ namespace mongo { WriteUnitOfWork uow( opCtx.get() ); BSONObj key = BSON( "" << i ); DiskLoc loc( 42, i * 2 ); - ASSERT_OK( sorted->insert( opCtx.get(), key, loc, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key, loc, true ) ); uow.commit(); } } @@ -155,7 +155,7 @@ namespace mongo { // When a cursor positioned at EOF is advanced, it stays at EOF. TEST( SortedDataInterface, ExhaustCursorReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -169,7 +169,7 @@ namespace mongo { WriteUnitOfWork uow( opCtx.get() ); BSONObj key = BSON( "" << i ); DiskLoc loc( 42, i * 2 ); - ASSERT_OK( sorted->insert( opCtx.get(), key, loc, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key, loc, true ) ); uow.commit(); } } diff --git a/src/mongo/db/storage/sorted_data_interface_test_cursor_advanceto.cpp b/src/mongo/db/storage/sorted_data_interface_test_cursor_advanceto.cpp index ab395472e76..3f70c28ce1a 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_cursor_advanceto.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_cursor_advanceto.cpp @@ -42,7 +42,7 @@ namespace mongo { // order by DiskLoc. TEST( SortedDataInterface, AdvanceTo ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -121,7 +121,7 @@ namespace mongo { // order by DiskLoc. TEST( SortedDataInterface, AdvanceToReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -198,7 +198,7 @@ namespace mongo { // before the current position of the cursor. TEST( SortedDataInterface, AdvanceToKeyBeforeCursorPosition ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -209,8 +209,8 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key2, loc2, true ) ); uow.commit(); } } @@ -266,7 +266,7 @@ namespace mongo { // after the current position of the cursor. TEST( SortedDataInterface, AdvanceToKeyAfterCursorPositionReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -277,8 +277,8 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key2, loc2, true ) ); uow.commit(); } } @@ -336,7 +336,7 @@ namespace mongo { // or inclusive mode. TEST( SortedDataInterface, AdvanceToKeyAtCursorPosition ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -347,7 +347,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); uow.commit(); } } @@ -401,7 +401,7 @@ namespace mongo { // or inclusive mode. TEST( SortedDataInterface, AdvanceToKeyAtCursorPositionReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -412,7 +412,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); uow.commit(); } } @@ -465,7 +465,7 @@ namespace mongo { // positioned at the key that comes after the one specified. TEST( SortedDataInterface, AdvanceToExclusive ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -542,7 +542,7 @@ namespace mongo { // positioned at the key that comes before the one specified. TEST( SortedDataInterface, AdvanceToExclusiveReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -618,7 +618,7 @@ namespace mongo { // exact key and the current position of the cursor. TEST( SortedDataInterface, AdvanceToIndirect ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); BSONObj unusedKey = key6; // larger than any inserted key @@ -631,9 +631,9 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) ); - ASSERT_OK( sorted->insert( opCtx.get(), key3, loc2, false ) ); - ASSERT_OK( sorted->insert( opCtx.get(), key5, loc3, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key3, loc2, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key5, loc3, true ) ); uow.commit(); } } @@ -684,7 +684,7 @@ namespace mongo { // exact key and the current position of the cursor. TEST( SortedDataInterface, AdvanceToIndirectReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); BSONObj unusedKey = key0; // smaller than any inserted key @@ -697,9 +697,9 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) ); - ASSERT_OK( sorted->insert( opCtx.get(), key3, loc2, false ) ); - ASSERT_OK( sorted->insert( opCtx.get(), key5, loc3, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key3, loc2, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key5, loc3, true ) ); uow.commit(); } } @@ -752,7 +752,7 @@ namespace mongo { // that comes after the one specified. TEST( SortedDataInterface, AdvanceToIndirectExclusive ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); BSONObj unusedKey = key6; // larger than any inserted key @@ -765,9 +765,9 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) ); - ASSERT_OK( sorted->insert( opCtx.get(), key3, loc2, false ) ); - ASSERT_OK( sorted->insert( opCtx.get(), key5, loc3, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key3, loc2, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key5, loc3, true ) ); uow.commit(); } } @@ -845,7 +845,7 @@ namespace mongo { // that comes before the one specified. TEST( SortedDataInterface, AdvanceToIndirectExclusiveReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); BSONObj unusedKey = key0; // smaller than any inserted key @@ -858,9 +858,9 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) ); - ASSERT_OK( sorted->insert( opCtx.get(), key3, loc2, false ) ); - ASSERT_OK( sorted->insert( opCtx.get(), key5, loc3, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key3, loc2, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key5, loc3, true ) ); uow.commit(); } } diff --git a/src/mongo/db/storage/sorted_data_interface_test_cursor_locate.cpp b/src/mongo/db/storage/sorted_data_interface_test_cursor_locate.cpp index ec0fbb2b969..b1ffe0ff3bf 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_cursor_locate.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_cursor_locate.cpp @@ -39,7 +39,7 @@ namespace mongo { // by specifying its exact key and DiskLoc. TEST( SortedDataInterface, Locate ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -51,7 +51,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); uow.commit(); } } @@ -73,7 +73,7 @@ namespace mongo { // by specifying its exact key and DiskLoc. TEST( SortedDataInterface, LocateReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -85,7 +85,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); uow.commit(); } } @@ -107,7 +107,7 @@ namespace mongo { // by specifying its exact key and DiskLoc. TEST( SortedDataInterface, LocateCompoundKey ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -119,7 +119,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1a, loc1, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1a, loc1, true ) ); uow.commit(); } } @@ -141,7 +141,7 @@ namespace mongo { // by specifying its exact key and DiskLoc. TEST( SortedDataInterface, LocateCompoundKeyReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -153,7 +153,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1a, loc1, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1a, loc1, true ) ); uow.commit(); } } @@ -175,7 +175,7 @@ namespace mongo { // by specifying their exact key and DiskLoc. TEST( SortedDataInterface, LocateMultiple ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -187,8 +187,8 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key2, loc2, true ) ); uow.commit(); } } @@ -213,7 +213,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key3, loc3, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key3, loc3, true ) ); uow.commit(); } } @@ -254,7 +254,7 @@ namespace mongo { // by specifying their exact key and DiskLoc. TEST( SortedDataInterface, LocateMultipleReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -266,8 +266,8 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key2, loc2, true ) ); uow.commit(); } } @@ -292,7 +292,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key3, loc3, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key3, loc3, true ) ); uow.commit(); } } @@ -333,7 +333,7 @@ namespace mongo { // by specifying their exact key and DiskLoc. TEST( SortedDataInterface, LocateMultipleCompoundKeys ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -345,9 +345,9 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1a, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1b, loc2, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey2b, loc3, true ) ); uow.commit(); } } @@ -376,8 +376,8 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1c, loc4, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey3a, loc5, true ) ); uow.commit(); } } @@ -415,7 +415,7 @@ namespace mongo { // by specifying their exact key and DiskLoc. TEST( SortedDataInterface, LocateMultipleCompoundKeysReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -427,9 +427,9 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1a, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1b, loc2, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey2b, loc3, true ) ); uow.commit(); } } @@ -458,8 +458,8 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1c, loc4, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey3a, loc5, true ) ); uow.commit(); } } @@ -497,7 +497,7 @@ namespace mongo { // by specifying either a smaller key or DiskLoc. TEST( SortedDataInterface, LocateIndirect ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -509,8 +509,8 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key2, loc2, true ) ); uow.commit(); } } @@ -531,7 +531,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key3, loc3, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key3, loc3, true ) ); uow.commit(); } } @@ -561,7 +561,7 @@ namespace mongo { // by specifying either a larger key or DiskLoc. TEST( SortedDataInterface, LocateIndirectReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -573,8 +573,8 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key2, loc2, true ) ); uow.commit(); } } @@ -595,7 +595,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key3, loc3, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key3, loc3, true ) ); uow.commit(); } } @@ -625,7 +625,7 @@ namespace mongo { // by specifying either a smaller key or DiskLoc. TEST( SortedDataInterface, LocateIndirectCompoundKeys ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -637,9 +637,9 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1a, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1b, loc2, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey2b, loc3, true ) ); uow.commit(); } } @@ -664,8 +664,8 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1c, loc4, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey3a, loc5, true ) ); uow.commit(); } } @@ -691,7 +691,7 @@ namespace mongo { // by specifying either a larger key or DiskLoc. TEST( SortedDataInterface, LocateIndirectCompoundKeysReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -703,9 +703,9 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1a, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1b, loc2, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey2b, loc3, true ) ); uow.commit(); } } @@ -730,8 +730,8 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1c, loc4, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey3a, loc5, true ) ); uow.commit(); } } @@ -761,7 +761,7 @@ namespace mongo { // is positioned at EOF. TEST( SortedDataInterface, LocateEmpty ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -781,7 +781,7 @@ namespace mongo { // is positioned at EOF. TEST( SortedDataInterface, LocateEmptyReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); diff --git a/src/mongo/db/storage/sorted_data_interface_test_cursor_position.cpp b/src/mongo/db/storage/sorted_data_interface_test_cursor_position.cpp index 1d0159047b0..b1fe185ecb7 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_cursor_position.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_cursor_position.cpp @@ -39,7 +39,7 @@ namespace mongo { // to point to the same place. TEST( SortedDataInterface, CursorsPointToSamePlaceIfEOF ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -64,7 +64,7 @@ namespace mongo { // to point to the same place. TEST( SortedDataInterface, CursorsPointToSamePlaceIfEOFReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -89,7 +89,7 @@ namespace mongo { // to point to the same place. TEST( SortedDataInterface, CursorsPointToSamePlace ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -137,7 +137,7 @@ namespace mongo { // to point to the same place. TEST( SortedDataInterface, CursorsPointToSamePlaceReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -148,8 +148,8 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key2, loc2, true ) ); uow.commit(); } } @@ -185,7 +185,7 @@ namespace mongo { // to point to the same place. TEST( SortedDataInterface, CursorsPointToDifferentKeys ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -196,8 +196,8 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key2, loc2, true ) ); uow.commit(); } } @@ -223,7 +223,7 @@ namespace mongo { // to point to the same place. TEST( SortedDataInterface, CursorsPointToDifferentKeysReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -234,8 +234,8 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key2, loc2, true ) ); uow.commit(); } } @@ -261,7 +261,7 @@ namespace mongo { // different DiskLocs are not considered to point to the same place. TEST( SortedDataInterface, CursorsPointToDifferentDiskLocs ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -299,7 +299,7 @@ namespace mongo { // different DiskLocs are not considered to point to the same place. TEST( SortedDataInterface, CursorsPointToDifferentDiskLocsReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -337,7 +337,7 @@ namespace mongo { // are considered to point to the same place. TEST( SortedDataInterface, CursorPointsToSamePlaceRegardlessOfDirection ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -397,7 +397,7 @@ namespace mongo { // Verify that a forward cursor always points to the same place as itself. TEST( SortedDataInterface, CursorPointsToSamePlaceAsItself ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -411,7 +411,7 @@ namespace mongo { WriteUnitOfWork uow( opCtx.get() ); BSONObj key = BSON( "" << i ); DiskLoc loc( 42, i * 2 ); - ASSERT_OK( sorted->insert( opCtx.get(), key, loc, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key, loc, true ) ); uow.commit(); } } @@ -437,7 +437,7 @@ namespace mongo { // Verify that a reverse cursor always points to the same place as itself. TEST( SortedDataInterface, CursorPointsToSamePlaceAsItselfReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -451,7 +451,7 @@ namespace mongo { WriteUnitOfWork uow( opCtx.get() ); BSONObj key = BSON( "" << i ); DiskLoc loc( 42, i * 2 ); - ASSERT_OK( sorted->insert( opCtx.get(), key, loc, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key, loc, true ) ); uow.commit(); } } diff --git a/src/mongo/db/storage/sorted_data_interface_test_cursor_saverestore.cpp b/src/mongo/db/storage/sorted_data_interface_test_cursor_saverestore.cpp index 658e7ca473f..36ee79d930b 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_cursor_saverestore.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_cursor_saverestore.cpp @@ -40,7 +40,7 @@ namespace mongo { // restorePosition() in succession. TEST( SortedDataInterface, SaveAndRestorePositionWhileIterateCursor ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -54,7 +54,7 @@ namespace mongo { WriteUnitOfWork uow( opCtx.get() ); BSONObj key = BSON( "" << i ); DiskLoc loc( 42, i * 2 ); - ASSERT_OK( sorted->insert( opCtx.get(), key, loc, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key, loc, true ) ); uow.commit(); } } @@ -85,7 +85,7 @@ namespace mongo { // restorePosition() in succession. TEST( SortedDataInterface, SaveAndRestorePositionWhileIterateCursorReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -99,7 +99,7 @@ namespace mongo { WriteUnitOfWork uow( opCtx.get() ); BSONObj key = BSON( "" << i ); DiskLoc loc( 42, i * 2 ); - ASSERT_OK( sorted->insert( opCtx.get(), key, loc, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key, loc, true ) ); uow.commit(); } } @@ -131,7 +131,7 @@ namespace mongo { // as part of the current position of the cursor. TEST( SortedDataInterface, SaveAndRestorePositionWhileIterateCursorWithDupKeys ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -176,7 +176,7 @@ namespace mongo { // as part of the current position of the cursor. TEST( SortedDataInterface, SaveAndRestorePositionWhileIterateCursorWithDupKeysReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -219,7 +219,7 @@ namespace mongo { // May be useful to run this test under valgrind to verify there are no leaks. TEST( SortedDataInterface, SavePositionWithoutRestore ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -251,7 +251,7 @@ namespace mongo { // May be useful to run this test under valgrind to verify there are no leaks. TEST( SortedDataInterface, SavePositionWithoutRestoreReversed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -262,7 +262,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); uow.commit(); } } diff --git a/src/mongo/db/storage/sorted_data_interface_test_dupkeycheck.cpp b/src/mongo/db/storage/sorted_data_interface_test_dupkeycheck.cpp index 359f80e9950..b160ae9b56e 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_dupkeycheck.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_dupkeycheck.cpp @@ -40,7 +40,7 @@ namespace mongo { // pair that was inserted, it should still return an OK status. TEST( SortedDataInterface, DupKeyCheckAfterInsert ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -76,7 +76,7 @@ namespace mongo { // not exist in the index. TEST( SortedDataInterface, DupKeyCheckEmpty ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -97,7 +97,7 @@ namespace mongo { // when the insert key is located at a DiskLoc that comes after the one specified. TEST( SortedDataInterface, DupKeyCheckWhenDiskLocBefore ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -108,7 +108,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); uow.commit(); } } @@ -132,7 +132,7 @@ namespace mongo { // when the insert key is located at a DiskLoc that comes before the one specified. TEST( SortedDataInterface, DupKeyCheckWhenDiskLocAfter ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -143,7 +143,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); uow.commit(); } } diff --git a/src/mongo/db/storage/sorted_data_interface_test_fullvalidate.cpp b/src/mongo/db/storage/sorted_data_interface_test_fullvalidate.cpp index 454ff7fab2f..afc776da325 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_fullvalidate.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_fullvalidate.cpp @@ -39,7 +39,7 @@ namespace mongo { // the `numKeysOut` as the number of entries in the index, or as -1. TEST( SortedDataInterface, FullValidate ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -53,7 +53,7 @@ namespace mongo { WriteUnitOfWork uow( opCtx.get() ); BSONObj key = BSON( "" << i ); DiskLoc loc( 42, i * 2 ); - ASSERT_OK( sorted->insert( opCtx.get(), key, loc, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key, loc, true ) ); uow.commit(); } } diff --git a/src/mongo/db/storage/sorted_data_interface_test_harness.cpp b/src/mongo/db/storage/sorted_data_interface_test_harness.cpp index e4de9eb5e78..b731931de92 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_harness.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_harness.cpp @@ -37,7 +37,7 @@ namespace mongo { TEST( SortedDataInterface, InsertWithDups1 ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -69,7 +69,7 @@ namespace mongo { TEST( SortedDataInterface, InsertWithDups2 ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -97,7 +97,7 @@ namespace mongo { TEST( SortedDataInterface, InsertWithDups3AndRollback ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -125,7 +125,7 @@ namespace mongo { TEST( SortedDataInterface, InsertNoDups1 ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -154,7 +154,7 @@ namespace mongo { TEST( SortedDataInterface, InsertNoDups2 ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -183,7 +183,7 @@ namespace mongo { TEST( SortedDataInterface, Unindex1 ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -203,7 +203,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT( !sorted->unindex( opCtx.get(), BSON( "" << 1 ), DiskLoc( 5, 20 ) ) ); + ASSERT( !sorted->unindex( opCtx.get(), BSON( "" << 1 ), DiskLoc( 5, 20 ), true ) ); uow.commit(); } } @@ -217,7 +217,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT( !sorted->unindex( opCtx.get(), BSON( "" << 2 ), DiskLoc( 5, 18 ) ) ); + ASSERT( !sorted->unindex( opCtx.get(), BSON( "" << 2 ), DiskLoc( 5, 18 ), true ) ); uow.commit(); } } @@ -232,7 +232,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT( sorted->unindex( opCtx.get(), BSON( "" << 1 ), DiskLoc( 5, 18 ) ) ); + ASSERT( sorted->unindex( opCtx.get(), BSON( "" << 1 ), DiskLoc( 5, 18 ), true ) ); uow.commit(); } } @@ -246,7 +246,7 @@ namespace mongo { TEST( SortedDataInterface, Unindex2Rollback ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -266,7 +266,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT( sorted->unindex( opCtx.get(), BSON( "" << 1 ), DiskLoc( 5, 18 ) ) ); + ASSERT( sorted->unindex( opCtx.get(), BSON( "" << 1 ), DiskLoc( 5, 18 ), true ) ); // no commit } } @@ -281,7 +281,7 @@ namespace mongo { TEST( SortedDataInterface, CursorIterate1 ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); int N = 5; for ( int i = 0; i < N; i++ ) { @@ -313,7 +313,7 @@ namespace mongo { TEST( SortedDataInterface, CursorIterate1WithSaveRestore ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); int N = 5; for ( int i = 0; i < N; i++ ) { @@ -347,7 +347,7 @@ namespace mongo { TEST( SortedDataInterface, CursorIterate2WithSaveRestore ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); int N = 5; for ( int i = 0; i < N; i++ ) { @@ -380,7 +380,7 @@ namespace mongo { TEST( SortedDataInterface, Locate1 ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); BSONObj key = BSON( "" << 1 ); DiskLoc loc( 5, 16 ); @@ -412,7 +412,7 @@ namespace mongo { TEST( SortedDataInterface, Locate2 ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -445,7 +445,7 @@ namespace mongo { TEST( SortedDataInterface, Locate2Empty ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -480,7 +480,7 @@ namespace mongo { TEST( SortedDataInterface, Locate3Descending ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -538,7 +538,7 @@ namespace mongo { TEST( SortedDataInterface, Locate4 ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); diff --git a/src/mongo/db/storage/sorted_data_interface_test_harness.h b/src/mongo/db/storage/sorted_data_interface_test_harness.h index 380770eb9f3..d62641a9f0f 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_harness.h +++ b/src/mongo/db/storage/sorted_data_interface_test_harness.h @@ -73,7 +73,7 @@ namespace mongo { HarnessHelper(){} virtual ~HarnessHelper(){} - virtual SortedDataInterface* newSortedDataInterface() = 0; + virtual SortedDataInterface* newSortedDataInterface( bool unique ) = 0; virtual RecoveryUnit* newRecoveryUnit() = 0; virtual OperationContext* newOperationContext() { 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 3813c46eb1d..03e2f98c485 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_insert.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_insert.cpp @@ -38,7 +38,7 @@ namespace mongo { // Insert a key and verify that the number of entries in the index equals 1. TEST( SortedDataInterface, Insert ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -49,7 +49,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); uow.commit(); } } @@ -63,7 +63,7 @@ namespace mongo { // Insert a compound key and verify that the number of entries in the index equals 1. TEST( SortedDataInterface, InsertCompoundKey ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -74,7 +74,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1a, loc1, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1a, loc1, true ) ); uow.commit(); } } @@ -90,7 +90,7 @@ namespace mongo { // when duplicates are not allowed. TEST( SortedDataInterface, InsertSameDiskLoc ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -101,8 +101,8 @@ namespace mongo { scoped_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, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key2, loc1, true ) ); uow.commit(); } } @@ -116,7 +116,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key3, loc1, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key3, loc1, true ) ); uow.commit(); } } @@ -132,7 +132,7 @@ namespace mongo { // when duplicates are allowed. TEST( SortedDataInterface, InsertSameDiskLocWithDupsAllowed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -173,7 +173,7 @@ namespace mongo { // in the index when duplicates are not allowed. TEST( SortedDataInterface, InsertSameKey ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -214,7 +214,7 @@ namespace mongo { // in the index when duplicates are allowed. TEST( SortedDataInterface, InsertSameKeyWithDupsAllowed ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -255,7 +255,7 @@ namespace mongo { // in the index equals the number that were inserted. TEST( SortedDataInterface, InsertMultiple ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -296,7 +296,7 @@ namespace mongo { // in the index equals the number that were inserted. TEST( SortedDataInterface, InsertMultipleCompoundKeys ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); diff --git a/src/mongo/db/storage/sorted_data_interface_test_isempty.cpp b/src/mongo/db/storage/sorted_data_interface_test_isempty.cpp index f1d64c176fb..11605c39e1e 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_isempty.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_isempty.cpp @@ -40,7 +40,7 @@ namespace mongo { // when that is unindex. TEST( SortedDataInterface, IsEmpty ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -65,7 +65,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT( sorted->unindex( opCtx.get(), key1, loc1 ) ); + ASSERT( sorted->unindex( opCtx.get(), key1, loc1, false ) ); uow.commit(); } } diff --git a/src/mongo/db/storage/sorted_data_interface_test_rollback.cpp b/src/mongo/db/storage/sorted_data_interface_test_rollback.cpp index b0af87362ba..0216f35f575 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_rollback.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_rollback.cpp @@ -39,7 +39,7 @@ namespace mongo { // on the WriteUnitOfWork causes the changes to not become visible. TEST( SortedDataInterface, InsertWithoutCommit ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -81,7 +81,7 @@ namespace mongo { // not become visible. TEST( SortedDataInterface, UnindexWithoutCommit ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -92,8 +92,8 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key2, loc2, true ) ); uow.commit(); } } @@ -107,7 +107,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT( sorted->unindex( opCtx.get(), key2, loc2 ) ); + ASSERT( sorted->unindex( opCtx.get(), key2, loc2, true ) ); // no commit } } @@ -121,7 +121,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key3, loc3, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key3, loc3, true ) ); uow.commit(); } } @@ -135,8 +135,8 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT( sorted->unindex( opCtx.get(), key1, loc1 ) ); - ASSERT( sorted->unindex( opCtx.get(), key3, loc3 ) ); + ASSERT( sorted->unindex( opCtx.get(), key1, loc1, true ) ); + ASSERT( sorted->unindex( opCtx.get(), key3, loc3, true ) ); // no commit } } 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 518bb12ba75..30c4ee75569 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_spaceused.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_spaceused.cpp @@ -38,7 +38,7 @@ namespace mongo { // Verify that an empty index takes up no space. TEST( SortedDataInterface, GetSpaceUsedBytesEmpty ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -56,7 +56,7 @@ namespace mongo { // Verify that a nonempty index takes up some space. TEST( SortedDataInterface, GetSpaceUsedBytesNonEmpty ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -70,7 +70,7 @@ namespace mongo { WriteUnitOfWork uow( opCtx.get() ); BSONObj key = BSON( "" << i ); DiskLoc loc( 42, i * 2 ); - ASSERT_OK( sorted->insert( opCtx.get(), key, loc, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key, loc, true ) ); uow.commit(); } } diff --git a/src/mongo/db/storage/sorted_data_interface_test_touch.cpp b/src/mongo/db/storage/sorted_data_interface_test_touch.cpp index c855d589287..94d7c150da7 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_touch.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_touch.cpp @@ -38,7 +38,7 @@ namespace mongo { // Verify that calling touch() on an empty index returns an OK status. TEST( SortedDataInterface, TouchEmpty ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -49,7 +49,7 @@ namespace mongo { // Verify that calling touch() on a nonempty index returns an OK status. TEST( SortedDataInterface, TouchNonEmpty ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); diff --git a/src/mongo/db/storage/sorted_data_interface_test_unindex.cpp b/src/mongo/db/storage/sorted_data_interface_test_unindex.cpp index 3797f15dca7..4aeb8174e48 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_unindex.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_unindex.cpp @@ -38,7 +38,7 @@ namespace mongo { // Insert a key and verify that it can be unindexed. TEST( SortedDataInterface, Unindex ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -49,7 +49,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); uow.commit(); } } @@ -63,7 +63,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT( sorted->unindex( opCtx.get(), key1, loc1 ) ); + ASSERT( sorted->unindex( opCtx.get(), key1, loc1, true ) ); uow.commit(); } } @@ -77,7 +77,7 @@ namespace mongo { // Insert a compound key and verify that it can be unindexed. TEST( SortedDataInterface, UnindexCompoundKey ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -88,7 +88,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1a, loc1, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), compoundKey1a, loc1, true ) ); uow.commit(); } } @@ -102,7 +102,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT( sorted->unindex( opCtx.get(), compoundKey1a, loc1 ) ); + ASSERT( sorted->unindex( opCtx.get(), compoundKey1a, loc1, true ) ); uow.commit(); } } @@ -116,7 +116,7 @@ namespace mongo { // Insert multiple, distinct keys and verify that they can be unindexed. TEST( SortedDataInterface, UnindexMultipleDistinct ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -127,8 +127,8 @@ namespace mongo { scoped_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 ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, true ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key2, loc2, true ) ); uow.commit(); } } @@ -142,7 +142,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT( sorted->unindex( opCtx.get(), key2, loc2 ) ); + ASSERT( sorted->unindex( opCtx.get(), key2, loc2, true ) ); uow.commit(); } } @@ -156,7 +156,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT_OK( sorted->insert( opCtx.get(), key3, loc3, false ) ); + ASSERT_OK( sorted->insert( opCtx.get(), key3, loc3, true ) ); uow.commit(); } } @@ -170,8 +170,8 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT( sorted->unindex( opCtx.get(), key1, loc1 ) ); - ASSERT( sorted->unindex( opCtx.get(), key3, loc3 ) ); + ASSERT( sorted->unindex( opCtx.get(), key1, loc1, true ) ); + ASSERT( sorted->unindex( opCtx.get(), key3, loc3, true ) ); uow.commit(); } } @@ -185,7 +185,7 @@ namespace mongo { // Insert the same key multiple times and verify that each occurrence can be unindexed. TEST( SortedDataInterface, UnindexMultipleSameKey ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -211,7 +211,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT( sorted->unindex( opCtx.get(), key1, loc2 ) ); + ASSERT( sorted->unindex( opCtx.get(), key1, loc2, true ) ); uow.commit(); } } @@ -239,8 +239,8 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT( sorted->unindex( opCtx.get(), key1, loc1 ) ); - ASSERT( sorted->unindex( opCtx.get(), key1, loc3 ) ); + ASSERT( sorted->unindex( opCtx.get(), key1, loc1, true) ); + ASSERT( sorted->unindex( opCtx.get(), key1, loc3, true ) ); uow.commit(); } } @@ -254,7 +254,7 @@ namespace mongo { // Call unindex() on a nonexistent key and verify the result is false. TEST( SortedDataInterface, UnindexEmpty ) { scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() ); + scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); @@ -265,7 +265,7 @@ namespace mongo { scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); - ASSERT( !sorted->unindex( opCtx.get(), key1, loc1 ) ); + ASSERT( !sorted->unindex( opCtx.get(), key1, loc1, true ) ); uow.commit(); } } |