diff options
author | jannaerin <golden.janna@gmail.com> | 2022-08-25 15:30:41 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-08-25 16:18:39 +0000 |
commit | f08fc26ba70e757df4f5cc1287f0d392964b6b53 (patch) | |
tree | 45ee2532b2d9d362c4f237f299cade45713876aa /src/mongo/db | |
parent | 0ead2f7196a757e41bd5b00428519daa2baa4700 (diff) | |
download | mongo-f08fc26ba70e757df4f5cc1287f0d392964b6b53.tar.gz |
SERVER-67549 Change dropDatabase command path to use DatabaseName
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/auth/action_type.idl | 56 | ||||
-rw-r--r-- | src/mongo/db/catalog/drop_database.cpp | 55 | ||||
-rw-r--r-- | src/mongo/db/catalog/drop_database.h | 5 | ||||
-rw-r--r-- | src/mongo/db/catalog/drop_database_test.cpp | 26 | ||||
-rw-r--r-- | src/mongo/db/commands/dbcommands.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/storage_timestamp_test.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/s/resharding/resharding_donor_recipient_common_test.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/s/shardsvr_drop_database_participant_command.cpp | 2 |
9 files changed, 103 insertions, 55 deletions
diff --git a/src/mongo/db/auth/action_type.idl b/src/mongo/db/auth/action_type.idl index ad1fb2cb0f9..1a85e758508 100644 --- a/src/mongo/db/auth/action_type.idl +++ b/src/mongo/db/auth/action_type.idl @@ -210,6 +210,7 @@ enums: value: "cluster" extra_data: serverlessActionTypes: + - applyOps - killAnyCursor - killAnySession - killCursors @@ -222,10 +223,12 @@ enums: value: "collection" extra_data: serverlessActionTypes: &actionsValidOnCollection + - analyze - bypassDocumentValidation - changeStream - collMod - collStats + - compact - compactStructuredEncryptionData - convertToCapped - createCollection @@ -235,6 +238,7 @@ enums: - dbStats - dropCollection - dropIndex + - enableProfiler - exportCollection - find - importCollection @@ -243,11 +247,14 @@ enums: - killCursors - listCollections - listIndexes + - planCacheIndexFilter - planCacheRead + - planCacheWrite - reIndex - remove - renameCollection - renameCollectionSameDB + - storageDetails - update - validate @@ -260,10 +267,12 @@ enums: # Actions common to collection patterns. # YAML doesn't support extending list aliases. # Make changes above, then copy here. + - analyze - bypassDocumentValidation - changeStream - collMod - collStats + - compact - compactStructuredEncryptionData - convertToCapped - createCollection @@ -273,6 +282,7 @@ enums: - dbStats - dropCollection - dropIndex + - enableProfiler - exportCollection - find - importCollection @@ -281,11 +291,14 @@ enums: - killCursors - listCollections - listIndexes + - planCacheIndexFilter - planCacheRead + - planCacheWrite - reIndex - remove - renameCollection - renameCollectionSameDB + - storageDetails - update - validate @@ -321,28 +334,63 @@ enums: description: Matches a collection named "<db>.system.buckets.<collection>" value: "system_buckets" extra_data: - serverlessActionTypes: *actionsValidOnCollection + serverlessActionTypes: &actionsValidOnSystemBuckets + - analyze + - bypassDocumentValidation + - changeStream + - collMod + - collStats + - compact + - compactStructuredEncryptionData + - convertToCapped + - createCollection + - createIndex + - dbCheck + - dbHash + - dbStats + - dropCollection + - dropDatabase + - dropIndex + - enableProfiler + - exportCollection + - find + - importCollection + - insert + - killAnyCursor + - killCursors + - listCollections + - listIndexes + - planCacheIndexFilter + - planCacheRead + - planCacheWrite + - reIndex + - remove + - renameCollection + - renameCollectionSameDB + - storageDetails + - update + - validate # resource: { db: '', system_buckets: 'exact' } kMatchSystemBucketInAnyDBResource: description: Matches a collection named "system.buckets.<collection>" in any db value: "system_buckets_in_any_db" extra_data: - serverlessActionTypes: *actionsValidOnCollection + serverlessActionTypes: *actionsValidOnSystemBuckets # resource: { db: 'exact', system_buckets: '' } kMatchAnySystemBucketInDBResource: description: Matches any collection with a prefix of "system.buckets." in a specific db value: "any_system_buckets_in_db" extra_data: - serverlessActionTypes: *actionsValidOnCollection + serverlessActionTypes: *actionsValidOnSystemBuckets # resource: { db: '', system_buckets: '' } kMatchAnySystemBucketResource: description: Matches any collection with a prefix of "system.buckets." in any db value: "any_system_buckets" extra_data: - serverlessActionTypes: *actionsValidOnCollection + serverlessActionTypes: *actionsValidOnSystemBuckets structs: MatchTypeExtraData: diff --git a/src/mongo/db/catalog/drop_database.cpp b/src/mongo/db/catalog/drop_database.cpp index dad0b1d9696..bb5e5f80525 100644 --- a/src/mongo/db/catalog/drop_database.cpp +++ b/src/mongo/db/catalog/drop_database.cpp @@ -61,7 +61,7 @@ MONGO_FAIL_POINT_DEFINE(dropDatabaseHangAfterWaitingForIndexBuilds); namespace { -Status _checkNssAndReplState(OperationContext* opCtx, Database* db, const std::string& dbName) { +Status _checkNssAndReplState(OperationContext* opCtx, Database* db, const DatabaseName& dbName) { if (!db) { return Status(ErrorCodes::NamespaceNotFound, str::stream() @@ -69,8 +69,8 @@ Status _checkNssAndReplState(OperationContext* opCtx, Database* db, const std::s } auto replCoord = repl::ReplicationCoordinator::get(opCtx); - bool userInitiatedWritesAndNotPrimary = - opCtx->writesAreReplicated() && !replCoord->canAcceptWritesForDatabase(opCtx, dbName); + bool userInitiatedWritesAndNotPrimary = opCtx->writesAreReplicated() && + !replCoord->canAcceptWritesForDatabase(opCtx, dbName.toStringWithTenantId()); if (userInitiatedWritesAndNotPrimary) { return Status(ErrorCodes::NotWritablePrimary, @@ -88,24 +88,23 @@ Status _checkNssAndReplState(OperationContext* opCtx, Database* db, const std::s * Throws on errors. */ void _finishDropDatabase(OperationContext* opCtx, - const std::string& dbName, + const DatabaseName& dbName, Database* db, std::size_t numCollections, bool abortIndexBuilds) { - // TODO SERVER-67549 Use dbName directly. - invariant(opCtx->lockState()->isDbLockedForMode(DatabaseName(boost::none, dbName), MODE_X)); + invariant(opCtx->lockState()->isDbLockedForMode(dbName, MODE_X)); // If DatabaseHolder::dropDb() fails, we should reset the drop-pending state on Database. ScopeGuard dropPendingGuard([db, opCtx] { db->setDropPending(opCtx, false); }); if (!abortIndexBuilds) { - IndexBuildsCoordinator::get(opCtx)->assertNoBgOpInProgForDb(dbName); + // TODO SERVER-67439 Use dbName directly + IndexBuildsCoordinator::get(opCtx)->assertNoBgOpInProgForDb(dbName.toStringWithTenantId()); } - writeConflictRetry(opCtx, "dropDatabase_database", dbName, [&] { + writeConflictRetry(opCtx, "dropDatabase_database", dbName.toString(), [&] { WriteUnitOfWork wunit(opCtx); - // TODO: SERVER-67549 pass the dbName directly - opCtx->getServiceContext()->getOpObserver()->onDropDatabase(opCtx, DatabaseName(dbName)); + opCtx->getServiceContext()->getOpObserver()->onDropDatabase(opCtx, dbName); wunit.commit(); }); @@ -125,7 +124,7 @@ void _finishDropDatabase(OperationContext* opCtx, "numCollectionsDropped"_attr = numCollections); } -Status _dropDatabase(OperationContext* opCtx, const std::string& dbName, bool abortIndexBuilds) { +Status _dropDatabase(OperationContext* opCtx, const DatabaseName& dbName, bool abortIndexBuilds) { // As this code can potentially require replication we disallow holding locks entirely. Holding // of any locks is disallowed while awaiting replication because this can potentially block for // long time while doing network activity. @@ -144,7 +143,7 @@ Status _dropDatabase(OperationContext* opCtx, const std::string& dbName, bool ab { CurOp::get(opCtx)->ensureStarted(); stdx::lock_guard<Client> lk(*opCtx->getClient()); - CurOp::get(opCtx)->setNS_inlock(dbName); + CurOp::get(opCtx)->setNS_inlock(dbName.toStringWithTenantId()); } auto replCoord = repl::ReplicationCoordinator::get(opCtx); @@ -157,8 +156,7 @@ Status _dropDatabase(OperationContext* opCtx, const std::string& dbName, bool ab { boost::optional<AutoGetDb> autoDB; - // TODO SERVER-67549 Use dbName directly. - autoDB.emplace(opCtx, DatabaseName(boost::none, dbName), MODE_X); + autoDB.emplace(opCtx, dbName, MODE_X); Database* db = autoDB->getDb(); Status status = _checkNssAndReplState(opCtx, db, dbName); @@ -186,14 +184,15 @@ Status _dropDatabase(OperationContext* opCtx, const std::string& dbName, bool ab if (abortIndexBuilds) { // We need to keep aborting all the active index builders for this database until there // are none left when we retrieve the exclusive database lock again. - while (indexBuildsCoord->inProgForDb(dbName)) { + + // TODO SERVER-67439 Change to use dbName directly + while (indexBuildsCoord->inProgForDb(dbName.toStringWithTenantId())) { // Create a scope guard to reset the drop-pending state on the database to false if // there is a replica state change that kills this operation while the locks were // yielded. ScopeGuard dropPendingGuardWhileUnlocked([dbName, opCtx, &dropPendingGuard] { UninterruptibleLockGuard noInterrupt(opCtx->lockState()); - // TODO SERVER-67549 Use dbName directly. - AutoGetDb autoDB(opCtx, DatabaseName(boost::none, dbName), MODE_IX); + AutoGetDb autoDB(opCtx, dbName, MODE_IX); if (auto db = autoDB.getDb()) { db->setDropPending(opCtx, false); } @@ -205,7 +204,9 @@ Status _dropDatabase(OperationContext* opCtx, const std::string& dbName, bool ab // Sends the abort signal to all the active index builders for this database. Waits // for aborted index builds to complete. - indexBuildsCoord->abortDatabaseIndexBuilds(opCtx, dbName, "dropDatabase command"); + // TODO SERVER-67439 Change to use dbName directly + indexBuildsCoord->abortDatabaseIndexBuilds( + opCtx, dbName.toStringWithTenantId(), "dropDatabase command"); if (MONGO_unlikely(dropDatabaseHangAfterWaitingForIndexBuilds.shouldFail())) { LOGV2(4612300, @@ -214,8 +215,7 @@ Status _dropDatabase(OperationContext* opCtx, const std::string& dbName, bool ab dropDatabaseHangAfterWaitingForIndexBuilds.pauseWhileSet(); } - // TODO SERVER-67549 Use dbName directly. - autoDB.emplace(opCtx, DatabaseName(boost::none, dbName), MODE_X); + autoDB.emplace(opCtx, dbName, MODE_X); db = autoDB->getDb(); dropPendingGuardWhileUnlocked.dismiss(); @@ -310,8 +310,8 @@ Status _dropDatabase(OperationContext* opCtx, const std::string& dbName, bool ab // locks (which can throw) needed to finish the drop database. ScopeGuard dropPendingGuardWhileUnlocked([dbName, opCtx] { UninterruptibleLockGuard noInterrupt(opCtx->lockState()); - // TODO SERVER-67549 Use dbName directly. - AutoGetDb autoDB(opCtx, DatabaseName(boost::none, dbName), MODE_IX); + + AutoGetDb autoDB(opCtx, dbName, MODE_IX); if (auto db = autoDB.getDb()) { db->setDropPending(opCtx, false); } @@ -392,8 +392,7 @@ Status _dropDatabase(OperationContext* opCtx, const std::string& dbName, bool ab dropDatabaseHangAfterAllCollectionsDrop.pauseWhileSet(); } - // TODO SERVER-67549 Use dbName directly. - AutoGetDb autoDB(opCtx, DatabaseName(boost::none, dbName), MODE_X); + AutoGetDb autoDB(opCtx, dbName, MODE_X); auto db = autoDB.getDb(); if (!db) { return Status(ErrorCodes::NamespaceNotFound, @@ -402,8 +401,8 @@ Status _dropDatabase(OperationContext* opCtx, const std::string& dbName, bool ab << numCollectionsToDrop << " collection(s)."); } - bool userInitiatedWritesAndNotPrimary = - opCtx->writesAreReplicated() && !replCoord->canAcceptWritesForDatabase(opCtx, dbName); + bool userInitiatedWritesAndNotPrimary = opCtx->writesAreReplicated() && + !replCoord->canAcceptWritesForDatabase(opCtx, dbName.toStringWithTenantId()); if (userInitiatedWritesAndNotPrimary) { return Status(ErrorCodes::PrimarySteppedDown, @@ -424,12 +423,12 @@ Status _dropDatabase(OperationContext* opCtx, const std::string& dbName, bool ab } // namespace -Status dropDatabase(OperationContext* opCtx, const std::string& dbName) { +Status dropDatabase(OperationContext* opCtx, const DatabaseName& dbName) { const bool abortIndexBuilds = true; return _dropDatabase(opCtx, dbName, abortIndexBuilds); } -Status dropDatabaseForApplyOps(OperationContext* opCtx, const std::string& dbName) { +Status dropDatabaseForApplyOps(OperationContext* opCtx, const DatabaseName& dbName) { const bool abortIndexBuilds = false; return _dropDatabase(opCtx, dbName, abortIndexBuilds); } diff --git a/src/mongo/db/catalog/drop_database.h b/src/mongo/db/catalog/drop_database.h index 365a7a61e0a..107f2c5ccf7 100644 --- a/src/mongo/db/catalog/drop_database.h +++ b/src/mongo/db/catalog/drop_database.h @@ -32,16 +32,17 @@ #include "mongo/base/status.h" namespace mongo { +class DatabaseName; class OperationContext; /** * Drops the database "dbName". Aborts in-progress index builds on each collection in the database * if two-phase index builds are enabled. */ -Status dropDatabase(OperationContext* opCtx, const std::string& dbName); +Status dropDatabase(OperationContext* opCtx, const DatabaseName& dbName); /** * Drops the database "dbName". Does not abort in-progress index builds. */ -Status dropDatabaseForApplyOps(OperationContext* opCtx, const std::string& dbName); +Status dropDatabaseForApplyOps(OperationContext* opCtx, const DatabaseName& dbName); } // namespace mongo diff --git a/src/mongo/db/catalog/drop_database_test.cpp b/src/mongo/db/catalog/drop_database_test.cpp index 1f80d7db67c..f08326b507d 100644 --- a/src/mongo/db/catalog/drop_database_test.cpp +++ b/src/mongo/db/catalog/drop_database_test.cpp @@ -75,7 +75,7 @@ public: std::uint64_t numRecords, CollectionDropType dropType) override; - std::set<std::string> droppedDatabaseNames; + std::set<DatabaseName> droppedDatabaseNames; std::set<NamespaceString> droppedCollectionNames; Database* db = nullptr; bool onDropCollectionThrowsException = false; @@ -86,8 +86,7 @@ void OpObserverMock::onDropDatabase(OperationContext* opCtx, const DatabaseName& ASSERT_TRUE(opCtx->lockState()->inAWriteUnitOfWork()); OpObserverNoop::onDropDatabase(opCtx, dbName); // Do not update 'droppedDatabaseNames' if OpObserverNoop::onDropDatabase() throws. - // TODO: SERVER-67549 to change droppedDatabaseNames to use DatabaseName - droppedDatabaseNames.insert(dbName.toStringWithTenantId()); + droppedDatabaseNames.insert(dbName); } repl::OpTime OpObserverMock::onDropCollection(OperationContext* opCtx, @@ -212,7 +211,7 @@ void _removeDatabaseFromCatalog(OperationContext* opCtx, StringData dbName) { TEST_F(DropDatabaseTest, DropDatabaseReturnsNamespaceNotFoundIfDatabaseDoesNotExist) { ASSERT_FALSE(AutoGetDb(_opCtx.get(), _nss.dbName(), MODE_X).getDb()); ASSERT_EQUALS(ErrorCodes::NamespaceNotFound, - dropDatabaseForApplyOps(_opCtx.get(), _nss.db().toString())); + dropDatabaseForApplyOps(_opCtx.get(), _nss.dbName())); } TEST_F(DropDatabaseTest, DropDatabaseReturnsNotWritablePrimaryIfNotPrimary) { @@ -221,7 +220,7 @@ TEST_F(DropDatabaseTest, DropDatabaseReturnsNotWritablePrimaryIfNotPrimary) { ASSERT_TRUE(_opCtx->writesAreReplicated()); ASSERT_FALSE(_replCoord->canAcceptWritesForDatabase(_opCtx.get(), _nss.db())); ASSERT_EQUALS(ErrorCodes::NotWritablePrimary, - dropDatabaseForApplyOps(_opCtx.get(), _nss.db().toString())); + dropDatabaseForApplyOps(_opCtx.get(), _nss.dbName())); } /** @@ -242,12 +241,12 @@ void _testDropDatabase(OperationContext* opCtx, ASSERT_TRUE(db); opObserver->db = db; - ASSERT_OK(dropDatabaseForApplyOps(opCtx, nss.db().toString())); + ASSERT_OK(dropDatabaseForApplyOps(opCtx, nss.dbName())); ASSERT_FALSE(AutoGetDb(opCtx, nss.dbName(), MODE_X).getDb()); opObserver->db = nullptr; ASSERT_EQUALS(1U, opObserver->droppedDatabaseNames.size()); - ASSERT_EQUALS(nss.db().toString(), *(opObserver->droppedDatabaseNames.begin())); + ASSERT_EQUALS(nss.dbName(), *(opObserver->droppedDatabaseNames.begin())); if (expectedOnDropCollection) { ASSERT_EQUALS(1U, opObserver->droppedCollectionNames.size()); @@ -298,7 +297,7 @@ TEST_F(DropDatabaseTest, DropDatabasePassedThroughAwaitReplicationErrorForDropPe _createCollection(_opCtx.get(), dpns); ASSERT_EQUALS(ErrorCodes::WriteConcernFailed, - dropDatabaseForApplyOps(_opCtx.get(), _nss.db().toString())); + dropDatabaseForApplyOps(_opCtx.get(), _nss.dbName())); } TEST_F(DropDatabaseTest, DropDatabaseSkipsSystemProfileCollectionWhenDroppingCollections) { @@ -319,7 +318,7 @@ TEST_F(DropDatabaseTest, DropDatabaseResetsDropPendingStateOnException) { ASSERT_TRUE(db); } - ASSERT_THROWS_CODE_AND_WHAT(dropDatabaseForApplyOps(_opCtx.get(), _nss.db().toString()), + ASSERT_THROWS_CODE_AND_WHAT(dropDatabaseForApplyOps(_opCtx.get(), _nss.dbName()), AssertionException, ErrorCodes::OperationFailed, "onDropCollection() failed"); @@ -338,8 +337,7 @@ void _testDropDatabaseResetsDropPendingStateIfAwaitReplicationFails(OperationCon ASSERT_TRUE(AutoGetDb(opCtx, nss.dbName(), MODE_X).getDb()); - ASSERT_EQUALS(ErrorCodes::WriteConcernFailed, - dropDatabaseForApplyOps(opCtx, nss.db().toString())); + ASSERT_EQUALS(ErrorCodes::WriteConcernFailed, dropDatabaseForApplyOps(opCtx, nss.dbName())); AutoGetDb autoDb(opCtx, nss.dbName(), MODE_X); auto db = autoDb.getDb(); @@ -388,7 +386,7 @@ TEST_F(DropDatabaseTest, ASSERT_TRUE(AutoGetDb(_opCtx.get(), _nss.dbName(), MODE_X).getDb()); - auto status = dropDatabaseForApplyOps(_opCtx.get(), _nss.db().toString()); + auto status = dropDatabaseForApplyOps(_opCtx.get(), _nss.dbName()); ASSERT_EQUALS(ErrorCodes::NamespaceNotFound, status); ASSERT_EQUALS(status.reason(), std::string(str::stream() @@ -413,7 +411,7 @@ TEST_F(DropDatabaseTest, ASSERT_TRUE(AutoGetDb(_opCtx.get(), _nss.dbName(), MODE_X).getDb()); - auto status = dropDatabaseForApplyOps(_opCtx.get(), _nss.db().toString()); + auto status = dropDatabaseForApplyOps(_opCtx.get(), _nss.dbName()); ASSERT_EQUALS(ErrorCodes::PrimarySteppedDown, status); ASSERT_EQUALS(status.reason(), std::string(str::stream() << "Could not drop database " << _nss.db() @@ -430,7 +428,7 @@ TEST_F(DropDatabaseTest, TEST_F(DropDatabaseTest, DropDatabaseFailsToDropAdmin) { NamespaceString adminNSS(NamespaceString::kAdminDb, "foo"); _createCollection(_opCtx.get(), adminNSS); - ASSERT_THROWS_CODE_AND_WHAT(dropDatabaseForApplyOps(_opCtx.get(), adminNSS.db().toString()), + ASSERT_THROWS_CODE_AND_WHAT(dropDatabaseForApplyOps(_opCtx.get(), adminNSS.dbName()), AssertionException, ErrorCodes::IllegalOperation, "Dropping the 'admin' database is prohibited."); diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp index 750a3baac8b..851004bbd28 100644 --- a/src/mongo/db/commands/dbcommands.cpp +++ b/src/mongo/db/commands/dbcommands.cpp @@ -123,6 +123,9 @@ public: bool collectsResourceConsumptionMetrics() const final { return true; } + bool allowedWithSecurityToken() const final { + return true; + } class Invocation final : public InvocationBaseGen { public: using InvocationBaseGen::InvocationBaseGen; @@ -161,8 +164,7 @@ public: uasserted(5255100, "Have to pass 1 as 'drop' parameter"); } - // TODO SERVER-67549: pass the DatabaseName object directly. - Status status = dropDatabase(opCtx, dbName.toStringWithTenantId()); + Status status = dropDatabase(opCtx, dbName); if (status != ErrorCodes::NamespaceNotFound) { uassertStatusOK(status); } diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp index ec7408bfcd7..5b9d47ffcf0 100644 --- a/src/mongo/db/repl/oplog.cpp +++ b/src/mongo/db/repl/oplog.cpp @@ -991,7 +991,7 @@ const StringMap<ApplyOpMetadata> kOpsMap = { {"dbCheck", {dbCheckOplogCommand, {}}}, {"dropDatabase", {[](OperationContext* opCtx, const OplogEntry& entry, OplogApplication::Mode mode) -> Status { - return dropDatabaseForApplyOps(opCtx, entry.getNss().db().toString()); + return dropDatabaseForApplyOps(opCtx, entry.getNss().dbName()); }, {ErrorCodes::NamespaceNotFound}}}, {"drop", diff --git a/src/mongo/db/repl/storage_timestamp_test.cpp b/src/mongo/db/repl/storage_timestamp_test.cpp index 50a4f0ac7d3..d0fa308e2a6 100644 --- a/src/mongo/db/repl/storage_timestamp_test.cpp +++ b/src/mongo/db/repl/storage_timestamp_test.cpp @@ -1936,11 +1936,11 @@ public: const Timestamp dropTime = _clock->tickClusterTime(1).asTimestamp(); if (simulatePrimary) { - ASSERT_OK(dropDatabaseForApplyOps(_opCtx, nss.db().toString())); + ASSERT_OK(dropDatabaseForApplyOps(_opCtx, nss.dbName())); } else { repl::UnreplicatedWritesBlock uwb(_opCtx); TimestampBlock ts(_opCtx, dropTime); - ASSERT_OK(dropDatabaseForApplyOps(_opCtx, nss.db().toString())); + ASSERT_OK(dropDatabaseForApplyOps(_opCtx, nss.dbName())); } // Assert that the idents do not exist. diff --git a/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.cpp b/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.cpp index c98f6352322..67e89ec8188 100644 --- a/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.cpp +++ b/src/mongo/db/s/resharding/resharding_donor_recipient_common_test.cpp @@ -568,7 +568,7 @@ TEST_F(ReshardingDonorRecipientCommonInternalsTest, ClearReshardingFilteringMeta // Clear out the resharding donor/recipient metadata collections. for (auto const& nss : {NamespaceString::kDonorReshardingOperationsNamespace, NamespaceString::kRecipientReshardingOperationsNamespace}) { - dropDatabase(opCtx, nss.db().toString()).ignore(); + dropDatabase(opCtx, nss.dbName()).ignore(); } // Assert the prestate has no filtering metadata. diff --git a/src/mongo/db/s/shardsvr_drop_database_participant_command.cpp b/src/mongo/db/s/shardsvr_drop_database_participant_command.cpp index d115c8104ca..21e6d505288 100644 --- a/src/mongo/db/s/shardsvr_drop_database_participant_command.cpp +++ b/src/mongo/db/s/shardsvr_drop_database_participant_command.cpp @@ -76,7 +76,7 @@ public: const auto& dbName = request().getDbName(); try { - uassertStatusOK(dropDatabase(opCtx, dbName.toString())); + uassertStatusOK(dropDatabase(opCtx, dbName)); } catch (const ExceptionFor<ErrorCodes::NamespaceNotFound>&) { LOGV2_DEBUG(5281101, 1, |