diff options
author | Scott Hernandez <scotthernandez@gmail.com> | 2014-12-22 17:32:27 -0500 |
---|---|---|
committer | Scott Hernandez <scotthernandez@gmail.com> | 2015-01-02 14:21:08 -0500 |
commit | 8384c878b542352ba88ecade1e675b8412f2655f (patch) | |
tree | a9b40ee6ec4fb837b99a2d3a9e37b6ece12a650c /src/mongo/db/cloner.cpp | |
parent | 8b37507dd51cdf058377a24ca0171e7fae6f2c6b (diff) | |
download | mongo-8384c878b542352ba88ecade1e675b8412f2655f.tar.gz |
SERVER-16502: make getCollection const and not require an OpContext
Diffstat (limited to 'src/mongo/db/cloner.cpp')
-rw-r--r-- | src/mongo/db/cloner.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
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 |