diff options
author | Kyle Suarez <kyle.suarez@mongodb.com> | 2018-04-30 10:25:12 -0400 |
---|---|---|
committer | Kyle Suarez <kyle.suarez@mongodb.com> | 2018-04-30 11:14:59 -0400 |
commit | a9b53ada0db65e6ee341260c3256e960bac56a94 (patch) | |
tree | 17f359614f594c9427e982faa665578a05bd8728 /src/mongo/db/cloner.cpp | |
parent | 69b6d9846e3fae2fea9313757c7563b1061cf585 (diff) | |
download | mongo-a9b53ada0db65e6ee341260c3256e960bac56a94.tar.gz |
Revert "SERVER-32645 Create a shim helper framework."
This reverts commit 2227f272a7a0a3e43625cb2d4a2704e1ccb6f893.
Diffstat (limited to 'src/mongo/db/cloner.cpp')
-rw-r--r-- | src/mongo/db/cloner.cpp | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp index 8af7e4f452d..4c1971b8585 100644 --- a/src/mongo/db/cloner.cpp +++ b/src/mongo/db/cloner.cpp @@ -1,3 +1,6 @@ + +// cloner.cpp - copy a database (export/import basically) + /** * Copyright (C) 2008 10gen Inc. * @@ -153,7 +156,7 @@ struct Cloner::Fun { repl::ReplicationCoordinator::get(opCtx)->canAcceptWritesFor(opCtx, to_collection)); // Make sure database still exists after we resume from the temp release - Database* db = DatabaseHolder::getDatabaseHolder().openDb(opCtx, _dbName); + Database* db = dbHolder().openDb(opCtx, _dbName); bool createdCollection = false; Collection* collection = NULL; @@ -169,14 +172,13 @@ struct Cloner::Fun { WriteUnitOfWork wunit(opCtx); const bool createDefaultIndexes = true; - Status s = Database::userCreateNS( - opCtx, - db, - to_collection.toString(), - from_options, - CollectionOptions::parseForCommand, - createDefaultIndexes, - fixIndexSpec(to_collection.db().toString(), from_id_index)); + Status s = userCreateNS(opCtx, + db, + to_collection.toString(), + from_options, + CollectionOptions::parseForCommand, + createDefaultIndexes, + fixIndexSpec(to_collection.db().toString(), from_id_index)); verify(s.isOK()); wunit.commit(); collection = db->getCollection(opCtx, to_collection); @@ -212,7 +214,7 @@ struct Cloner::Fun { } // TODO: SERVER-16598 abort if original db or collection is gone. - db = DatabaseHolder::getDatabaseHolder().get(opCtx, _dbName); + db = dbHolder().get(opCtx, _dbName); uassert(28593, str::stream() << "Database " << _dbName << " dropped while cloning", db != NULL); @@ -370,7 +372,7 @@ void Cloner::copyIndexes(OperationContext* opCtx, // We are under lock here again, so reload the database in case it may have disappeared // during the temp release - Database* db = DatabaseHolder::getDatabaseHolder().openDb(opCtx, toDBName); + Database* db = dbHolder().openDb(opCtx, toDBName); Collection* collection = db->getCollection(opCtx, to_collection); if (!collection) { @@ -379,7 +381,7 @@ void Cloner::copyIndexes(OperationContext* opCtx, WriteUnitOfWork wunit(opCtx); const bool createDefaultIndexes = true; - Status s = Database::userCreateNS( + Status s = userCreateNS( opCtx, db, to_collection.toString(), @@ -477,7 +479,7 @@ bool Cloner::copyCollection(OperationContext* opCtx, !opCtx->writesAreReplicated() || repl::ReplicationCoordinator::get(opCtx)->canAcceptWritesFor(opCtx, nss)); - Database* db = DatabaseHolder::getDatabaseHolder().openDb(opCtx, dbname); + Database* db = dbHolder().openDb(opCtx, dbname); if (shouldCreateCollection) { bool result = writeConflictRetry(opCtx, "createCollection", ns, [&] { @@ -485,7 +487,7 @@ bool Cloner::copyCollection(OperationContext* opCtx, WriteUnitOfWork wunit(opCtx); const bool createDefaultIndexes = true; - Status status = Database::userCreateNS( + Status status = userCreateNS( opCtx, db, ns, options, optionsParser, createDefaultIndexes, idIndexSpec); if (!status.isOK()) { errmsg = status.toString(); @@ -565,7 +567,7 @@ Status Cloner::createCollectionsForDb( const std::vector<CreateCollectionParams>& createCollectionParams, const std::string& dbName, const CloneOptions& opts) { - Database* db = DatabaseHolder::getDatabaseHolder().openDb(opCtx, dbName); + Database* db = dbHolder().openDb(opCtx, dbName); invariant(opCtx->lockState()->isDbLockedForMode(dbName, MODE_X)); auto collCount = 0; @@ -637,13 +639,13 @@ Status Cloner::createCollectionsForDb( auto options = optionsBuilder.obj(); Status createStatus = - Database::userCreateNS(opCtx, - db, - nss.ns(), - options, - CollectionOptions::parseForStorage, - createDefaultIndexes, - fixIndexSpec(nss.db().toString(), params.idIndexSpec)); + userCreateNS(opCtx, + db, + nss.ns(), + options, + CollectionOptions::parseForStorage, + createDefaultIndexes, + fixIndexSpec(nss.db().toString(), params.idIndexSpec)); if (!createStatus.isOK()) { return createStatus; } |