diff options
Diffstat (limited to 'src')
61 files changed, 196 insertions, 202 deletions
diff --git a/src/mongo/db/auth/auth_index_d.cpp b/src/mongo/db/auth/auth_index_d.cpp index 8b38dd099c3..a2fa5cf609e 100644 --- a/src/mongo/db/auth/auth_index_d.cpp +++ b/src/mongo/db/auth/auth_index_d.cpp @@ -84,8 +84,7 @@ namespace { return Status::OK(); } - Collection* collection = autoDb.getDb()->getCollection(txn, - NamespaceString(systemUsers)); + Collection* collection = autoDb.getDb()->getCollection(NamespaceString(systemUsers)); if (!collection) { return Status::OK(); } diff --git a/src/mongo/db/catalog/database.cpp b/src/mongo/db/catalog/database.cpp index 110511dbc4d..d2976a86668 100644 --- a/src/mongo/db/catalog/database.cpp +++ b/src/mongo/db/catalog/database.cpp @@ -165,15 +165,15 @@ namespace mongo { Collection* Database::_getOrCreateCollectionInstance(OperationContext* txn, const StringData& fullns) { - Collection* collection = getCollection( txn, fullns ); + Collection* collection = getCollection( fullns ); if (collection) { return collection; } - auto_ptr<CollectionCatalogEntry> cce( _dbEntry->getCollectionCatalogEntry( txn, fullns ) ); + auto_ptr<CollectionCatalogEntry> cce( _dbEntry->getCollectionCatalogEntry( fullns ) ); invariant( cce.get() ); - auto_ptr<RecordStore> rs( _dbEntry->getRecordStore( txn, fullns ) ); + auto_ptr<RecordStore> rs( _dbEntry->getRecordStore( fullns ) ); invariant( rs.get() ); // if cce exists, so should this // Not registering AddCollectionChange since this is for collections that already exist. @@ -249,7 +249,7 @@ namespace mongo { string ns = *i; invariant( NamespaceString::normal( ns ) ); - CollectionCatalogEntry* coll = _dbEntry->getCollectionCatalogEntry( txn, ns ); + CollectionCatalogEntry* coll = _dbEntry->getCollectionCatalogEntry( ns ); CollectionOptions options = coll->getCollectionOptions( txn ); if ( !options.temp ) @@ -307,7 +307,7 @@ namespace mongo { for (list<string>::const_iterator it = collections.begin(); it != collections.end(); ++it) { const string ns = *it; - Collection* collection = getCollection( opCtx, ns ); + Collection* collection = getCollection( ns ); if ( !collection ) continue; @@ -341,7 +341,7 @@ namespace mongo { LOG(1) << "dropCollection: " << fullns << endl; massertNamespaceNotIndex( fullns, "dropCollection" ); - Collection* collection = getCollection( txn, fullns ); + Collection* collection = getCollection( fullns ); if ( !collection ) { // collection doesn't exist return Status::OK(); @@ -426,7 +426,7 @@ namespace mongo { _collections.erase( it ); } - Collection* Database::getCollection( OperationContext* txn, const StringData& ns ) { + Collection* Database::getCollection( const StringData& ns ) const { invariant( _name == nsToDatabaseSubstring( ns ) ); CollectionMap::const_iterator it = _collections.find( ns ); if ( it != _collections.end() && it->second ) { @@ -447,7 +447,7 @@ namespace mongo { invariant(txn->lockState()->isDbLockedForMode(name(), MODE_X)); { // remove anything cached - Collection* coll = getCollection( txn, fromNS ); + Collection* coll = getCollection( fromNS ); if ( !coll ) return Status( ErrorCodes::NamespaceNotFound, "collection not found to rename" ); IndexCatalog::IndexIterator ii = coll->getIndexCatalog()->getIndexIterator( txn, true ); @@ -469,7 +469,7 @@ namespace mongo { } Collection* Database::getOrCreateCollection(OperationContext* txn, const StringData& ns) { - Collection* c = getCollection( txn, ns ); + Collection* c = getCollection( ns ); if ( !c ) { c = createCollection( txn, ns ); } @@ -481,7 +481,7 @@ namespace mongo { const CollectionOptions& options, bool allocateDefaultSpace, bool createIdIndex ) { - massert( 17399, "collection already exists", getCollection( txn, ns ) == NULL ); + massert( 17399, "collection already exists", getCollection( ns ) == NULL ); massertNamespaceNotIndex( ns, "createCollection" ); invariant(txn->lockState()->isDbLockedForMode(name(), MODE_X)); @@ -596,7 +596,7 @@ namespace mongo { return Status( ErrorCodes::InvalidNamespace, str::stream() << "invalid ns: " << ns ); - Collection* collection = db->getCollection( txn, ns ); + Collection* collection = db->getCollection( ns ); if ( collection ) return Status( ErrorCodes::NamespaceExists, diff --git a/src/mongo/db/catalog/database.h b/src/mongo/db/catalog/database.h index 430785c04ff..ae4f95e03b5 100644 --- a/src/mongo/db/catalog/database.h +++ b/src/mongo/db/catalog/database.h @@ -90,10 +90,10 @@ namespace mongo { /** * @param ns - this is fully qualified, which is maybe not ideal ??? */ - Collection* getCollection( OperationContext* txn, const StringData& ns ); + Collection* getCollection( const StringData& ns ) const ; - Collection* getCollection( OperationContext* txn, const NamespaceString& ns ) { - return getCollection( txn, ns.ns() ); + Collection* getCollection( const NamespaceString& ns ) const { + return getCollection( ns.ns() ); } Collection* getOrCreateCollection( OperationContext* txn, const StringData& ns ); diff --git a/src/mongo/db/catalog/database_catalog_entry.h b/src/mongo/db/catalog/database_catalog_entry.h index 02b424924e7..2d9530d6fc4 100644 --- a/src/mongo/db/catalog/database_catalog_entry.h +++ b/src/mongo/db/catalog/database_catalog_entry.h @@ -82,12 +82,10 @@ namespace mongo { virtual void getCollectionNamespaces( std::list<std::string>* out ) const = 0; // The DatabaseCatalogEntry owns this, do not delete - virtual CollectionCatalogEntry* getCollectionCatalogEntry( OperationContext* txn, - const StringData& ns ) const = 0; + virtual CollectionCatalogEntry* getCollectionCatalogEntry( const StringData& ns ) const = 0; // The DatabaseCatalogEntry owns this, do not delete - virtual RecordStore* getRecordStore( OperationContext* txn, - const StringData& ns ) = 0; + virtual RecordStore* getRecordStore( const StringData& ns ) const = 0; // Ownership passes to caller virtual IndexAccessMethod* getIndex( OperationContext* txn, diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp index d7639b744a8..61b29403a51 100644 --- a/src/mongo/db/catalog/index_catalog.cpp +++ b/src/mongo/db/catalog/index_catalog.cpp @@ -226,7 +226,7 @@ namespace mongo { auto_ptr<PlanExecutor> exec( InternalPlanner::collectionScan(txn, db->_indexesName, - db->getCollection(txn, db->_indexesName))); + db->getCollection(db->_indexesName))); BSONObj index; PlanExecutor::ExecState state; diff --git a/src/mongo/db/client.cpp b/src/mongo/db/client.cpp index 2ccec5fdd9f..5990d168e7e 100644 --- a/src/mongo/db/client.cpp +++ b/src/mongo/db/client.cpp @@ -267,7 +267,7 @@ namespace { // TODO: Client::Context legacy, needs to be removed _txn->getCurOp()->enter(ns.c_str(), _db.getDb()->getProfilingLevel()); - _coll = _db.getDb()->getCollection(_txn, ns); + _coll = _db.getDb()->getCollection(ns); } } @@ -282,7 +282,7 @@ namespace { _autodb(opCtx, _nss.db(), MODE_IX), _collk(opCtx->lockState(), ns, MODE_IX), _c(opCtx, ns, _autodb.getDb(), _autodb.justCreated()) { - _collection = _c.db()->getCollection( _txn, ns ); + _collection = _c.db()->getCollection( ns ); if ( !_collection && !_autodb.justCreated() ) { // relock in MODE_X _collk.relockWithMode( MODE_X, _autodb.lock() ); diff --git a/src/mongo/db/client.h b/src/mongo/db/client.h index 3703d555ff2..6b9239e7875 100644 --- a/src/mongo/db/client.h +++ b/src/mongo/db/client.h @@ -314,8 +314,6 @@ namespace mongo { friend class CurOp; void _finishInit(); void checkNotStale() const; - void checkNsAccess( bool doauth ); - void checkNsAccess( bool doauth, int lockState ); Client * const _client; bool _justCreated; bool _doVersion; @@ -334,7 +332,7 @@ namespace mongo { Database* db() const { return _c.db(); } Collection* getCollection() const { - return _c.db()->getCollection(_txn, _nss.ns()); + return _c.db()->getCollection(_nss.ns()); } Context& ctx() { return _c; } diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp index 1d83f1508c5..75e329e42d0 100644 --- a/src/mongo/db/cloner.cpp +++ b/src/mongo/db/cloner.cpp @@ -118,8 +118,16 @@ namespace mongo { // Make sure database still exists after we resume from the temp release Database* db = dbHolder().openDb(txn, _dbName); - Collection* collection = db->getCollection( txn, to_collection ); - if (!collection) { + bool createdCollection = false; + Collection* collection = NULL; + + collection = db->getCollection( to_collection ); + if ( !collection ) { + massert( 17321, + str::stream() + << "collection dropped during clone [" + << to_collection.ns() << "]", + !createdCollection ); WriteUnitOfWork wunit(txn); collection = db->createCollection(txn, to_collection.ns()); verify(collection); @@ -172,7 +180,7 @@ namespace mongo { << " dropped while cloning", db != NULL); - collection = db->getCollection(txn, to_collection); + collection = db->getCollection(to_collection); uassert(28594, str::stream() << "Collection " << to_collection.ns() << " dropped while cloning", @@ -294,7 +302,7 @@ namespace mongo { // during the temp release Database* db = dbHolder().openDb(txn, toDBName); - Collection* collection = db->getCollection( txn, to_collection ); + Collection* collection = db->getCollection( to_collection ); if ( !collection ) { WriteUnitOfWork wunit(txn); collection = db->createCollection( txn, to_collection.ns() ); @@ -564,7 +572,7 @@ namespace mongo { str::stream() << "database " << toDBName << " dropped during clone", db); - Collection* c = db->getCollection( txn, to_name ); + Collection* c = db->getCollection( to_name ); if ( c && !c->getIndexCatalog()->haveIdIndex( txn ) ) { // We need to drop objects with duplicate _ids because we didn't do a true // snapshot and this is before applying oplog operations that occur during the diff --git a/src/mongo/db/commands/collection_to_capped.cpp b/src/mongo/db/commands/collection_to_capped.cpp index 6cda6aa1c3a..c4bd12f28d1 100644 --- a/src/mongo/db/commands/collection_to_capped.cpp +++ b/src/mongo/db/commands/collection_to_capped.cpp @@ -53,12 +53,12 @@ namespace { string fromNs = db->name() + "." + shortFrom; string toNs = db->name() + "." + shortTo; - Collection* fromCollection = db->getCollection( txn, fromNs ); + Collection* fromCollection = db->getCollection( fromNs ); if ( !fromCollection ) return Status( ErrorCodes::NamespaceNotFound, str::stream() << "source collection " << fromNs << " does not exist" ); - if ( db->getCollection( txn, toNs ) ) + if ( db->getCollection( toNs ) ) return Status( ErrorCodes::NamespaceExists, "to collection already exists" ); // create new collection @@ -77,7 +77,7 @@ namespace { wunit.commit(); } - Collection* toCollection = db->getCollection( txn, toNs ); + Collection* toCollection = db->getCollection( toNs ); invariant( toCollection ); // we created above // how much data to ignore because it won't fit anyway @@ -203,7 +203,7 @@ namespace { IndexCatalog::IndexKillCriteria criteria; criteria.ns = ns; - Collection* coll = db->getCollection(opCtx, ns); + Collection* coll = db->getCollection(ns); if (coll) { return IndexBuilder::killMatchingIndexBuilds(coll, criteria); } @@ -245,7 +245,7 @@ namespace { string shortTmpName = str::stream() << "tmp.convertToCapped." << shortSource; string longTmpName = str::stream() << dbname << "." << shortTmpName; - if ( db->getCollection( txn, longTmpName ) ) { + if ( db->getCollection( longTmpName ) ) { Status status = db->dropCollection( txn, longTmpName ); if ( !status.isOK() ) return appendCommandStatus( result, status ); @@ -256,7 +256,7 @@ namespace { if ( !status.isOK() ) return appendCommandStatus( result, status ); - verify( db->getCollection( txn, longTmpName ) ); + verify( db->getCollection( longTmpName ) ); WriteUnitOfWork wunit(txn); status = db->dropCollection( txn, longSource ); diff --git a/src/mongo/db/commands/compact.cpp b/src/mongo/db/commands/compact.cpp index 66d227ef66b..023370dd172 100644 --- a/src/mongo/db/commands/compact.cpp +++ b/src/mongo/db/commands/compact.cpp @@ -81,7 +81,7 @@ namespace mongo { IndexCatalog::IndexKillCriteria criteria; criteria.ns = ns; - return IndexBuilder::killMatchingIndexBuilds(db->getCollection(opCtx, ns), criteria); + return IndexBuilder::killMatchingIndexBuilds(db->getCollection(ns), criteria); } virtual bool run(OperationContext* txn, const string& db, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { @@ -149,7 +149,7 @@ namespace mongo { BackgroundOperation::assertNoBgOpInProgForNs(ns.ns()); Client::Context ctx(txn, ns); - Collection* collection = ctx.db()->getCollection(txn, ns.ns()); + Collection* collection = ctx.db()->getCollection(ns.ns()); if( ! collection ) { errmsg = "namespace does not exist"; return false; diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp index 9c9bb8905d0..33f9e7da607 100644 --- a/src/mongo/db/commands/create_indexes.cpp +++ b/src/mongo/db/commands/create_indexes.cpp @@ -143,7 +143,7 @@ namespace mongo { db = dbHolder().openDb(txn, ns.db()); } - Collection* collection = db->getCollection( txn, ns.ns() ); + Collection* collection = db->getCollection( ns.ns() ); result.appendBool( "createdCollectionAutomatically", collection == NULL ); if ( !collection ) { WriteUnitOfWork wunit(txn); @@ -220,7 +220,7 @@ namespace mongo { Database* db = dbHolder().get(txn, ns.db()); uassert(28551, "database dropped during index build", db); uassert(28552, "collection dropped during index build", - db->getCollection(txn, ns.ns())); + db->getCollection(ns.ns())); } { diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp index dfec4b07e64..955f84d1f0a 100644 --- a/src/mongo/db/commands/dbhash.cpp +++ b/src/mongo/db/commands/dbhash.cpp @@ -78,7 +78,7 @@ namespace mongo { } *fromCache = false; - Collection* collection = db->getCollection( opCtx, fullCollectionName ); + Collection* collection = db->getCollection( fullCollectionName ); if ( !collection ) return ""; diff --git a/src/mongo/db/commands/drop_indexes.cpp b/src/mongo/db/commands/drop_indexes.cpp index 85e212efbdd..c06fd0b844c 100644 --- a/src/mongo/db/commands/drop_indexes.cpp +++ b/src/mongo/db/commands/drop_indexes.cpp @@ -75,7 +75,7 @@ namespace mongo { Database* db, const BSONObj& cmdObj) { std::string toDeleteNs = db->name() + "." + cmdObj.firstElement().valuestrsafe(); - Collection* collection = db->getCollection(opCtx, toDeleteNs); + Collection* collection = db->getCollection(toDeleteNs); IndexCatalog::IndexKillCriteria criteria; // Get index name to drop @@ -136,7 +136,7 @@ namespace mongo { Client::Context ctx(txn, toDeleteNs); Database* db = ctx.db(); - Collection* collection = db->getCollection( txn, toDeleteNs ); + Collection* collection = db->getCollection( toDeleteNs ); if ( ! collection ) { errmsg = "ns not found"; return false; @@ -235,7 +235,7 @@ namespace mongo { std::string ns = db->name() + '.' + cmdObj["reIndex"].valuestrsafe(); IndexCatalog::IndexKillCriteria criteria; criteria.ns = ns; - return IndexBuilder::killMatchingIndexBuilds(db->getCollection(opCtx, ns), criteria); + return IndexBuilder::killMatchingIndexBuilds(db->getCollection(ns), criteria); } bool run(OperationContext* txn, const string& dbname , BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool /*fromRepl*/) { @@ -250,7 +250,7 @@ namespace mongo { Lock::DBLock dbXLock(txn->lockState(), dbname, MODE_X); Client::Context ctx(txn, toDeleteNs); - Collection* collection = ctx.db()->getCollection( txn, toDeleteNs ); + Collection* collection = ctx.db()->getCollection( toDeleteNs ); if ( !collection ) { errmsg = "ns not found"; diff --git a/src/mongo/db/commands/find_and_modify.cpp b/src/mongo/db/commands/find_and_modify.cpp index 5467b7f705c..22b75933189 100644 --- a/src/mongo/db/commands/find_and_modify.cpp +++ b/src/mongo/db/commands/find_and_modify.cpp @@ -139,7 +139,7 @@ namespace mongo { Lock::DBLock lk(txn->lockState(), dbname, MODE_X); Client::Context ctx(txn, ns, false /* don't check version */); Database* db = ctx.db(); - if ( db->getCollection( txn, ns ) ) { + if ( db->getCollection( ns ) ) { // someone else beat us to it, that's ok // we might race while we unlock if someone drops // but that's ok, we'll just do nothing and error out diff --git a/src/mongo/db/commands/list_collections.cpp b/src/mongo/db/commands/list_collections.cpp index 800150706b5..6b633ca522a 100644 --- a/src/mongo/db/commands/list_collections.cpp +++ b/src/mongo/db/commands/list_collections.cpp @@ -111,7 +111,7 @@ namespace mongo { b.append( "name", collection ); CollectionOptions options = - dbEntry->getCollectionCatalogEntry( txn, ns )->getCollectionOptions(txn); + dbEntry->getCollectionCatalogEntry( ns )->getCollectionOptions(txn); b.append( "options", options.toBSON() ); BSONObj maybe = b.obj(); diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp index c06fbfb252e..f062a239f91 100644 --- a/src/mongo/db/commands/mr.cpp +++ b/src/mongo/db/commands/mr.cpp @@ -630,7 +630,7 @@ namespace mongo { { Client::Context tx(txn, _config.outputOptions.finalNamespace); Collection* coll = - tx.db()->getCollection(_txn, _config.outputOptions.finalNamespace); + tx.db()->getCollection(_config.outputOptions.finalNamespace); found = Helpers::findOne(_txn, coll, temp["_id"].wrap(), @@ -892,7 +892,7 @@ namespace mongo { } Collection* State::getCollectionOrUassert(Database* db, const StringData& ns) { - Collection* out = db ? db->getCollection(_txn, ns) : NULL; + Collection* out = db ? db->getCollection(ns) : NULL; uassert(18697, "Collection unexpectedly disappeared: " + ns.toString(), out); return out; diff --git a/src/mongo/db/commands/rename_collection.cpp b/src/mongo/db/commands/rename_collection.cpp index 9f5ff7b54fc..9674067afa5 100644 --- a/src/mongo/db/commands/rename_collection.cpp +++ b/src/mongo/db/commands/rename_collection.cpp @@ -77,7 +77,7 @@ namespace mongo { IndexCatalog::IndexKillCriteria criteria; criteria.ns = source; std::vector<BSONObj> prelim = - IndexBuilder::killMatchingIndexBuilds(db->getCollection(opCtx, source), criteria); + IndexBuilder::killMatchingIndexBuilds(db->getCollection(source), criteria); std::vector<BSONObj> indexes; @@ -168,7 +168,7 @@ namespace mongo { } Database* const sourceDB = dbHolder().get(txn, nsToDatabase(source)); - Collection* const sourceColl = sourceDB ? sourceDB->getCollection(txn, source) + Collection* const sourceColl = sourceDB ? sourceDB->getCollection(source) : NULL; if (!sourceColl) { errmsg = "source namespace does not exist"; @@ -212,7 +212,7 @@ namespace mongo { // Check if the target namespace exists and if dropTarget is true. // If target exists and dropTarget is not true, return false. - if (targetDB->getCollection(txn, target)) { + if (targetDB->getCollection(target)) { if (!cmdObj["dropTarget"].trueValue()) { errmsg = "target namespace exists"; return false; diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp index 68dab0470f1..44c41a8df93 100644 --- a/src/mongo/db/commands/test_commands.cpp +++ b/src/mongo/db/commands/test_commands.cpp @@ -71,7 +71,7 @@ namespace mongo { WriteUnitOfWork wunit(txn); Client::Context ctx(txn, ns ); Database* db = ctx.db(); - Collection* collection = db->getCollection( txn, ns ); + Collection* collection = db->getCollection( ns ); if ( !collection ) { collection = db->createCollection( txn, ns ); if ( !collection ) { @@ -195,7 +195,7 @@ namespace mongo { IndexCatalog::IndexKillCriteria criteria; criteria.ns = ns; - return IndexBuilder::killMatchingIndexBuilds(db->getCollection(opCtx, ns), criteria); + return IndexBuilder::killMatchingIndexBuilds(db->getCollection(ns), criteria); } virtual bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { @@ -209,7 +209,7 @@ namespace mongo { Database* db = autoDb.getDb(); massert(13429, "no such database", db); - Collection* collection = db->getCollection(txn, nss.ns()); + Collection* collection = db->getCollection(nss.ns()); massert(28584, "no such collection", collection); std::vector<BSONObj> indexes = stopIndexBuilds(txn, db, cmdObj); diff --git a/src/mongo/db/commands/write_commands/batch_executor.cpp b/src/mongo/db/commands/write_commands/batch_executor.cpp index 6fb0556f7e6..21dad098aa0 100644 --- a/src/mongo/db/commands/write_commands/batch_executor.cpp +++ b/src/mongo/db/commands/write_commands/batch_executor.cpp @@ -995,7 +995,7 @@ namespace mongo { Database* database = _context->db(); dassert(database); - _collection = database->getCollection(txn, request->getTargetingNS()); + _collection = database->getCollection(request->getTargetingNS()); if (!_collection) { if (intentLock) { // try again with full X lock. @@ -1208,7 +1208,7 @@ namespace mongo { Lock::DBLock lk(txn->lockState(), nsString.db(), MODE_X); Client::Context ctx(txn, nsString.ns(), false /* don't check version */); Database* db = ctx.db(); - if ( db->getCollection( txn, nsString.ns() ) ) { + if ( db->getCollection( nsString.ns() ) ) { // someone else beat us to it } else { @@ -1256,7 +1256,7 @@ namespace mongo { } Client::Context ctx(txn, nsString.ns(), false /* don't check version */); - Collection* collection = db->getCollection(txn, nsString.ns()); + Collection* collection = db->getCollection(nsString.ns()); if ( collection == NULL ) { if ( createCollection ) { @@ -1375,7 +1375,7 @@ namespace mongo { PlanExecutor* rawExec; uassertStatusOK(getExecutorDelete(txn, - ctx.db()->getCollection(txn, nss), + ctx.db()->getCollection(nss), &parsedDelete, &rawExec)); boost::scoped_ptr<PlanExecutor> exec(rawExec); diff --git a/src/mongo/db/commands/write_commands/write_commands.cpp b/src/mongo/db/commands/write_commands/write_commands.cpp index a462ecd87e9..eb433bd84ae 100644 --- a/src/mongo/db/commands/write_commands/write_commands.cpp +++ b/src/mongo/db/commands/write_commands/write_commands.cpp @@ -229,7 +229,7 @@ namespace mongo { // Get a pointer to the (possibly NULL) collection. Collection* collection = NULL; if ( autoDb.getDb() ) { - collection = autoDb.getDb()->getCollection( txn, nsString.ns() ); + collection = autoDb.getDb()->getCollection( nsString.ns() ); } PlanExecutor* rawExec; @@ -274,7 +274,7 @@ namespace mongo { // Get a pointer to the (possibly NULL) collection. Collection* collection = NULL; if (autoDb.getDb()) { - collection = autoDb.getDb()->getCollection(txn, nsString.ns()); + collection = autoDb.getDb()->getCollection(nsString.ns()); } PlanExecutor* rawExec; diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp index b7693bdfe16..fd237afe310 100644 --- a/src/mongo/db/db.cpp +++ b/src/mongo/db/db.cpp @@ -258,12 +258,12 @@ namespace mongo { AutoGetOrCreateDb autoDb(&txn, "local", mongo::MODE_X); Database* db = autoDb.getDb(); const std::string ns = "local.startup_log"; - Collection* collection = db->getCollection(&txn, ns); + Collection* collection = db->getCollection(ns); WriteUnitOfWork wunit(&txn); if (!collection) { BSONObj options = BSON("capped" << true << "size" << 10 * 1024 * 1024); uassertStatusOK(userCreateNS(&txn, db, ns, options, true)); - collection = db->getCollection(&txn, ns); + collection = db->getCollection(ns); } invariant(collection); uassertStatusOK(collection->insertDocument(&txn, o, false).getStatus()); @@ -286,7 +286,7 @@ namespace mongo { if ( ns.isSystem() ) continue; - Collection* coll = db->getCollection( txn, collectionName ); + Collection* coll = db->getCollection( collectionName ); if ( !coll ) continue; @@ -374,7 +374,7 @@ namespace mongo { // Major versions match, check indexes const string systemIndexes = db->name() + ".system.indexes"; - Collection* coll = db->getCollection( &txn, systemIndexes ); + Collection* coll = db->getCollection( systemIndexes ); auto_ptr<PlanExecutor> exec( InternalPlanner::collectionScan(&txn, systemIndexes, coll)); diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp index 9e9d16f4159..671d5575d71 100644 --- a/src/mongo/db/dbcommands.cpp +++ b/src/mongo/db/dbcommands.cpp @@ -154,7 +154,7 @@ namespace mongo { IndexCatalog::IndexKillCriteria criteria; criteria.ns = ns; std::vector<BSONObj> killedIndexes = - IndexBuilder::killMatchingIndexBuilds(db->getCollection(opCtx, ns), criteria); + IndexBuilder::killMatchingIndexBuilds(db->getCollection(ns), criteria); allKilledIndexes.insert(allKilledIndexes.end(), killedIndexes.begin(), killedIndexes.end()); @@ -255,10 +255,10 @@ namespace mongo { IndexCatalog::IndexKillCriteria criteria; criteria.ns = ns; - std::vector<BSONObj> killedIndexes = - IndexBuilder::killMatchingIndexBuilds(db->getCollection(opCtx, ns), criteria); - allKilledIndexes.insert(allKilledIndexes.end(), - killedIndexes.begin(), + std::vector<BSONObj> killedIndexes = + IndexBuilder::killMatchingIndexBuilds(db->getCollection(ns), criteria); + allKilledIndexes.insert(allKilledIndexes.end(), + killedIndexes.begin(), killedIndexes.end()); } return allKilledIndexes; @@ -447,7 +447,7 @@ namespace mongo { IndexCatalog::IndexKillCriteria criteria; criteria.ns = nsToDrop; - return IndexBuilder::killMatchingIndexBuilds(db->getCollection(opCtx, nsToDrop), criteria); + return IndexBuilder::killMatchingIndexBuilds(db->getCollection(nsToDrop), criteria); } virtual bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { @@ -478,7 +478,7 @@ namespace mongo { AutoGetDb autoDb(txn, dbname, MODE_X); Database* const db = autoDb.getDb(); - Collection* coll = db ? db->getCollection( txn, nsToDrop ) : NULL; + Collection* coll = db ? db->getCollection( nsToDrop ) : NULL; // If db/collection does not exist, short circuit and return. if ( !db || !coll ) { @@ -1018,7 +1018,7 @@ namespace mongo { WriteUnitOfWork wunit(txn); Client::Context ctx(txn, ns ); - Collection* coll = ctx.db()->getCollection( txn, ns ); + Collection* coll = ctx.db()->getCollection( ns ); if ( !coll ) { errmsg = "ns does not exist"; return false; diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp index 7c21615f3d6..1e806df38d3 100644 --- a/src/mongo/db/dbhelpers.cpp +++ b/src/mongo/db/dbhelpers.cpp @@ -156,7 +156,7 @@ namespace mongo { invariant(database); - Collection* collection = database->getCollection( txn, ns ); + Collection* collection = database->getCollection( ns ); if ( !collection ) { return false; } diff --git a/src/mongo/db/exec/stagedebug_cmd.cpp b/src/mongo/db/exec/stagedebug_cmd.cpp index 5ae063eed2d..fb0ea1619d4 100644 --- a/src/mongo/db/exec/stagedebug_cmd.cpp +++ b/src/mongo/db/exec/stagedebug_cmd.cpp @@ -127,7 +127,7 @@ namespace mongo { // Make sure the collection is valid. Database* db = ctx.db(); - Collection* collection = db->getCollection(txn, db->name() + '.' + collName); + Collection* collection = db->getCollection(db->name() + '.' + collName); uassert(17446, "Couldn't find the collection " + collName, NULL != collection); // Pull out the plan diff --git a/src/mongo/db/index_builder.cpp b/src/mongo/db/index_builder.cpp index f6a06b97c1c..8e7d38fd8a3 100644 --- a/src/mongo/db/index_builder.cpp +++ b/src/mongo/db/index_builder.cpp @@ -96,7 +96,7 @@ namespace mongo { Lock::DBLock* dbLock) const { const NamespaceString ns(_index["ns"].String()); - Collection* c = db->getCollection( txn, ns.ns() ); + Collection* c = db->getCollection( ns.ns() ); if ( !c ) { WriteUnitOfWork wunit(txn); c = db->getOrCreateCollection( txn, ns.ns() ); @@ -147,7 +147,7 @@ namespace mongo { dbLock->relockWithMode(MODE_X); Database* db = dbHolder().get(txn, ns.db()); fassert(28553, db); - fassert(28554, db->getCollection(txn, ns.ns())); + fassert(28554, db->getCollection(ns.ns())); indexer.unregisterIndexBuild(descriptor); } diff --git a/src/mongo/db/index_rebuilder.cpp b/src/mongo/db/index_rebuilder.cpp index dcf311ded1b..3c8e93bdb79 100644 --- a/src/mongo/db/index_rebuilder.cpp +++ b/src/mongo/db/index_rebuilder.cpp @@ -68,7 +68,7 @@ namespace { Lock::DBLock lk(txn->lockState(), nsToDatabaseSubstring(ns), MODE_X); Client::Context ctx(txn, ns); - Collection* collection = ctx.db()->getCollection(txn, ns); + Collection* collection = ctx.db()->getCollection(ns); if ( collection == NULL ) continue; diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp index 5c1499fff4e..98b3aa1726c 100644 --- a/src/mongo/db/instance.cpp +++ b/src/mongo/db/instance.cpp @@ -587,10 +587,10 @@ namespace { Client::Context ctx(txn, ns); // The common case: no implicit collection creation - if (!upsert || ctx.db()->getCollection(txn, ns) != NULL) { + if (!upsert || ctx.db()->getCollection(ns) != NULL) { PlanExecutor* rawExec; uassertStatusOK(getExecutorUpdate(txn, - ctx.db()->getCollection(txn, ns), + ctx.db()->getCollection(ns), &parsedUpdate, &op.debug(), &rawExec)); @@ -625,7 +625,7 @@ namespace { Lock::DBLock dbLock(txn->lockState(), ns.db(), MODE_X); Client::Context ctx(txn, ns); Database* db = ctx.db(); - if ( db->getCollection( txn, ns ) ) { + if ( db->getCollection( ns ) ) { // someone else beat us to it, that's ok // we might race while we unlock if someone drops // but that's ok, we'll just do nothing and error out @@ -640,7 +640,7 @@ namespace { PlanExecutor* rawExec; uassertStatusOK(getExecutorUpdate(txn, - ctx.db()->getCollection(txn, ns), + ctx.db()->getCollection(ns), &parsedUpdate, &op.debug(), &rawExec)); @@ -696,7 +696,7 @@ namespace { PlanExecutor* rawExec; uassertStatusOK(getExecutorDelete(txn, - ctx.db()->getCollection(txn, ns), + ctx.db()->getCollection(ns), &parsedDelete, &rawExec)); boost::scoped_ptr<PlanExecutor> exec(rawExec); @@ -863,7 +863,7 @@ namespace { js = fixed.getValue(); WriteUnitOfWork wunit(txn); - Collection* collection = ctx.db()->getCollection( txn, ns ); + Collection* collection = ctx.db()->getCollection( ns ); if ( !collection ) { collection = ctx.db()->createCollection( txn, ns ); verify( collection ); @@ -1025,7 +1025,7 @@ namespace { // Client::Context may implicitly create a database, so check existence if (dbHolder().get(txn, nsString.db()) != NULL) { Client::Context ctx(txn, ns); - if (mode == MODE_X || ctx.db()->getCollection(txn, nsString)) { + if (mode == MODE_X || ctx.db()->getCollection(nsString)) { if (multi.size() > 1) { const bool keepGoing = d.reservedField() & InsertOption_ContinueOnError; insertMulti(txn, ctx, keepGoing, ns, multi, op); diff --git a/src/mongo/db/introspect.cpp b/src/mongo/db/introspect.cpp index 6dd6c323a99..e4483e904f6 100644 --- a/src/mongo/db/introspect.cpp +++ b/src/mongo/db/introspect.cpp @@ -167,7 +167,7 @@ namespace { string* errmsg ) { fassert(16372, db); const char* profileName = db->getProfilingNS(); - Collection* collection = db->getCollection( txn, profileName ); + Collection* collection = db->getCollection( profileName ); if ( collection ) { if ( !collection->isCapped() ) { diff --git a/src/mongo/db/ops/delete.cpp b/src/mongo/db/ops/delete.cpp index fcaa2b6d02b..c35697b75f5 100644 --- a/src/mongo/db/ops/delete.cpp +++ b/src/mongo/db/ops/delete.cpp @@ -60,7 +60,7 @@ namespace mongo { Collection* collection = NULL; if (db) { - collection = db->getCollection(txn, nsString.ns()); + collection = db->getCollection(nsString.ns()); } ParsedDelete parsedDelete(txn, &request); diff --git a/src/mongo/db/ops/update.cpp b/src/mongo/db/ops/update.cpp index 12b2303ccc2..e4a008b3b06 100644 --- a/src/mongo/db/ops/update.cpp +++ b/src/mongo/db/ops/update.cpp @@ -61,7 +61,7 @@ namespace mongo { invariant(!request.isExplain()); const NamespaceString& nsString = request.getNamespaceString(); - Collection* collection = db->getCollection(txn, nsString.ns()); + Collection* collection = db->getCollection(nsString.ns()); // The update stage does not create its own collection. As such, if the update is // an upsert, create the collection that the update stage inserts into beforehand. diff --git a/src/mongo/db/prefetch.cpp b/src/mongo/db/prefetch.cpp index 9eac06cfdde..aa76b56c187 100644 --- a/src/mongo/db/prefetch.cpp +++ b/src/mongo/db/prefetch.cpp @@ -179,7 +179,7 @@ namespace { // lock on the database, instead of optimizing with IS. Lock::CollectionLock collLock(txn->lockState(), ns, MODE_S); - Collection* collection = db->getCollection( txn, ns ); + Collection* collection = db->getCollection( ns ); if (!collection) { return; } diff --git a/src/mongo/db/repair_database.cpp b/src/mongo/db/repair_database.cpp index 8f49e4df300..6dab35b1fbb 100644 --- a/src/mongo/db/repair_database.cpp +++ b/src/mongo/db/repair_database.cpp @@ -55,7 +55,7 @@ namespace { DatabaseCatalogEntry* dbce, const std::string& collectionName) { - CollectionCatalogEntry* cce = dbce->getCollectionCatalogEntry(txn, collectionName); + CollectionCatalogEntry* cce = dbce->getCollectionCatalogEntry(collectionName); std::vector<string> indexNames; std::vector<BSONObj> indexSpecs; @@ -103,7 +103,7 @@ namespace { // open a bad index and fail. // TODO see if MultiIndexBlock can be made to work without a Collection. db.reset(new Database(txn, dbce->name(), dbce)); - collection = db->getCollection(txn, collectionName); + collection = db->getCollection(collectionName); invariant(collection); indexer.reset(new MultiIndexBlock(txn, collection)); diff --git a/src/mongo/db/repl/master_slave.cpp b/src/mongo/db/repl/master_slave.cpp index 62f802ea387..2f165e38558 100644 --- a/src/mongo/db/repl/master_slave.cpp +++ b/src/mongo/db/repl/master_slave.cpp @@ -254,7 +254,7 @@ namespace repl { auto_ptr<PlanExecutor> exec( InternalPlanner::collectionScan(txn, localSources, - ctx.db()->getCollection(txn, localSources))); + ctx.db()->getCollection(localSources))); BSONObj obj; PlanExecutor::ExecState state; while (PlanExecutor::ADVANCED == (state = exec->getNext(&obj, NULL))) { @@ -299,7 +299,7 @@ namespace repl { auto_ptr<PlanExecutor> exec( InternalPlanner::collectionScan(txn, localSources, - ctx.db()->getCollection(txn, localSources))); + ctx.db()->getCollection(localSources))); BSONObj obj; PlanExecutor::ExecState state; while (PlanExecutor::ADVANCED == (state = exec->getNext(&obj, NULL))) { diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp index 9528c36aea4..60e7a216a7e 100644 --- a/src/mongo/db/repl/oplog.cpp +++ b/src/mongo/db/repl/oplog.cpp @@ -66,6 +66,7 @@ #include "mongo/util/elapsed_tracker.h" #include "mongo/util/file.h" #include "mongo/util/log.h" +#include "mongo/util/stacktrace.h" #include "mongo/util/startup_test.h" namespace mongo { @@ -161,7 +162,7 @@ namespace repl { localDB = ctx.db(); verify( localDB ); - localOplogRSCollection = localDB->getCollection(txn, rsoplog); + localOplogRSCollection = localDB->getCollection(rsoplog); massert(13389, "local.oplog.rs missing. did you drop it? if so restart server", localOplogRSCollection); @@ -276,7 +277,7 @@ namespace repl { Client::Context ctx(txn, rsoplog); localDB = ctx.db(); invariant( localDB ); - localOplogRSCollection = localDB->getCollection( txn, rsoplog ); + localOplogRSCollection = localDB->getCollection( rsoplog ); massert(13347, "local.oplog.rs missing. did you drop it? if so restart server", localOplogRSCollection); } @@ -350,7 +351,7 @@ namespace repl { Client::Context ctx(txn, logNS); localDB = ctx.db(); invariant(localDB); - localOplogMainCollection = localDB->getCollection(txn, logNS); + localOplogMainCollection = localDB->getCollection(logNS); invariant(localOplogMainCollection); } @@ -473,7 +474,7 @@ namespace repl { ns = rsoplog; Client::Context ctx(txn, ns); - Collection* collection = ctx.db()->getCollection(txn, ns ); + Collection* collection = ctx.db()->getCollection( ns ); if ( collection ) { @@ -590,7 +591,7 @@ namespace repl { invariant(txn->lockState()->isCollectionLockedForMode(ns, MODE_X)); } } - Collection* collection = db->getCollection( txn, ns ); + Collection* collection = db->getCollection( ns ); IndexCatalog* indexCatalog = collection == NULL ? NULL : collection->getIndexCatalog(); // operation type -- see logOp() comments for types diff --git a/src/mongo/db/repl/rs_initialsync.cpp b/src/mongo/db/repl/rs_initialsync.cpp index 7091b2b1a70..c1203452c6b 100644 --- a/src/mongo/db/repl/rs_initialsync.cpp +++ b/src/mongo/db/repl/rs_initialsync.cpp @@ -80,7 +80,7 @@ namespace { replCoord->clearSyncSourceBlacklist(); // Truncate the oplog in case there was a prior initial sync that failed. - Collection* collection = autoDb.getDb()->getCollection(txn, rsoplog); + Collection* collection = autoDb.getDb()->getCollection(rsoplog); fassert(28565, collection); WriteUnitOfWork wunit(txn); Status status = collection->truncate(txn); diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp index 9af312db360..3d46326528e 100644 --- a/src/mongo/db/repl/rs_rollback.cpp +++ b/src/mongo/db/repl/rs_rollback.cpp @@ -252,7 +252,7 @@ namespace { boost::scoped_ptr<PlanExecutor> exec( InternalPlanner::collectionScan(txn, rsoplog, - ctx.db()->getCollection(txn, rsoplog), + ctx.db()->getCollection(rsoplog), InternalPlanner::BACKWARD)); BSONObj ourObj; @@ -528,7 +528,7 @@ namespace { log() << "rollback 4.7"; Client::Context ctx(txn, rsoplog); - Collection* oplogCollection = ctx.db()->getCollection(txn, rsoplog); + Collection* oplogCollection = ctx.db()->getCollection(rsoplog); uassert(13423, str::stream() << "replSet error in rollback can't find " << rsoplog, oplogCollection); @@ -567,7 +567,7 @@ namespace { // Add the doc to our rollback file BSONObj obj; - bool found = Helpers::findOne(txn, ctx.db()->getCollection(txn, doc.ns), pattern, obj, false); + bool found = Helpers::findOne(txn, ctx.db()->getCollection(doc.ns), pattern, obj, false); if (found) { removeSaver->goingToDelete(obj); } @@ -580,7 +580,7 @@ namespace { // TODO 1.6 : can't delete from a capped collection. need to handle that here. deletes++; - Collection* collection = ctx.db()->getCollection(txn, doc.ns); + Collection* collection = ctx.db()->getCollection(doc.ns); if (collection) { if (collection->isCapped()) { // can't delete from a capped collection - so we truncate instead. if diff --git a/src/mongo/db/repl/sync.cpp b/src/mongo/db/repl/sync.cpp index 7a55cb9eb65..0530c719eac 100644 --- a/src/mongo/db/repl/sync.cpp +++ b/src/mongo/db/repl/sync.cpp @@ -56,7 +56,7 @@ namespace repl { const char *ns = o.getStringField("ns"); // capped collections - Collection* collection = db->getCollection(txn, ns); + Collection* collection = db->getCollection(ns); if ( collection && collection->isCapped() ) { log() << "replication missing doc, but this is okay for a capped collection (" << ns << ")" << endl; return BSONObj(); diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp index f091f36466b..ddc138b9ec0 100644 --- a/src/mongo/db/repl/sync_tail.cpp +++ b/src/mongo/db/repl/sync_tail.cpp @@ -275,7 +275,7 @@ namespace repl { if ( createCollection == 0 && !isIndexBuild && isCrudOpType(opType) && - ctx.db()->getCollection(txn,ns) == NULL ) { + ctx.db()->getCollection(ns) == NULL ) { // uh, oh, we need to create collection // try again continue; diff --git a/src/mongo/db/storage/kv/kv_database_catalog_entry.cpp b/src/mongo/db/storage/kv/kv_database_catalog_entry.cpp index a249136ebb2..51fde7efb9c 100644 --- a/src/mongo/db/storage/kv/kv_database_catalog_entry.cpp +++ b/src/mongo/db/storage/kv/kv_database_catalog_entry.cpp @@ -172,8 +172,8 @@ namespace mongo { } } - CollectionCatalogEntry* KVDatabaseCatalogEntry::getCollectionCatalogEntry( OperationContext* txn, - const StringData& ns ) const { + CollectionCatalogEntry* KVDatabaseCatalogEntry::getCollectionCatalogEntry( + const StringData& ns ) const { boost::mutex::scoped_lock lk( _collectionsLock ); CollectionMap::const_iterator it = _collections.find( ns.toString() ); if ( it == _collections.end() ) @@ -181,8 +181,7 @@ namespace mongo { return it->second; } - RecordStore* KVDatabaseCatalogEntry::getRecordStore( OperationContext* txn, - const StringData& ns ) { + RecordStore* KVDatabaseCatalogEntry::getRecordStore( const StringData& ns ) const { boost::mutex::scoped_lock lk( _collectionsLock ); CollectionMap::const_iterator it = _collections.find( ns.toString() ); if ( it == _collections.end() ) diff --git a/src/mongo/db/storage/kv/kv_database_catalog_entry.h b/src/mongo/db/storage/kv/kv_database_catalog_entry.h index 302d4e671e9..fb522120491 100644 --- a/src/mongo/db/storage/kv/kv_database_catalog_entry.h +++ b/src/mongo/db/storage/kv/kv_database_catalog_entry.h @@ -65,11 +65,9 @@ namespace mongo { virtual void getCollectionNamespaces( std::list<std::string>* out ) const; - virtual CollectionCatalogEntry* getCollectionCatalogEntry( OperationContext* txn, - const StringData& ns ) const; + virtual CollectionCatalogEntry* getCollectionCatalogEntry( const StringData& ns ) const; - virtual RecordStore* getRecordStore( OperationContext* txn, - const StringData& ns ); + virtual RecordStore* getRecordStore( const StringData& ns ) const; virtual IndexAccessMethod* getIndex( OperationContext* txn, const CollectionCatalogEntry* collection, diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp index cbd2f172bb1..5729319ed59 100644 --- a/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp +++ b/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp @@ -662,7 +662,7 @@ namespace mongo { } if ( allocateDefaultSpace ) { - RecordStoreV1Base* rs = _getRecordStore( txn, ns ); + RecordStoreV1Base* rs = _getRecordStore( ns ); if ( options.initialNumExtents > 0 ) { int size = _massageExtentSize( &_extentManager, options.cappedSize ); for ( int i = 0; i < options.initialNumExtents; i++ ) { @@ -711,8 +711,8 @@ namespace mongo { _insertInCache_inlock(txn, name, entry); } - CollectionCatalogEntry* MMAPV1DatabaseCatalogEntry::getCollectionCatalogEntry( OperationContext* txn, - const StringData& ns ) const { + CollectionCatalogEntry* MMAPV1DatabaseCatalogEntry::getCollectionCatalogEntry( + const StringData& ns ) const { boost::mutex::scoped_lock lk( _collectionsLock ); CollectionMap::const_iterator i = _collections.find( ns.toString() ); if ( i == _collections.end() ) @@ -756,13 +756,11 @@ namespace mongo { } } - RecordStore* MMAPV1DatabaseCatalogEntry::getRecordStore( OperationContext* txn, - const StringData& ns ) { - return _getRecordStore( txn, ns ); + RecordStore* MMAPV1DatabaseCatalogEntry::getRecordStore( const StringData& ns ) const { + return _getRecordStore( ns ); } - RecordStoreV1Base* MMAPV1DatabaseCatalogEntry::_getRecordStore( OperationContext* txn, - const StringData& ns ) { + RecordStoreV1Base* MMAPV1DatabaseCatalogEntry::_getRecordStore( const StringData& ns ) const { boost::mutex::scoped_lock lk( _collectionsLock ); CollectionMap::const_iterator i = _collections.find( ns.toString() ); if ( i == _collections.end() ) @@ -787,7 +785,7 @@ namespace mongo { md.setUserFlag( txn, NamespaceDetails::Flag_UsePowerOf2Sizes ); } - RecordStore* rs = _getRecordStore(txn, entry->descriptor()->indexNamespace()); + RecordStore* rs = _getRecordStore(entry->descriptor()->indexNamespace()); invariant(rs); std::auto_ptr<SortedDataInterface> btree( diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h b/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h index 956cc58afc7..96812119fe0 100644 --- a/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h +++ b/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h @@ -100,11 +100,9 @@ namespace mongo { /* * will return NULL if ns does not exist */ - CollectionCatalogEntry* getCollectionCatalogEntry( OperationContext* txn, - const StringData& ns ) const; + CollectionCatalogEntry* getCollectionCatalogEntry( const StringData& ns ) const; - RecordStore* getRecordStore( OperationContext* txn, - const StringData& ns ); + RecordStore* getRecordStore( const StringData& ns ) const; IndexAccessMethod* getIndex( OperationContext* txn, const CollectionCatalogEntry* collection, @@ -151,9 +149,7 @@ namespace mongo { RecordStoreV1Base* _getIndexRecordStore(); RecordStoreV1Base* _getNamespaceRecordStore_inlock() const; RecordStoreV1Base* _getNamespaceRecordStore() const; - - RecordStoreV1Base* _getRecordStore( OperationContext* txn, - const StringData& ns ); + RecordStoreV1Base* _getRecordStore( const StringData& ns ) const; void _addNamespaceToNamespaceCollection( OperationContext* txn, const StringData& ns, diff --git a/src/mongo/db/storage/mmap_v1/repair_database.cpp b/src/mongo/db/storage/mmap_v1/repair_database.cpp index 6bfbc9ce9c4..fbe2045cff1 100644 --- a/src/mongo/db/storage/mmap_v1/repair_database.cpp +++ b/src/mongo/db/storage/mmap_v1/repair_database.cpp @@ -328,7 +328,7 @@ namespace mongo { { string ns = dbName + ".system.namespaces"; Client::Context ctx(txn, ns ); - Collection* coll = originalDatabase->getCollection( txn, ns ); + Collection* coll = originalDatabase->getCollection( ns ); if ( coll ) { scoped_ptr<RecordIterator> it( coll->getIterator(txn) ); while ( !it->isEOF() ) { @@ -373,7 +373,7 @@ namespace mongo { } Client::Context readContext(txn, ns, originalDatabase); - Collection* originalCollection = originalDatabase->getCollection( txn, ns ); + Collection* originalCollection = originalDatabase->getCollection( ns ); invariant( originalCollection ); // data diff --git a/src/mongo/db/ttl.cpp b/src/mongo/db/ttl.cpp index b3d9b902c59..a2b5a1fdca3 100644 --- a/src/mongo/db/ttl.cpp +++ b/src/mongo/db/ttl.cpp @@ -156,7 +156,7 @@ namespace mongo { string ns = *it; Lock::CollectionLock collLock( txn->lockState(), ns, MODE_IS ); - CollectionCatalogEntry* coll = dbEntry->getCollectionCatalogEntry( txn, ns ); + CollectionCatalogEntry* coll = dbEntry->getCollectionCatalogEntry( ns ); if ( !coll ) { continue; // skip since collection not found in catalog @@ -220,7 +220,7 @@ namespace mongo { Lock::CollectionLock collLock( txn->lockState(), ns, MODE_IX ); - Collection* collection = db->getCollection( txn, ns ); + Collection* collection = db->getCollection( ns ); if ( !collection ) { // collection was dropped return true; diff --git a/src/mongo/dbtests/counttests.cpp b/src/mongo/dbtests/counttests.cpp index a854ebc0110..918b87ed3d7 100644 --- a/src/mongo/dbtests/counttests.cpp +++ b/src/mongo/dbtests/counttests.cpp @@ -54,7 +54,7 @@ namespace CountTests { { WriteUnitOfWork wunit(&_txn); - _collection = _database->getCollection( &_txn, ns() ); + _collection = _database->getCollection( ns() ); if ( _collection ) { _database->dropCollection( &_txn, ns() ); } diff --git a/src/mongo/dbtests/dbhelper_tests.cpp b/src/mongo/dbtests/dbhelper_tests.cpp index aa30a6fa749..ec695ece1d7 100644 --- a/src/mongo/dbtests/dbhelper_tests.cpp +++ b/src/mongo/dbtests/dbhelper_tests.cpp @@ -160,7 +160,7 @@ namespace mongo { ASSERT_LESS_THAN( estSizeBytes, maxSizeBytes ); Database* db = dbHolder().get( &txn, nsToDatabase(range.ns) ); - const Collection* collection = db->getCollection(&txn, ns); + const Collection* collection = db->getCollection(ns); // Make sure all the disklocs actually correspond to the right info for ( set<RecordId>::const_iterator it = locs.begin(); it != locs.end(); ++it ) { diff --git a/src/mongo/dbtests/executor_registry.cpp b/src/mongo/dbtests/executor_registry.cpp index 183079bee08..c9581be2952 100644 --- a/src/mongo/dbtests/executor_registry.cpp +++ b/src/mongo/dbtests/executor_registry.cpp @@ -80,7 +80,7 @@ namespace ExecutorRegistry { ws.release(), scan.release(), cq, - _ctx->ctx().db()->getCollection(&_opCtx, ns()), + _ctx->ctx().db()->getCollection(ns()), PlanExecutor::YIELD_MANUAL, &exec); ASSERT_OK(status); @@ -106,7 +106,7 @@ namespace ExecutorRegistry { int N() { return 50; } Collection* collection() { - return _ctx->ctx().db()->getCollection( &_opCtx, ns() ); + return _ctx->ctx().db()->getCollection( ns() ); } static const char* ns() { return "unittests.ExecutorRegistryDiskLocInvalidation"; } diff --git a/src/mongo/dbtests/namespacetests.cpp b/src/mongo/dbtests/namespacetests.cpp index ca4171e22a0..eb6c604c264 100644 --- a/src/mongo/dbtests/namespacetests.cpp +++ b/src/mongo/dbtests/namespacetests.cpp @@ -536,28 +536,28 @@ namespace NamespaceTests { Collection* committedColl; { WriteUnitOfWork wunit(&txn); - ASSERT_FALSE(db->getCollection(&txn, committedName)); + ASSERT_FALSE(db->getCollection(committedName)); committedColl = db->createCollection(&txn, committedName); - ASSERT_EQUALS(db->getCollection(&txn, committedName), committedColl); + ASSERT_EQUALS(db->getCollection(committedName), committedColl); wunit.commit(); } - ASSERT_EQUALS(db->getCollection(&txn, committedName), committedColl); + ASSERT_EQUALS(db->getCollection(committedName), committedColl); { WriteUnitOfWork wunit(&txn); - ASSERT_FALSE(db->getCollection(&txn, rolledBackName)); + ASSERT_FALSE(db->getCollection(rolledBackName)); Collection* rolledBackColl = db->createCollection(&txn, rolledBackName); - ASSERT_EQUALS(db->getCollection(&txn, rolledBackName), rolledBackColl); + ASSERT_EQUALS(db->getCollection(rolledBackName), rolledBackColl); // not committing so creation should be rolled back } // The rolledBackCollection creation should have been rolled back - ASSERT_FALSE(db->getCollection(&txn, rolledBackName)); + ASSERT_FALSE(db->getCollection(rolledBackName)); // The committedCollection should not have been affected by the rollback. Holders // of the original Collection pointer should still be valid. - ASSERT_EQUALS(db->getCollection(&txn, committedName), committedColl); + ASSERT_EQUALS(db->getCollection(committedName), committedColl); } }; @@ -579,33 +579,33 @@ namespace NamespaceTests { { WriteUnitOfWork wunit(&txn); - ASSERT_FALSE(db->getCollection(&txn, droppedName)); + ASSERT_FALSE(db->getCollection(droppedName)); Collection* droppedColl; droppedColl = db->createCollection(&txn, droppedName); - ASSERT_EQUALS(db->getCollection(&txn, droppedName), droppedColl); + ASSERT_EQUALS(db->getCollection(droppedName), droppedColl); db->dropCollection(&txn, droppedName); wunit.commit(); } // Should have been really dropped - ASSERT_FALSE(db->getCollection(&txn, droppedName)); + ASSERT_FALSE(db->getCollection(droppedName)); { WriteUnitOfWork wunit(&txn); - ASSERT_FALSE(db->getCollection(&txn, rolledBackName)); + ASSERT_FALSE(db->getCollection(rolledBackName)); Collection* rolledBackColl = db->createCollection(&txn, rolledBackName); wunit.commit(); - ASSERT_EQUALS(db->getCollection(&txn, rolledBackName), rolledBackColl); + ASSERT_EQUALS(db->getCollection(rolledBackName), rolledBackColl); db->dropCollection(&txn, rolledBackName); // not committing so dropping should be rolled back } // The rolledBackCollection dropping should have been rolled back. // Original Collection pointers are no longer valid. - ASSERT(db->getCollection(&txn, rolledBackName)); + ASSERT(db->getCollection(rolledBackName)); // The droppedCollection should not have been restored by the rollback. - ASSERT_FALSE(db->getCollection(&txn, droppedName)); + ASSERT_FALSE(db->getCollection(droppedName)); } }; } // namespace DatabaseTests diff --git a/src/mongo/dbtests/oplogstarttests.cpp b/src/mongo/dbtests/oplogstarttests.cpp index b84724ed853..1a6d397766f 100644 --- a/src/mongo/dbtests/oplogstarttests.cpp +++ b/src/mongo/dbtests/oplogstarttests.cpp @@ -44,7 +44,7 @@ namespace OplogStartTests { _context(&_txn, ns()), _client(&_txn) { - Collection* c = _context.db()->getCollection(&_txn, ns()); + Collection* c = _context.db()->getCollection(ns()); if (!c) { c = _context.db()->createCollection(&_txn, ns()); } @@ -71,7 +71,7 @@ namespace OplogStartTests { } Collection* collection() { - return _context.db()->getCollection( &_txn, ns() ); + return _context.db()->getCollection( ns() ); } DBDirectClient* client() { return &_client; } diff --git a/src/mongo/dbtests/pdfiletests.cpp b/src/mongo/dbtests/pdfiletests.cpp index 9d2a0fb2078..fbf557e9f40 100644 --- a/src/mongo/dbtests/pdfiletests.cpp +++ b/src/mongo/dbtests/pdfiletests.cpp @@ -62,7 +62,7 @@ namespace PdfileTests { return "unittests.pdfiletests.Insert"; } Collection* collection() { - return _context.db()->getCollection( &_txn, ns() ); + return _context.db()->getCollection( ns() ); } OperationContextImpl _txn; diff --git a/src/mongo/dbtests/query_plan_executor.cpp b/src/mongo/dbtests/query_plan_executor.cpp index dcb46f8705d..4b55d33262b 100644 --- a/src/mongo/dbtests/query_plan_executor.cpp +++ b/src/mongo/dbtests/query_plan_executor.cpp @@ -129,7 +129,7 @@ namespace QueryPlanExecutor { ixparams.bounds.endKeyInclusive = true; ixparams.direction = 1; - const Collection* coll = context.db()->getCollection(&_txn, ns()); + const Collection* coll = context.db()->getCollection(ns()); auto_ptr<WorkingSet> ws(new WorkingSet()); IndexScan* ix = new IndexScan(&_txn, ixparams, ws.get(), NULL); @@ -180,7 +180,7 @@ namespace QueryPlanExecutor { private: IndexDescriptor* getIndex(Database* db, const BSONObj& obj) { - Collection* collection = db->getCollection( &_txn, ns() ); + Collection* collection = db->getCollection( ns() ); return collection->getIndexCatalog()->findIndexByKeyPattern(&_txn, obj); } diff --git a/src/mongo/dbtests/query_stage_count_scan.cpp b/src/mongo/dbtests/query_stage_count_scan.cpp index 0301f391359..d3d379fc6fe 100644 --- a/src/mongo/dbtests/query_stage_count_scan.cpp +++ b/src/mongo/dbtests/query_stage_count_scan.cpp @@ -88,7 +88,7 @@ namespace QueryStageCountScan { } IndexDescriptor* getIndex(Database* db, const BSONObj& obj) { - Collection* collection = db->getCollection(&_txn, ns()); + Collection* collection = db->getCollection(ns()); return collection->getIndexCatalog()->findIndexByKeyPattern(&_txn, obj); } diff --git a/src/mongo/dbtests/query_stage_fetch.cpp b/src/mongo/dbtests/query_stage_fetch.cpp index a827dafd570..cb13920cae6 100644 --- a/src/mongo/dbtests/query_stage_fetch.cpp +++ b/src/mongo/dbtests/query_stage_fetch.cpp @@ -89,7 +89,7 @@ namespace QueryStageFetch { void run() { Client::WriteContext ctx(&_txn, ns()); Database* db = ctx.ctx().db(); - Collection* coll = db->getCollection(&_txn, ns()); + Collection* coll = db->getCollection(ns()); if (!coll) { WriteUnitOfWork wuow(&_txn); coll = db->createCollection(&_txn, ns()); @@ -151,7 +151,7 @@ namespace QueryStageFetch { Lock::DBLock lk(_txn.lockState(), nsToDatabaseSubstring(ns()), MODE_X); Client::Context ctx(&_txn, ns()); Database* db = ctx.db(); - Collection* coll = db->getCollection(&_txn, ns()); + Collection* coll = db->getCollection(ns()); if (!coll) { WriteUnitOfWork wuow(&_txn); coll = db->createCollection(&_txn, ns()); diff --git a/src/mongo/dbtests/query_stage_keep.cpp b/src/mongo/dbtests/query_stage_keep.cpp index 40c49905102..9b7b6464c87 100644 --- a/src/mongo/dbtests/query_stage_keep.cpp +++ b/src/mongo/dbtests/query_stage_keep.cpp @@ -107,7 +107,7 @@ namespace QueryStageKeep { void run() { Client::WriteContext ctx(&_txn, ns()); Database* db = ctx.ctx().db(); - Collection* coll = db->getCollection(&_txn, ns()); + Collection* coll = db->getCollection(ns()); if (!coll) { WriteUnitOfWork wuow(&_txn); coll = db->createCollection(&_txn, ns()); @@ -172,7 +172,7 @@ namespace QueryStageKeep { Client::WriteContext ctx(&_txn, ns()); Database* db = ctx.ctx().db(); - Collection* coll = db->getCollection(&_txn, ns()); + Collection* coll = db->getCollection(ns()); if (!coll) { WriteUnitOfWork wuow(&_txn); coll = db->createCollection(&_txn, ns()); diff --git a/src/mongo/dbtests/query_stage_merge_sort.cpp b/src/mongo/dbtests/query_stage_merge_sort.cpp index 53173b26780..a157ef635c6 100644 --- a/src/mongo/dbtests/query_stage_merge_sort.cpp +++ b/src/mongo/dbtests/query_stage_merge_sort.cpp @@ -111,7 +111,7 @@ namespace QueryStageMergeSortTests { void run() { Client::WriteContext ctx(&_txn, ns()); Database* db = ctx.ctx().db(); - Collection* coll = db->getCollection(&_txn, ns()); + Collection* coll = db->getCollection(ns()); if (!coll) { WriteUnitOfWork wuow(&_txn); coll = db->createCollection(&_txn, ns()); @@ -180,7 +180,7 @@ namespace QueryStageMergeSortTests { void run() { Client::WriteContext ctx(&_txn, ns()); Database* db = ctx.ctx().db(); - Collection* coll = db->getCollection(&_txn, ns()); + Collection* coll = db->getCollection(ns()); if (!coll) { WriteUnitOfWork wuow(&_txn); coll = db->createCollection(&_txn, ns()); @@ -248,7 +248,7 @@ namespace QueryStageMergeSortTests { void run() { Client::WriteContext ctx(&_txn, ns()); Database* db = ctx.ctx().db(); - Collection* coll = db->getCollection(&_txn, ns()); + Collection* coll = db->getCollection(ns()); if (!coll) { WriteUnitOfWork wuow(&_txn); coll = db->createCollection(&_txn, ns()); @@ -317,7 +317,7 @@ namespace QueryStageMergeSortTests { void run() { Client::WriteContext ctx(&_txn, ns()); Database* db = ctx.ctx().db(); - Collection* coll = db->getCollection(&_txn, ns()); + Collection* coll = db->getCollection(ns()); if (!coll) { WriteUnitOfWork wuow(&_txn); coll = db->createCollection(&_txn, ns()); @@ -387,7 +387,7 @@ namespace QueryStageMergeSortTests { void run() { Client::WriteContext ctx(&_txn, ns()); Database* db = ctx.ctx().db(); - Collection* coll = db->getCollection(&_txn, ns()); + Collection* coll = db->getCollection(ns()); if (!coll) { WriteUnitOfWork wuow(&_txn); coll = db->createCollection(&_txn, ns()); @@ -455,7 +455,7 @@ namespace QueryStageMergeSortTests { void run() { Client::WriteContext ctx(&_txn, ns()); Database* db = ctx.ctx().db(); - Collection* coll = db->getCollection(&_txn, ns()); + Collection* coll = db->getCollection(ns()); if (!coll) { WriteUnitOfWork wuow(&_txn); coll = db->createCollection(&_txn, ns()); @@ -513,7 +513,7 @@ namespace QueryStageMergeSortTests { void run() { Client::WriteContext ctx(&_txn, ns()); Database* db = ctx.ctx().db(); - Collection* coll = db->getCollection(&_txn, ns()); + Collection* coll = db->getCollection(ns()); if (!coll) { WriteUnitOfWork wuow(&_txn); coll = db->createCollection(&_txn, ns()); diff --git a/src/mongo/dbtests/query_stage_sort.cpp b/src/mongo/dbtests/query_stage_sort.cpp index 23a1b34fd30..d182a91e12f 100644 --- a/src/mongo/dbtests/query_stage_sort.cpp +++ b/src/mongo/dbtests/query_stage_sort.cpp @@ -190,7 +190,7 @@ namespace QueryStageSortTests { void run() { Client::WriteContext ctx(&_txn, ns()); Database* db = ctx.ctx().db(); - Collection* coll = db->getCollection(&_txn, ns()); + Collection* coll = db->getCollection(ns()); if (!coll) { WriteUnitOfWork wuow(&_txn); coll = db->createCollection(&_txn, ns()); @@ -210,7 +210,7 @@ namespace QueryStageSortTests { void run() { Client::WriteContext ctx(&_txn, ns()); Database* db = ctx.ctx().db(); - Collection* coll = db->getCollection(&_txn, ns()); + Collection* coll = db->getCollection(ns()); if (!coll) { WriteUnitOfWork wuow(&_txn); coll = db->createCollection(&_txn, ns()); @@ -239,7 +239,7 @@ namespace QueryStageSortTests { void run() { Client::WriteContext ctx(&_txn, ns()); Database* db = ctx.ctx().db(); - Collection* coll = db->getCollection(&_txn, ns()); + Collection* coll = db->getCollection(ns()); if (!coll) { WriteUnitOfWork wuow(&_txn); coll = db->createCollection(&_txn, ns()); @@ -259,7 +259,7 @@ namespace QueryStageSortTests { void run() { Client::WriteContext ctx(&_txn, ns()); Database* db = ctx.ctx().db(); - Collection* coll = db->getCollection(&_txn, ns()); + Collection* coll = db->getCollection(ns()); if (!coll) { WriteUnitOfWork wuow(&_txn); coll = db->createCollection(&_txn, ns()); @@ -351,7 +351,7 @@ namespace QueryStageSortTests { void run() { Client::WriteContext ctx(&_txn, ns()); Database* db = ctx.ctx().db(); - Collection* coll = db->getCollection(&_txn, ns()); + Collection* coll = db->getCollection(ns()); if (!coll) { WriteUnitOfWork wuow(&_txn); coll = db->createCollection(&_txn, ns()); diff --git a/src/mongo/dbtests/query_stage_update.cpp b/src/mongo/dbtests/query_stage_update.cpp index 624eec54a71..ac3472881e9 100644 --- a/src/mongo/dbtests/query_stage_update.cpp +++ b/src/mongo/dbtests/query_stage_update.cpp @@ -255,7 +255,7 @@ namespace QueryStageUpdate { OpDebug* opDebug = &curOp.debug(); UpdateDriver driver( (UpdateDriver::Options()) ); Database* db = ctx.ctx().db(); - Collection* coll = db->getCollection(&_txn, ns()); + Collection* coll = db->getCollection(ns()); // Get the RecordIds that would be returned by an in-order scan. vector<RecordId> locs; diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp index 449a3d52b7d..657a0b03b52 100644 --- a/src/mongo/dbtests/querytests.cpp +++ b/src/mongo/dbtests/querytests.cpp @@ -62,7 +62,7 @@ namespace QueryTests { { WriteUnitOfWork wunit(&_txn); _database = _context.db(); - _collection = _database->getCollection( &_txn, ns() ); + _collection = _database->getCollection( ns() ); if ( _collection ) { _database->dropCollection( &_txn, ns() ); } @@ -177,7 +177,7 @@ namespace QueryTests { { WriteUnitOfWork wunit(&_txn); Database* db = ctx.db(); - if ( db->getCollection( &_txn, ns() ) ) { + if ( db->getCollection( ns() ) ) { _collection = NULL; db->dropCollection( &_txn, ns() ); } @@ -665,7 +665,7 @@ namespace QueryTests { ASSERT_EQUALS( two, c->next()["ts"].Date() ); long long cursorId = c->getCursorId(); - ClientCursorPin clientCursor( ctx.db()->getCollection( &_txn, ns )->cursorManager(), + ClientCursorPin clientCursor( ctx.db()->getCollection( ns )->cursorManager(), cursorId ); ASSERT_EQUALS( three.millis, clientCursor.c()->getSlaveReadTill().asDate() ); } @@ -1553,8 +1553,7 @@ namespace QueryTests { { Client::WriteContext ctx(&_txn, ns() ); - ClientCursorPin pinCursor( ctx.ctx().db()->getCollection( &_txn, - ns())->cursorManager(), + ClientCursorPin pinCursor( ctx.ctx().db()->getCollection( ns())->cursorManager(), cursorId ); string expectedAssertion = str::stream() << "Cannot kill active cursor " << cursorId; diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp index 29444c86544..6a3f50d5959 100644 --- a/src/mongo/dbtests/repltests.cpp +++ b/src/mongo/dbtests/repltests.cpp @@ -79,7 +79,7 @@ namespace ReplTests { Client::WriteContext ctx(&_txn, ns()); WriteUnitOfWork wuow(&_txn); - Collection* c = ctx.ctx().db()->getCollection(&_txn, ns()); + Collection* c = ctx.ctx().db()->getCollection(ns()); if ( ! c ) { c = ctx.ctx().db()->createCollection(&_txn, ns()); } @@ -135,7 +135,7 @@ namespace ReplTests { Lock::GlobalWrite lk(_txn.lockState()); Client::Context ctx(&_txn, ns() ); Database* db = ctx.db(); - Collection* coll = db->getCollection( &_txn, ns() ); + Collection* coll = db->getCollection( ns() ); if ( !coll ) { WriteUnitOfWork wunit(&_txn); coll = db->createCollection( &_txn, ns() ); @@ -156,7 +156,7 @@ namespace ReplTests { Client::Context ctx(&_txn, cllNS() ); Database* db = ctx.db(); - Collection* coll = db->getCollection( &_txn, cllNS() ); + Collection* coll = db->getCollection( cllNS() ); if ( !coll ) { WriteUnitOfWork wunit(&_txn); coll = db->createCollection( &_txn, cllNS() ); @@ -178,7 +178,7 @@ namespace ReplTests { { Client::Context ctx(&_txn, cllNS() ); Database* db = ctx.db(); - Collection* coll = db->getCollection( &_txn, cllNS() ); + Collection* coll = db->getCollection( cllNS() ); RecordIterator* it = coll->getIterator(&_txn); while ( !it->isEOF() ) { @@ -209,7 +209,7 @@ namespace ReplTests { Client::Context ctx(&_txn, ns ); Database* db = ctx.db(); - Collection* coll = db->getCollection( &_txn, ns ); + Collection* coll = db->getCollection( ns ); if ( !coll ) { WriteUnitOfWork wunit(&_txn); coll = db->createCollection( &_txn, ns ); @@ -231,7 +231,7 @@ namespace ReplTests { Client::Context ctx(&_txn, ns ); WriteUnitOfWork wunit(&_txn); Database* db = ctx.db(); - Collection* coll = db->getCollection( &_txn, ns ); + Collection* coll = db->getCollection( ns ); if ( !coll ) { coll = db->createCollection( &_txn, ns ); } @@ -253,7 +253,7 @@ namespace ReplTests { Client::Context ctx(&_txn, ns() ); WriteUnitOfWork wunit(&_txn); Database* db = ctx.db(); - Collection* coll = db->getCollection( &_txn, ns() ); + Collection* coll = db->getCollection( ns() ); if ( !coll ) { coll = db->createCollection( &_txn, ns() ); } diff --git a/src/mongo/dbtests/rollbacktests.cpp b/src/mongo/dbtests/rollbacktests.cpp index 11771128e84..2f7645e7ed1 100644 --- a/src/mongo/dbtests/rollbacktests.cpp +++ b/src/mongo/dbtests/rollbacktests.cpp @@ -80,13 +80,13 @@ namespace { return db->renameCollection( txn, source.ns(), target.ns(), false ); } Status truncateCollection( OperationContext* txn, const NamespaceString& nss ) { - Collection* coll = dbHolder().get( txn, nss.db() )->getCollection( txn, nss.ns() ); + Collection* coll = dbHolder().get( txn, nss.db() )->getCollection(nss.ns() ); return coll->truncate( txn ); } RecordId insertRecord( OperationContext* txn, const NamespaceString& nss, const BSONObj& data ) { - Collection* coll = dbHolder().get( txn, nss.db() )->getCollection( txn, nss.ns() ); + Collection* coll = dbHolder().get( txn, nss.db() )->getCollection(nss.ns() ); StatusWith<RecordId> status = coll->insertDocument( txn, data, false ); ASSERT_OK( status.getStatus() ); return status.getValue(); @@ -94,7 +94,7 @@ namespace { void assertOnlyRecord( OperationContext* txn, const NamespaceString& nss, const BSONObj& data ) { - Collection* coll = dbHolder().get( txn, nss.db() )->getCollection( txn, nss.ns() ); + Collection* coll = dbHolder().get( txn, nss.db() )->getCollection(nss.ns() ); scoped_ptr<RecordIterator> iter( coll->getIterator( txn ) ); ASSERT( !iter->isEOF() ); RecordId loc = iter->getNext(); @@ -102,16 +102,16 @@ namespace { ASSERT_EQ( data, coll->docFor( txn, loc ) ); } void assertEmpty( OperationContext* txn, const NamespaceString& nss ) { - Collection* coll = dbHolder().get( txn, nss.db() )->getCollection( txn, nss.ns() ); + Collection* coll = dbHolder().get( txn, nss.db() )->getCollection(nss.ns() ); scoped_ptr<RecordIterator> iter( coll->getIterator( txn ) ); ASSERT( iter->isEOF() ); } bool indexExists( OperationContext* txn, const NamespaceString& nss, const string& idxName ) { - Collection* coll = dbHolder().get( txn, nss.db() )->getCollection( txn, nss.ns() ); + Collection* coll = dbHolder().get( txn, nss.db() )->getCollection(nss.ns() ); return coll->getIndexCatalog()->findIndexByName( txn, idxName, true ) != NULL; } bool indexReady( OperationContext* txn, const NamespaceString& nss, const string& idxName ) { - Collection* coll = dbHolder().get( txn, nss.db() )->getCollection( txn, nss.ns() ); + Collection* coll = dbHolder().get( txn, nss.db() )->getCollection(nss.ns() ); return coll->getIndexCatalog()->findIndexByName( txn, idxName, false ) != NULL; } size_t getNumIndexEntries( OperationContext* txn, @@ -119,7 +119,7 @@ namespace { const string& idxName ) { size_t numEntries = 0; - Collection* coll = dbHolder().get( txn, nss.db() )->getCollection( txn, nss.ns() ); + Collection* coll = dbHolder().get( txn, nss.db() )->getCollection(nss.ns() ); IndexCatalog* catalog = coll->getIndexCatalog(); IndexDescriptor* desc = catalog->findIndexByName( txn, idxName, false ); @@ -141,7 +141,7 @@ namespace { return numEntries; } void dropIndex( OperationContext* txn, const NamespaceString& nss, const string& idxName ) { - Collection* coll = dbHolder().get( txn, nss.db() )->getCollection( txn, nss.ns() ); + Collection* coll = dbHolder().get( txn, nss.db() )->getCollection(nss.ns() ); IndexDescriptor* desc = coll->getIndexCatalog()->findIndexByName( txn, idxName ); ASSERT( desc ); ASSERT_OK( coll->getIndexCatalog()->dropIndex( txn, desc ) ); @@ -479,7 +479,7 @@ namespace { ScopedTransaction transaction(&txn, MODE_IX); AutoGetDb autoDb(&txn, nss.db(), MODE_X); - Collection* coll = autoDb.getDb()->getCollection( &txn, ns ); + Collection* coll = autoDb.getDb()->getCollection( ns ); IndexCatalog* catalog = coll->getIndexCatalog(); string idxName = "a"; @@ -520,7 +520,7 @@ namespace { ScopedTransaction transaction(&txn, MODE_IX); AutoGetDb autoDb(&txn, nss.db(), MODE_X); - Collection* coll = autoDb.getDb()->getCollection(&txn, ns); + Collection* coll = autoDb.getDb()->getCollection(ns); IndexCatalog* catalog = coll->getIndexCatalog(); string idxName = "a"; @@ -573,7 +573,7 @@ namespace { ScopedTransaction transaction(&txn, MODE_IX); AutoGetDb autoDb(&txn, nss.db(), MODE_X); - Collection* coll = autoDb.getDb()->getCollection(&txn, ns); + Collection* coll = autoDb.getDb()->getCollection(ns); IndexCatalog* catalog = coll->getIndexCatalog(); string idxName = "a"; @@ -616,7 +616,7 @@ namespace { ScopedTransaction transaction(&txn, MODE_IX); AutoGetDb autoDb(&txn, nss.db(), MODE_X); - Collection* coll = autoDb.getDb()->getCollection(&txn, ns); + Collection* coll = autoDb.getDb()->getCollection(ns); IndexCatalog* catalog = coll->getIndexCatalog(); string idxName = "a"; @@ -693,7 +693,7 @@ namespace { ASSERT( !collectionExists( &ctx, nss.ns() ) ); ASSERT_OK( userCreateNS( &txn, ctx.db(), nss.ns(), BSONObj(), false, false ) ); ASSERT( collectionExists( &ctx, nss.ns() ) ); - Collection* coll = ctx.db()->getCollection( &txn, ns ); + Collection* coll = ctx.db()->getCollection( ns ); IndexCatalog* catalog = coll->getIndexCatalog(); ASSERT_OK( catalog->createIndexOnEmptyCollection( &txn, specA ) ); diff --git a/src/mongo/s/d_migrate.cpp b/src/mongo/s/d_migrate.cpp index abcc5fcd850..c25b0f44ca2 100644 --- a/src/mongo/s/d_migrate.cpp +++ b/src/mongo/s/d_migrate.cpp @@ -1902,7 +1902,7 @@ namespace mongo { Client::WriteContext ctx(txn, ns ); // Only copy if ns doesn't already exist Database* db = ctx.ctx().db(); - Collection* collection = db->getCollection( txn, ns ); + Collection* collection = db->getCollection( ns ); if ( !collection ) { list<BSONObj> infos = @@ -1940,7 +1940,7 @@ namespace mongo { Lock::DBLock lk(txn->lockState(), nsToDatabaseSubstring(ns), MODE_X); Client::Context ctx(txn, ns); Database* db = ctx.db(); - Collection* collection = db->getCollection( txn, ns ); + Collection* collection = db->getCollection( ns ); if ( !collection ) { errmsg = str::stream() << "collection dropped during migration: " << ns; warning() << errmsg; |