From b07f96535de47c2da6700074e79ce0ee6eb1ae21 Mon Sep 17 00:00:00 2001 From: Kaloian Manassiev Date: Fri, 9 Dec 2016 17:19:48 -0500 Subject: SERVER-27381 Remove DBConfig::dropDatabase --- src/mongo/db/commands/dbcommands.cpp | 5 +++-- src/mongo/db/namespace_string.cpp | 1 + src/mongo/db/namespace_string.h | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/mongo/db') diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp index 5eea6f7e39f..31d621c788c 100644 --- a/src/mongo/db/commands/dbcommands.cpp +++ b/src/mongo/db/commands/dbcommands.cpp @@ -188,7 +188,8 @@ public: string& errmsg, BSONObjBuilder& result) { // disallow dropping the config database - if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer && (dbname == "config")) { + if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer && + (dbname == NamespaceString::kConfigDb)) { return appendCommandStatus(result, Status(ErrorCodes::IllegalOperation, "Cannot drop 'config' database if mongod started " @@ -197,7 +198,7 @@ public: if ((repl::getGlobalReplicationCoordinator()->getReplicationMode() != repl::ReplicationCoordinator::modeNone) && - (dbname == "local")) { + (dbname == NamespaceString::kLocalDb)) { return appendCommandStatus(result, Status(ErrorCodes::IllegalOperation, "Cannot drop 'local' database while replication " diff --git a/src/mongo/db/namespace_string.cpp b/src/mongo/db/namespace_string.cpp index 9779bdd4139..6ee4d989ceb 100644 --- a/src/mongo/db/namespace_string.cpp +++ b/src/mongo/db/namespace_string.cpp @@ -104,6 +104,7 @@ bool legalClientSystemNS(StringData ns) { constexpr StringData NamespaceString::kAdminDb; constexpr StringData NamespaceString::kLocalDb; +constexpr StringData NamespaceString::kConfigDb; constexpr StringData NamespaceString::kSystemDotViewsCollectionName; const NamespaceString NamespaceString::kConfigCollectionNamespace(kConfigCollection); diff --git a/src/mongo/db/namespace_string.h b/src/mongo/db/namespace_string.h index 8bac89fb362..220c188203c 100644 --- a/src/mongo/db/namespace_string.h +++ b/src/mongo/db/namespace_string.h @@ -63,6 +63,9 @@ public: // Namespace for the local database static constexpr StringData kLocalDb = "local"_sd; + // Namespace for the sharding config database + static constexpr StringData kConfigDb = "config"_sd; + // Name for the system views collection static constexpr StringData kSystemDotViewsCollectionName = "system.views"_sd; -- cgit v1.2.1