diff options
author | matt dannenberg <matt.dannenberg@10gen.com> | 2015-03-13 06:35:51 -0400 |
---|---|---|
committer | matt dannenberg <matt.dannenberg@10gen.com> | 2015-04-09 10:57:16 -0400 |
commit | 1725d76f448323a2bbaa11ffd37fd7b10cd6a64b (patch) | |
tree | be35489fd99d5b0040f27d86b731cfcae1e4479a /src/mongo/dbtests | |
parent | acc7a72194990f35ff706bdcab7ec443c39fb0d5 (diff) | |
download | mongo-1725d76f448323a2bbaa11ffd37fd7b10cd6a64b.tar.gz |
SERVER-17573 move OpObserver calls into the datalayer as much as possible and eliminate repl bools
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r-- | src/mongo/dbtests/query_stage_count.cpp | 13 | ||||
-rw-r--r-- | src/mongo/dbtests/query_stage_sort.cpp | 5 | ||||
-rw-r--r-- | src/mongo/dbtests/querytests.cpp | 2 | ||||
-rw-r--r-- | src/mongo/dbtests/repltests.cpp | 12 | ||||
-rw-r--r-- | src/mongo/dbtests/rollbacktests.cpp | 29 |
5 files changed, 35 insertions, 26 deletions
diff --git a/src/mongo/dbtests/query_stage_count.cpp b/src/mongo/dbtests/query_stage_count.cpp index 1973ba6b6d7..a4cdf32b9ea 100644 --- a/src/mongo/dbtests/query_stage_count.cpp +++ b/src/mongo/dbtests/query_stage_count.cpp @@ -124,9 +124,16 @@ namespace QueryStageCount { void update(const RecordId& oldLoc, const BSONObj& newDoc) { WriteUnitOfWork wunit(&_txn); BSONObj oldDoc = _coll->getRecordStore()->dataFor( &_txn, oldLoc ).releaseToBson(); - _coll->updateDocument(&_txn, oldLoc, - Snapshotted<BSONObj>(_txn.recoveryUnit()->getSnapshotId(), oldDoc), - newDoc, false, true, NULL); + oplogUpdateEntryArgs args; + _coll->updateDocument(&_txn, + oldLoc, + Snapshotted<BSONObj>(_txn.recoveryUnit()->getSnapshotId(), + oldDoc), + newDoc, + false, + true, + NULL, + args); wunit.commit(); } diff --git a/src/mongo/dbtests/query_stage_sort.cpp b/src/mongo/dbtests/query_stage_sort.cpp index b2a484f7add..e398b696339 100644 --- a/src/mongo/dbtests/query_stage_sort.cpp +++ b/src/mongo/dbtests/query_stage_sort.cpp @@ -334,9 +334,10 @@ namespace QueryStageSortTests { // This allows us to check that we don't return the new copy of a doc by asserting // foo < limit(). BSONObj newDoc = BSON("_id" << updatedId << "foo" << limit() + 10); + oplogUpdateEntryArgs args; { WriteUnitOfWork wuow(&_txn); - coll->updateDocument(&_txn, *it, oldDoc, newDoc, false, false, NULL); + coll->updateDocument(&_txn, *it, oldDoc, newDoc, false, false, NULL, args); wuow.commit(); } exec->restoreState(&_txn); @@ -354,7 +355,7 @@ namespace QueryStageSortTests { oldDoc = coll->docFor(&_txn, *it); { WriteUnitOfWork wuow(&_txn); - coll->updateDocument(&_txn, *it++, oldDoc, newDoc, false, false, NULL); + coll->updateDocument(&_txn, *it++, oldDoc, newDoc, false, false, NULL, args); wuow.commit(); } } diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp index 5b9b84be5ba..bab0f1e22fe 100644 --- a/src/mongo/dbtests/querytests.cpp +++ b/src/mongo/dbtests/querytests.cpp @@ -193,7 +193,7 @@ namespace QueryTests { _collection = NULL; db->dropCollection( &_txn, ns() ); } - _collection = db->createCollection( &_txn, ns(), CollectionOptions(), true, false ); + _collection = db->createCollection( &_txn, ns(), CollectionOptions(), false ); wunit.commit(); } ASSERT( _collection ); diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp index d768302d02d..cf6d2576323 100644 --- a/src/mongo/dbtests/repltests.cpp +++ b/src/mongo/dbtests/repltests.cpp @@ -203,7 +203,9 @@ namespace ReplTests { if ( 0 ) { mongo::unittest::log() << "op: " << *i << endl; } + _txn.setReplicatedWrites(false); a.applyOperation( &_txn, ctx.db(), *i ); + _txn.setReplicatedWrites(true); } } } @@ -247,7 +249,9 @@ namespace ReplTests { } delete it; for( vector< RecordId >::iterator i = toDelete.begin(); i != toDelete.end(); ++i ) { + _txn.setReplicatedWrites(false); coll->deleteDocument( &_txn, *i, true ); + _txn.setReplicatedWrites(true); } wunit.commit(); } @@ -263,7 +267,9 @@ namespace ReplTests { } if ( o.hasField( "_id" ) ) { + _txn.setReplicatedWrites(false); coll->insertDocument( &_txn, o, true ); + _txn.setReplicatedWrites(true); wunit.commit(); return; } @@ -273,7 +279,9 @@ namespace ReplTests { id.init(); b.appendOID( "_id", &id ); b.appendElements( o ); + _txn.setReplicatedWrites(false); coll->insertDocument( &_txn, b.obj(), true ); + _txn.setReplicatedWrites(true); wunit.commit(); } static BSONObj wid( const char *json ) { @@ -290,9 +298,9 @@ namespace ReplTests { class LogBasic : public Base { public: void run() { - ASSERT_EQUALS( 1, opCount() ); - _client.insert( ns(), fromjson( "{\"a\":\"b\"}" ) ); ASSERT_EQUALS( 2, opCount() ); + _client.insert( ns(), fromjson( "{\"a\":\"b\"}" ) ); + ASSERT_EQUALS( 3, opCount() ); } }; diff --git a/src/mongo/dbtests/rollbacktests.cpp b/src/mongo/dbtests/rollbacktests.cpp index 8abfe02ff43..f742fb68b00 100644 --- a/src/mongo/dbtests/rollbacktests.cpp +++ b/src/mongo/dbtests/rollbacktests.cpp @@ -71,7 +71,7 @@ namespace { { WriteUnitOfWork uow( txn ); ASSERT( !collectionExists( &ctx, nss.ns() ) ); - ASSERT_OK( userCreateNS( txn, ctx.db(), nss.ns(), BSONObj(), false, false ) ); + ASSERT_OK( userCreateNS( txn, ctx.db(), nss.ns(), BSONObj(), false ) ); ASSERT( collectionExists( &ctx, nss.ns() ) ); uow.commit(); } @@ -161,7 +161,7 @@ namespace { { WriteUnitOfWork uow( &txn ); ASSERT( !collectionExists( &ctx, ns ) ); - ASSERT_OK( userCreateNS( &txn, ctx.db(), ns, BSONObj(), false, defaultIndexes ) ); + ASSERT_OK( userCreateNS( &txn, ctx.db(), ns, BSONObj(), defaultIndexes ) ); ASSERT( collectionExists( &ctx, ns ) ); if ( !rollback ) { uow.commit(); @@ -191,7 +191,7 @@ namespace { { WriteUnitOfWork uow( &txn ); ASSERT( !collectionExists( &ctx, ns ) ); - ASSERT_OK( userCreateNS( &txn, ctx.db(), ns, BSONObj(), false, defaultIndexes ) ); + ASSERT_OK( userCreateNS( &txn, ctx.db(), ns, BSONObj(), defaultIndexes ) ); uow.commit(); } ASSERT( collectionExists( &ctx, ns ) ); @@ -235,8 +235,7 @@ namespace { WriteUnitOfWork uow( &txn ); ASSERT( !collectionExists( &ctx, source ) ); ASSERT( !collectionExists( &ctx, target ) ); - ASSERT_OK( userCreateNS( &txn, ctx.db(), source.ns(), BSONObj(), false, - defaultIndexes ) ); + ASSERT_OK( userCreateNS( &txn, ctx.db(), source.ns(), BSONObj(), defaultIndexes ) ); uow.commit(); } ASSERT( collectionExists( &ctx, source ) ); @@ -286,10 +285,8 @@ namespace { WriteUnitOfWork uow( &txn ); ASSERT( !collectionExists( &ctx, source ) ); ASSERT( !collectionExists( &ctx, target ) ); - ASSERT_OK( userCreateNS( &txn, ctx.db(), source.ns(), BSONObj(), false, - defaultIndexes ) ); - ASSERT_OK( userCreateNS( &txn, ctx.db(), target.ns(), BSONObj(), false, - defaultIndexes ) ); + ASSERT_OK( userCreateNS( &txn, ctx.db(), source.ns(), BSONObj(), defaultIndexes ) ); + ASSERT_OK( userCreateNS( &txn, ctx.db(), target.ns(), BSONObj(), defaultIndexes ) ); insertRecord( &txn, source, sourceDoc ); insertRecord( &txn, target, targetDoc ); @@ -346,8 +343,7 @@ namespace { { WriteUnitOfWork uow( &txn ); ASSERT( !collectionExists( &ctx, nss ) ); - ASSERT_OK( userCreateNS( &txn, ctx.db(), nss.ns(), BSONObj(), false, - defaultIndexes ) ); + ASSERT_OK( userCreateNS( &txn, ctx.db(), nss.ns(), BSONObj(), defaultIndexes ) ); insertRecord( &txn, nss, oldDoc ); uow.commit(); } @@ -360,8 +356,7 @@ namespace { WriteUnitOfWork uow( &txn ); ASSERT_OK( ctx.db()->dropCollection( &txn, nss.ns() ) ); ASSERT( !collectionExists( &ctx, nss ) ); - ASSERT_OK( userCreateNS( &txn, ctx.db(), nss.ns(), BSONObj(), false, - defaultIndexes ) ); + ASSERT_OK( userCreateNS( &txn, ctx.db(), nss.ns(), BSONObj(), defaultIndexes ) ); ASSERT( collectionExists( &ctx, nss ) ); insertRecord( &txn, nss, newDoc ); assertOnlyRecord( &txn, nss, newDoc ); @@ -397,8 +392,7 @@ namespace { { WriteUnitOfWork uow( &txn ); - ASSERT_OK( userCreateNS( &txn, ctx.db(), nss.ns(), BSONObj(), false, - defaultIndexes ) ); + ASSERT_OK( userCreateNS( &txn, ctx.db(), nss.ns(), BSONObj(), defaultIndexes ) ); ASSERT( collectionExists( &ctx, nss ) ); insertRecord( &txn, nss, doc ); assertOnlyRecord( &txn, nss, doc ); @@ -432,8 +426,7 @@ namespace { { WriteUnitOfWork uow( &txn ); - ASSERT_OK( userCreateNS( &txn, ctx.db(), nss.ns(), BSONObj(), false, - defaultIndexes ) ); + ASSERT_OK( userCreateNS( &txn, ctx.db(), nss.ns(), BSONObj(), defaultIndexes ) ); ASSERT( collectionExists( &ctx, nss ) ); insertRecord( &txn, nss, doc ); assertOnlyRecord( &txn, nss, doc ); @@ -689,7 +682,7 @@ namespace { { WriteUnitOfWork uow( &txn ); ASSERT( !collectionExists( &ctx, nss.ns() ) ); - ASSERT_OK( userCreateNS( &txn, ctx.db(), nss.ns(), BSONObj(), false, false ) ); + ASSERT_OK( userCreateNS( &txn, ctx.db(), nss.ns(), BSONObj(), false ) ); ASSERT( collectionExists( &ctx, nss.ns() ) ); Collection* coll = ctx.db()->getCollection( ns ); IndexCatalog* catalog = coll->getIndexCatalog(); |