diff options
Diffstat (limited to 'src/mongo')
21 files changed, 23 insertions, 23 deletions
diff --git a/src/mongo/base/error_codes.err b/src/mongo/base/error_codes.err index fa815ef907c..f0e0386de39 100644 --- a/src/mongo/base/error_codes.err +++ b/src/mongo/base/error_codes.err @@ -59,7 +59,7 @@ error_code("EmptyFieldName", 56) error_code("DottedFieldName", 57) error_code("RoleModificationFailed", 58) error_code("CommandNotFound", 59) -error_code("DatabaseNotFound", 60) +error_code("OBSOLETE_DatabaseNotFound", 60) error_code("ShardKeyNotFound", 61) error_code("OplogOperationUnsupported", 62) error_code("StaleShardVersion", 63) diff --git a/src/mongo/client/parallel.cpp b/src/mongo/client/parallel.cpp index a4c53e2173b..7977bd45250 100644 --- a/src/mongo/client/parallel.cpp +++ b/src/mongo/client/parallel.cpp @@ -615,7 +615,7 @@ void ParallelSortClusteredCursor::startInit(OperationContext* txn) { shared_ptr<DBConfig> config; auto status = grid.catalogCache()->getDatabase(txn, nss.db().toString()); - if (status.getStatus().code() != ErrorCodes::DatabaseNotFound) { + if (status.getStatus().code() != ErrorCodes::NamespaceNotFound) { config = uassertStatusOK(status); config->getChunkManagerOrPrimary(txn, nss.ns(), manager, primary); } diff --git a/src/mongo/db/catalog/capped_utils.cpp b/src/mongo/db/catalog/capped_utils.cpp index 16ac044597d..4b1e983ecd5 100644 --- a/src/mongo/db/catalog/capped_utils.cpp +++ b/src/mongo/db/catalog/capped_utils.cpp @@ -222,7 +222,7 @@ Status convertToCapped(OperationContext* txn, const NamespaceString& collectionN Database* const db = autoDb.getDb(); if (!db) { - return Status(ErrorCodes::DatabaseNotFound, + return Status(ErrorCodes::NamespaceNotFound, str::stream() << "database " << dbname << " not found"); } diff --git a/src/mongo/db/catalog/drop_database.cpp b/src/mongo/db/catalog/drop_database.cpp index 7996c7c2eee..f45d2596ebe 100644 --- a/src/mongo/db/catalog/drop_database.cpp +++ b/src/mongo/db/catalog/drop_database.cpp @@ -55,7 +55,7 @@ Status dropDatabase(OperationContext* txn, const std::string& dbName) { AutoGetDb autoDB(txn, dbName, MODE_X); Database* const db = autoDB.getDb(); if (!db) { - return Status(ErrorCodes::DatabaseNotFound, + return Status(ErrorCodes::NamespaceNotFound, str::stream() << "Could not drop database " << dbName << " because it does not exist"); } diff --git a/src/mongo/db/commands/collection_to_capped.cpp b/src/mongo/db/commands/collection_to_capped.cpp index 4f53833e975..f73d20a59e1 100644 --- a/src/mongo/db/commands/collection_to_capped.cpp +++ b/src/mongo/db/commands/collection_to_capped.cpp @@ -112,7 +112,7 @@ public: if (!db) { return appendCommandStatus( result, - Status(ErrorCodes::DatabaseNotFound, + Status(ErrorCodes::NamespaceNotFound, str::stream() << "database " << dbname << " not found")); } diff --git a/src/mongo/db/commands/find_and_modify.cpp b/src/mongo/db/commands/find_and_modify.cpp index fb80965bb36..3cac8506cd8 100644 --- a/src/mongo/db/commands/find_and_modify.cpp +++ b/src/mongo/db/commands/find_and_modify.cpp @@ -268,7 +268,7 @@ public: if (autoDb.getDb()) { collection = autoDb.getDb()->getCollection(nsString.ns()); } else { - return {ErrorCodes::DatabaseNotFound, + return {ErrorCodes::NamespaceNotFound, str::stream() << "database " << dbName << " does not exist."}; } @@ -304,7 +304,7 @@ public: if (autoDb.getDb()) { collection = autoDb.getDb()->getCollection(nsString.ns()); } else { - return {ErrorCodes::DatabaseNotFound, + return {ErrorCodes::NamespaceNotFound, str::stream() << "database " << dbName << " does not exist."}; } diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp index ec76fd44037..1e9d86e0106 100644 --- a/src/mongo/db/dbcommands.cpp +++ b/src/mongo/db/dbcommands.cpp @@ -213,7 +213,7 @@ public: } Status status = dropDatabase(txn, dbname); - if (status == ErrorCodes::DatabaseNotFound) { + if (status == ErrorCodes::NamespaceNotFound) { return appendCommandStatus(result, Status::OK()); } if (status.isOK()) { diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp index 4ea0f3275db..e9844d18c97 100644 --- a/src/mongo/db/repl/oplog.cpp +++ b/src/mongo/db/repl/oplog.cpp @@ -518,7 +518,7 @@ std::map<std::string, ApplyOpMetadata> opsMap = { {"dropDatabase", {[](OperationContext* txn, const char* ns, BSONObj& cmd) -> Status { return dropDatabase(txn, NamespaceString(ns).db().toString()); }, - {ErrorCodes::DatabaseNotFound}}}, + {ErrorCodes::NamespaceNotFound}}}, {"drop", {[](OperationContext* txn, const char* ns, BSONObj& cmd) -> Status { BSONObjBuilder resultWeDontCareAbout; diff --git a/src/mongo/s/catalog/catalog_manager.h b/src/mongo/s/catalog/catalog_manager.h index 66025e65c5a..280b1c74d0e 100644 --- a/src/mongo/s/catalog/catalog_manager.h +++ b/src/mongo/s/catalog/catalog_manager.h @@ -188,7 +188,7 @@ public: * Returns Status::OK along with the database information and the OpTime of the config server * which the database information was based upon. Otherwise, returns an error code indicating * the failure. These are some of the known failures: - * - DatabaseNotFound - database does not exist + * - NamespaceNotFound - database does not exist */ virtual StatusWith<OpTimePair<DatabaseType>> getDatabase(OperationContext* txn, const std::string& dbName) = 0; diff --git a/src/mongo/s/catalog/catalog_manager_common.cpp b/src/mongo/s/catalog/catalog_manager_common.cpp index 476a9fd3cab..6d9e19d69c6 100644 --- a/src/mongo/s/catalog/catalog_manager_common.cpp +++ b/src/mongo/s/catalog/catalog_manager_common.cpp @@ -328,7 +328,7 @@ StatusWith<string> CatalogManagerCommon::addShard(OperationContext* txn, << "'" << shardConnectionString.toString() << "'" << " because a local database '" << dbName << "' exists in another " << dbDoc.getPrimary()); - } else if (dbt != ErrorCodes::DatabaseNotFound) { + } else if (dbt != ErrorCodes::NamespaceNotFound) { return dbt.getStatus(); } } diff --git a/src/mongo/s/catalog/legacy/catalog_manager_legacy.cpp b/src/mongo/s/catalog/legacy/catalog_manager_legacy.cpp index db4a52eb4fb..26e39e9306b 100644 --- a/src/mongo/s/catalog/legacy/catalog_manager_legacy.cpp +++ b/src/mongo/s/catalog/legacy/catalog_manager_legacy.cpp @@ -470,7 +470,7 @@ StatusWith<OpTimePair<DatabaseType>> CatalogManagerLegacy::getDatabase(Operation BSONObj dbObj = conn->findOne(DatabaseType::ConfigNS, BSON(DatabaseType::name(dbName))); if (dbObj.isEmpty()) { conn.done(); - return {ErrorCodes::DatabaseNotFound, stream() << "database " << dbName << " not found"}; + return {ErrorCodes::NamespaceNotFound, stream() << "database " << dbName << " not found"}; } conn.done(); diff --git a/src/mongo/s/catalog/replset/catalog_manager_replica_set.cpp b/src/mongo/s/catalog/replset/catalog_manager_replica_set.cpp index 6cf9c43029e..c20b7075b14 100644 --- a/src/mongo/s/catalog/replset/catalog_manager_replica_set.cpp +++ b/src/mongo/s/catalog/replset/catalog_manager_replica_set.cpp @@ -373,7 +373,7 @@ StatusWith<OpTimePair<DatabaseType>> CatalogManagerReplicaSet::getDatabase( const auto& docsWithOpTime = findStatus.getValue(); if (docsWithOpTime.value.empty()) { - return {ErrorCodes::DatabaseNotFound, stream() << "database " << dbName << " not found"}; + return {ErrorCodes::NamespaceNotFound, stream() << "database " << dbName << " not found"}; } invariant(docsWithOpTime.value.size() == 1); diff --git a/src/mongo/s/catalog/replset/catalog_manager_replica_set_test.cpp b/src/mongo/s/catalog/replset/catalog_manager_replica_set_test.cpp index 805bc5fa737..10ea91108bf 100644 --- a/src/mongo/s/catalog/replset/catalog_manager_replica_set_test.cpp +++ b/src/mongo/s/catalog/replset/catalog_manager_replica_set_test.cpp @@ -181,7 +181,7 @@ TEST_F(CatalogManagerReplSetTest, GetDatabaseNotExisting) { auto future = launchAsync([this] { auto dbResult = catalogManager()->getDatabase(operationContext(), "NonExistent"); - ASSERT_EQ(dbResult.getStatus(), ErrorCodes::DatabaseNotFound); + ASSERT_EQ(dbResult.getStatus(), ErrorCodes::NamespaceNotFound); }); onFindCommand([](const RemoteCommandRequest& request) { return vector<BSONObj>{}; }); diff --git a/src/mongo/s/chunk_manager_targeter.h b/src/mongo/s/chunk_manager_targeter.h index e38b9b1742f..854ca37ac3a 100644 --- a/src/mongo/s/chunk_manager_targeter.h +++ b/src/mongo/s/chunk_manager_targeter.h @@ -48,8 +48,8 @@ struct TargeterStats { }; /** - * NSTargeter based on a ChunkManager implementation. Wraps all exception codepaths and - * returns DatabaseNotFound statuses on applicable failures. + * NSTargeter based on a ChunkManager implementation. Wraps all exception codepaths and returns + * NamespaceNotFound status on applicable failures. * * Must be initialized before use, and initialization may fail. */ diff --git a/src/mongo/s/commands/cluster_commands_common.cpp b/src/mongo/s/commands/cluster_commands_common.cpp index 6600a400aa6..576086fcd1d 100644 --- a/src/mongo/s/commands/cluster_commands_common.cpp +++ b/src/mongo/s/commands/cluster_commands_common.cpp @@ -203,7 +203,7 @@ int getUniqueCodeFromCommandResults(const std::vector<Strategy::CommandResult>& bool appendEmptyResultSet(BSONObjBuilder& result, Status status, const std::string& ns) { invariant(!status.isOK()); - if (status == ErrorCodes::DatabaseNotFound) { + if (status == ErrorCodes::NamespaceNotFound) { // Old style reply result << "result" << BSONArray(); diff --git a/src/mongo/s/commands/cluster_drop_database_cmd.cpp b/src/mongo/s/commands/cluster_drop_database_cmd.cpp index e913c5f8a7e..d9523db3ed2 100644 --- a/src/mongo/s/commands/cluster_drop_database_cmd.cpp +++ b/src/mongo/s/commands/cluster_drop_database_cmd.cpp @@ -92,7 +92,7 @@ public: auto status = grid.catalogCache()->getDatabase(txn, dbname); if (!status.isOK()) { - if (status == ErrorCodes::DatabaseNotFound) { + if (status == ErrorCodes::NamespaceNotFound) { result.append("info", "database does not exist"); return true; } diff --git a/src/mongo/s/commands/commands_public.cpp b/src/mongo/s/commands/commands_public.cpp index 153fdf896d8..3f3c55806b0 100644 --- a/src/mongo/s/commands/commands_public.cpp +++ b/src/mongo/s/commands/commands_public.cpp @@ -480,7 +480,7 @@ public: BSONObjBuilder& result) { auto status = grid.catalogCache()->getDatabase(txn, dbName); if (!status.isOK()) { - if (status == ErrorCodes::DatabaseNotFound) { + if (status == ErrorCodes::NamespaceNotFound) { return true; } diff --git a/src/mongo/s/config.cpp b/src/mongo/s/config.cpp index 74c89bf8e2d..dc2cbf46205 100644 --- a/src/mongo/s/config.cpp +++ b/src/mongo/s/config.cpp @@ -448,7 +448,7 @@ bool DBConfig::load(OperationContext* txn) { bool DBConfig::_load(OperationContext* txn) { auto status = grid.catalogManager(txn)->getDatabase(txn, _name); - if (status == ErrorCodes::DatabaseNotFound) { + if (status == ErrorCodes::NamespaceNotFound) { return false; } diff --git a/src/mongo/s/grid.cpp b/src/mongo/s/grid.cpp index f816fe49c66..67e95aaf6e8 100644 --- a/src/mongo/s/grid.cpp +++ b/src/mongo/s/grid.cpp @@ -67,7 +67,7 @@ StatusWith<std::shared_ptr<DBConfig>> Grid::implicitCreateDb(OperationContext* t return status; } - if (status == ErrorCodes::DatabaseNotFound) { + if (status == ErrorCodes::NamespaceNotFound) { auto statusCreateDb = catalogManager(txn)->createDatabase(txn, dbName); if (statusCreateDb.isOK() || statusCreateDb == ErrorCodes::NamespaceExists) { return catalogCache()->getDatabase(txn, dbName); diff --git a/src/mongo/s/query/cluster_find.cpp b/src/mongo/s/query/cluster_find.cpp index ed038f5514a..7bb07c2bf8c 100644 --- a/src/mongo/s/query/cluster_find.cpp +++ b/src/mongo/s/query/cluster_find.cpp @@ -346,7 +346,7 @@ StatusWith<CursorId> ClusterFind::runQuery(OperationContext* txn, } auto dbConfig = grid.catalogCache()->getDatabase(txn, query.nss().db().toString()); - if (dbConfig.getStatus() == ErrorCodes::DatabaseNotFound) { + if (dbConfig.getStatus() == ErrorCodes::NamespaceNotFound) { // If the database doesn't exist, we successfully return an empty result set without // creating a cursor. return CursorId(0); diff --git a/src/mongo/s/strategy.cpp b/src/mongo/s/strategy.cpp index 88b3dd35f64..e1fdc814e36 100644 --- a/src/mongo/s/strategy.cpp +++ b/src/mongo/s/strategy.cpp @@ -559,7 +559,7 @@ void Strategy::getMore(OperationContext* txn, Request& request) { // for now has same semantics as legacy request const NamespaceString nss(ns); auto statusGetDb = grid.catalogCache()->getDatabase(txn, nss.db().toString()); - if (statusGetDb == ErrorCodes::DatabaseNotFound) { + if (statusGetDb == ErrorCodes::NamespaceNotFound) { cursorCache.remove(id); replyToQuery(ResultFlag_CursorNotFound, request.p(), request.m(), 0, 0, 0); return; |