summaryrefslogtreecommitdiff
path: root/src/mongo/db/cloner.cpp
diff options
context:
space:
mode:
authorEvgeni Dobranov <evgeni.dobranov@mongodb.com>2019-09-30 20:02:19 +0000
committerevergreen <evergreen@mongodb.com>2019-09-30 20:02:19 +0000
commit344e1b0f3ce5caf0d4760dddc8b2d196d4b73fe8 (patch)
tree14567c05e50661f6fb3b983a2b19a26abfe4a22c /src/mongo/db/cloner.cpp
parent25b63d9ff12ebdfde549288ebaa7ff27c6945dd7 (diff)
downloadmongo-344e1b0f3ce5caf0d4760dddc8b2d196d4b73fe8.tar.gz
SERVER-41496 Remove Database::getCollection() and replace with CollectionCatalog::get().lookupCollectionByNamespace()
Diffstat (limited to 'src/mongo/db/cloner.cpp')
-rw-r--r--src/mongo/db/cloner.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp
index 30402ec2552..06d594d1afd 100644
--- a/src/mongo/db/cloner.cpp
+++ b/src/mongo/db/cloner.cpp
@@ -116,7 +116,7 @@ struct Cloner::Fun {
bool createdCollection = false;
Collection* collection = nullptr;
- collection = db->getCollection(opCtx, to_collection);
+ collection = CollectionCatalog::get(opCtx).lookupCollectionByNamespace(to_collection);
if (!collection) {
massert(17321,
str::stream() << "collection dropped during clone [" << to_collection.ns()
@@ -137,7 +137,8 @@ struct Cloner::Fun {
str::stream() << "collection creation failed during clone ["
<< to_collection.ns() << "]");
wunit.commit();
- collection = db->getCollection(opCtx, to_collection);
+ collection =
+ CollectionCatalog::get(opCtx).lookupCollectionByNamespace(to_collection);
invariant(collection,
str::stream()
<< "Missing collection during clone [" << to_collection.ns() << "]");
@@ -178,7 +179,8 @@ struct Cloner::Fun {
str::stream() << "Database " << _dbName << " dropped while cloning",
db != nullptr);
- collection = db->getCollection(opCtx, to_collection);
+ collection =
+ CollectionCatalog::get(opCtx).lookupCollectionByNamespace(to_collection);
uassert(28594,
str::stream()
<< "Collection " << to_collection.ns() << " dropped while cloning",
@@ -325,7 +327,8 @@ void Cloner::copyIndexes(OperationContext* opCtx,
auto databaseHolder = DatabaseHolder::get(opCtx);
auto db = databaseHolder->openDb(opCtx, toDBName);
- Collection* collection = db->getCollection(opCtx, to_collection);
+ Collection* collection =
+ CollectionCatalog::get(opCtx).lookupCollectionByNamespace(to_collection);
if (!collection) {
writeConflictRetry(opCtx, "createCollection", to_collection.ns(), [&] {
opCtx->checkForInterrupt();
@@ -343,7 +346,7 @@ void Cloner::copyIndexes(OperationContext* opCtx,
<< "Collection creation failed while copying indexes from "
<< from_collection.ns() << " to " << to_collection.ns() << " (Cloner)");
wunit.commit();
- collection = db->getCollection(opCtx, to_collection);
+ collection = CollectionCatalog::get(opCtx).lookupCollectionByNamespace(to_collection);
invariant(collection,
str::stream() << "Missing collection " << to_collection.ns() << " (Cloner)");
});
@@ -548,7 +551,7 @@ Status Cloner::createCollectionsForDb(
opCtx->checkForInterrupt();
WriteUnitOfWork wunit(opCtx);
- Collection* collection = db->getCollection(opCtx, nss);
+ Collection* collection = CollectionCatalog::get(opCtx).lookupCollectionByNamespace(nss);
if (collection) {
if (!params.shardedColl) {
// If the collection is unsharded then we want to fail when a collection