summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2021-04-29 08:22:44 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-04-29 12:44:08 +0000
commit3aee716a28a8ccc5258316ebbe48e19343f4ee79 (patch)
treea6b3c487c1400ea091efa362bd8e9baf5b931ef5
parentade65ff718889aec8f60b4bedfa2c6e88c718ef2 (diff)
downloadmongo-3aee716a28a8ccc5258316ebbe48e19343f4ee79.tar.gz
SERVER-47123 remove AutoGetOrCreateDb from repl::StorageInterfaceImpl
StorageInterfaceImpl is used in replication to access the storage and query execution subsystems. AutoGetOrCreateDb is deprecated in favor of AutoGetDb and AutoGetCollection.
-rw-r--r--src/mongo/db/repl/storage_interface_impl.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/repl/storage_interface_impl.cpp b/src/mongo/db/repl/storage_interface_impl.cpp
index 19a1a544494..1ed67534507 100644
--- a/src/mongo/db/repl/storage_interface_impl.cpp
+++ b/src/mongo/db/repl/storage_interface_impl.cpp
@@ -236,7 +236,7 @@ StorageInterfaceImpl::createCollectionForBulkLoading(
UnreplicatedWritesBlock uwb(opCtx.get());
// Get locks and create the collection.
- AutoGetOrCreateDb db(opCtx.get(), nss.db(), MODE_IX);
+ AutoGetDb autoDb(opCtx.get(), nss.db(), MODE_IX);
AutoGetCollection coll(opCtx.get(), nss, fixLockModeForSystemDotViewsChanges(nss, MODE_X));
if (coll) {
return Status(ErrorCodes::NamespaceExists,
@@ -245,7 +245,8 @@ StorageInterfaceImpl::createCollectionForBulkLoading(
{
// Create the collection.
WriteUnitOfWork wunit(opCtx.get());
- fassert(40332, db.getDb()->createCollection(opCtx.get(), nss, options, false));
+ auto db = autoDb.ensureDbExists();
+ fassert(40332, db->createCollection(opCtx.get(), nss, options, false));
wunit.commit();
}
@@ -479,8 +480,8 @@ Status StorageInterfaceImpl::createCollection(OperationContext* opCtx,
const NamespaceString& nss,
const CollectionOptions& options) {
return writeConflictRetry(opCtx, "StorageInterfaceImpl::createCollection", nss.ns(), [&] {
- AutoGetOrCreateDb databaseWriteGuard(opCtx, nss.db(), MODE_IX);
- auto db = databaseWriteGuard.getDb();
+ AutoGetDb databaseWriteGuard(opCtx, nss.db(), MODE_IX);
+ auto db = databaseWriteGuard.ensureDbExists();
invariant(db);
if (CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, nss)) {
return Status(ErrorCodes::NamespaceExists,