diff options
21 files changed, 20 insertions, 85 deletions
diff --git a/buildscripts/resmokeconfig/suites/replica_sets_kill_primary_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/replica_sets_kill_primary_jscore_passthrough.yml index 574f31915e4..6865443484a 100644 --- a/buildscripts/resmokeconfig/suites/replica_sets_kill_primary_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/replica_sets_kill_primary_jscore_passthrough.yml @@ -30,7 +30,6 @@ selector: - jstests/core/killop_drop_collection.js # Expect drops/creates to fail or have a certain response: - - jstests/core/dropdb.js - jstests/core/explain_upsert.js - jstests/core/indexes_multiple_commands.js diff --git a/buildscripts/resmokeconfig/suites/replica_sets_reconfig_jscore_stepdown_passthrough.yml b/buildscripts/resmokeconfig/suites/replica_sets_reconfig_jscore_stepdown_passthrough.yml index bfcbb934df1..60e8df659c3 100644 --- a/buildscripts/resmokeconfig/suites/replica_sets_reconfig_jscore_stepdown_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/replica_sets_reconfig_jscore_stepdown_passthrough.yml @@ -47,7 +47,6 @@ selector: - jstests/core/shell_connection_strings.js # Expect drops/creates to fail or have a certain response: - - jstests/core/dropdb.js - jstests/core/explain_upsert.js - jstests/core/indexes_multiple_commands.js diff --git a/buildscripts/resmokeconfig/suites/replica_sets_reconfig_kill_primary_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/replica_sets_reconfig_kill_primary_jscore_passthrough.yml index e195a2359dc..990b5da3df9 100644 --- a/buildscripts/resmokeconfig/suites/replica_sets_reconfig_kill_primary_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/replica_sets_reconfig_kill_primary_jscore_passthrough.yml @@ -48,7 +48,6 @@ selector: - jstests/core/shell_connection_strings.js # Expect drops/creates to fail or have a certain response: - - jstests/core/dropdb.js - jstests/core/explain_upsert.js - jstests/core/indexes_multiple_commands.js diff --git a/buildscripts/resmokeconfig/suites/replica_sets_terminate_primary_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/replica_sets_terminate_primary_jscore_passthrough.yml index 67946981309..dd6d85d1b66 100644 --- a/buildscripts/resmokeconfig/suites/replica_sets_terminate_primary_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/replica_sets_terminate_primary_jscore_passthrough.yml @@ -30,7 +30,6 @@ selector: - jstests/core/killop_drop_collection.js # Expect drops/creates to fail or have a certain response: - - jstests/core/dropdb.js - jstests/core/explain_upsert.js - jstests/core/indexes_multiple_commands.js diff --git a/buildscripts/resmokeconfig/suites/retryable_writes_jscore_stepdown_passthrough.yml b/buildscripts/resmokeconfig/suites/retryable_writes_jscore_stepdown_passthrough.yml index 6db9f83f025..5d218b3f65a 100644 --- a/buildscripts/resmokeconfig/suites/retryable_writes_jscore_stepdown_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/retryable_writes_jscore_stepdown_passthrough.yml @@ -31,7 +31,6 @@ selector: - jstests/core/killop_drop_collection.js # Expect drops/creates to fail or have a certain response: - - jstests/core/dropdb.js - jstests/core/explain_upsert.js - jstests/core/indexes_multiple_commands.js diff --git a/jstests/concurrency/fsm_libs/runner.js b/jstests/concurrency/fsm_libs/runner.js index 94b99530f9e..e8bbf4424dd 100644 --- a/jstests/concurrency/fsm_libs/runner.js +++ b/jstests/concurrency/fsm_libs/runner.js @@ -251,9 +251,7 @@ var runner = (function() { res.databases.forEach(function(dbInfo) { if (!Array.contains(blacklist, dbInfo.name)) { - var res = db.getSiblingDB(dbInfo.name).dropDatabase(); - assert.commandWorked(res); - assert.eq(dbInfo.name, res.dropped); + assert.commandWorked(db.getSiblingDB(dbInfo.name).dropDatabase()); } }); } diff --git a/jstests/concurrency/fsm_workload_helpers/drop_utils.js b/jstests/concurrency/fsm_workload_helpers/drop_utils.js index 21f9c5548cd..9d62df9c4a1 100644 --- a/jstests/concurrency/fsm_workload_helpers/drop_utils.js +++ b/jstests/concurrency/fsm_workload_helpers/drop_utils.js @@ -27,7 +27,6 @@ function dropDatabases(db, pattern) { if (pattern.test(dbInfo.name)) { var res = db.getSiblingDB(dbInfo.name).dropDatabase(); assertAlways.commandWorked(res); - assertAlways.eq(dbInfo.name, res.dropped); } }); } diff --git a/jstests/concurrency/fsm_workloads/drop_database.js b/jstests/concurrency/fsm_workloads/drop_database.js index 8a13461bb09..247496e05df 100644 --- a/jstests/concurrency/fsm_workloads/drop_database.js +++ b/jstests/concurrency/fsm_workloads/drop_database.js @@ -17,9 +17,7 @@ var $config = (function() { var myDB = db.getSiblingDB(this.uniqueDBName); assertAlways.commandWorked(myDB.createCollection(collName)); - var res = myDB.dropDatabase(); - assertAlways.commandWorked(res); - assertAlways.eq(this.uniqueDBName, res.dropped); + assertAlways.commandWorked(myDB.dropDatabase()); } }; diff --git a/jstests/concurrency/fsm_workloads/findAndModify_remove_queue.js b/jstests/concurrency/fsm_workloads/findAndModify_remove_queue.js index e902ceb1959..1d35f40a312 100644 --- a/jstests/concurrency/fsm_workloads/findAndModify_remove_queue.js +++ b/jstests/concurrency/fsm_workloads/findAndModify_remove_queue.js @@ -127,9 +127,7 @@ var $config = (function() { checkForDuplicateIds(ids, this.opName); }); - var res = ownedDB.dropDatabase(); - assertAlways.commandWorked(res); - assertAlways.eq(db.getName() + this.uniqueDBName, res.dropped); + assertAlways.commandWorked(ownedDB.dropDatabase()); function checkForDuplicateIds(ids, opName) { var indices = new Array(ids.length); diff --git a/jstests/concurrency/fsm_workloads/rename_capped_collection_dbname_chain.js b/jstests/concurrency/fsm_workloads/rename_capped_collection_dbname_chain.js index 76bdd80f5a3..37f80dd4d5e 100644 --- a/jstests/concurrency/fsm_workloads/rename_capped_collection_dbname_chain.js +++ b/jstests/concurrency/fsm_workloads/rename_capped_collection_dbname_chain.js @@ -46,9 +46,7 @@ var $config = (function() { // Remove any files associated with the "from" namespace // to avoid having too many files open - var res = db.getSiblingDB(this.fromDBName).dropDatabase(); - assertAlways.commandWorked(res); - assertAlways.eq(this.fromDBName, res.dropped); + assertAlways.commandWorked(db.getSiblingDB(this.fromDBName).dropDatabase()); this.fromDBName = toDBName; } diff --git a/jstests/concurrency/fsm_workloads/rename_collection_dbname_chain.js b/jstests/concurrency/fsm_workloads/rename_collection_dbname_chain.js index b933d24e4d0..b4590248622 100644 --- a/jstests/concurrency/fsm_workloads/rename_collection_dbname_chain.js +++ b/jstests/concurrency/fsm_workloads/rename_collection_dbname_chain.js @@ -39,9 +39,7 @@ var $config = (function() { // Remove any files associated with the "from" namespace // to avoid having too many files open - var res = db.getSiblingDB(this.fromDBName).dropDatabase(); - assertAlways.commandWorked(res); - assertAlways.eq(this.fromDBName, res.dropped); + assertAlways.commandWorked(db.getSiblingDB(this.fromDBName).dropDatabase()); this.fromDBName = toDBName; } diff --git a/jstests/core/dropdb.js b/jstests/core/dropdb.js index 2b828eb8dfc..3f3882cd3c2 100644 --- a/jstests/core/dropdb.js +++ b/jstests/core/dropdb.js @@ -1,7 +1,6 @@ // Test that a db does not exist after it is dropped. // Disabled in the small oplog suite because the secondary may create a primary db // with the same name as the dropped db when requesting a clone. -// @tags: [requires_fcv_49] m = db.getMongo(); baseName = "jstests_dropdb"; @@ -20,15 +19,8 @@ function check(shouldExist) { ddb.c.save({}); check(true); -var res = ddb.dropDatabase(); -assert.commandWorked(res); -assert.eq(res.dropped, baseName, "dropped field did not contain correct database name"); +assert.commandWorked(ddb.dropDatabase()); check(false); -var res = ddb.dropDatabase(); -assert.commandWorked(res); -assert.eq(res.dropped, - undefined, - "dropped field was populated even though nothing should have been dropped"); -assert.eq('database does not exist', res.info); +assert.commandWorked(ddb.dropDatabase()); check(false); diff --git a/jstests/sharding/drop_database.js b/jstests/sharding/drop_database.js index a7d914e576d..15c85098d22 100644 --- a/jstests/sharding/drop_database.js +++ b/jstests/sharding/drop_database.js @@ -66,7 +66,6 @@ jsTest.log("Test dropping unexistent database"); // Dropping a database that doesn't exist will result in an info field in the response. const res = assert.commandWorked(db.dropDatabase()); assertDatabaseDropped(db.getName()); - assert.eq('database does not exist', res.info); } jsTest.log("Test dropping unsharded database"); diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp index b6c1790794f..299ebc197c5 100644 --- a/src/mongo/db/commands/dbcommands.cpp +++ b/src/mongo/db/commands/dbcommands.cpp @@ -208,15 +208,10 @@ public: } Status status = dropDatabase(opCtx, dbName.toString()); - DropDatabaseReply reply; - if (status == ErrorCodes::NamespaceNotFound) { - reply.setInfo("database does not exist"_sd); - } else { + if (status != ErrorCodes::NamespaceNotFound) { uassertStatusOK(status); - reply.setDropped(request().getDbName()); } - - return reply; + return {}; } }; } cmdDropDatabase; diff --git a/src/mongo/db/drop_database.idl b/src/mongo/db/drop_database.idl index 65871ce89f8..5083a0d8559 100644 --- a/src/mongo/db/drop_database.idl +++ b/src/mongo/db/drop_database.idl @@ -32,20 +32,6 @@ global: imports: - "mongo/idl/basic_types.idl" -structs: - DropDatabaseReply: - description: "The dropDatabase command's reply" - strict: false - fields: - dropped: - description: "The database's name, if it existed and was dropped" - type: string - optional: true - info: - description: "May provide information on dropDatabase's outcome" - type: string - optional: true - commands: dropDatabase: description: "Parser for the dropDatabase command" @@ -55,4 +41,4 @@ commands: cpp_name: DropDatabase strict: true api_version: "1" - reply_type: DropDatabaseReply + reply_type: OkReply diff --git a/src/mongo/db/s/config/configsvr_drop_database_command.cpp b/src/mongo/db/s/config/configsvr_drop_database_command.cpp index de258fab32d..f725a778f68 100644 --- a/src/mongo/db/s/config/configsvr_drop_database_command.cpp +++ b/src/mongo/db/s/config/configsvr_drop_database_command.cpp @@ -113,11 +113,8 @@ public: << cmdObj, opCtx->getWriteConcern().wMode == WriteConcernOptions::kMajority); - auto reply = dropDatabaseLegacy(opCtx, dbname); - if (!reply.getDropped()) { - repl::ReplClientInfo::forClient(opCtx->getClient()).setLastOpToSystemLastOpTime(opCtx); - } - reply.serialize(&result); + dropDatabaseLegacy(opCtx, dbname); + repl::ReplClientInfo::forClient(opCtx->getClient()).setLastOpToSystemLastOpTime(opCtx); return true; } } configsvrDropDatabaseCmd; diff --git a/src/mongo/db/s/drop_database_legacy.cpp b/src/mongo/db/s/drop_database_legacy.cpp index cd257699ce8..ffab770a1aa 100644 --- a/src/mongo/db/s/drop_database_legacy.cpp +++ b/src/mongo/db/s/drop_database_legacy.cpp @@ -64,7 +64,7 @@ void dropDatabaseFromShard(OperationContext* opCtx, const ShardId& shardId, Stri } // namespace -DropDatabaseReply dropDatabaseLegacy(OperationContext* opCtx, StringData dbName) { +void dropDatabaseLegacy(OperationContext* opCtx, StringData dbName) { auto dbDistLock = uassertStatusOK(DistLockManager::get(opCtx)->lock( opCtx, dbName, "dropDatabase", DistLockManager::kDefaultLockTimeout)); @@ -77,9 +77,7 @@ DropDatabaseReply dropDatabaseLegacy(OperationContext* opCtx, StringData dbName) dbType = catalogClient->getDatabase(opCtx, dbName, repl::ReadConcernLevel::kMajorityReadConcern); } catch (const ExceptionFor<ErrorCodes::NamespaceNotFound>&) { - DropDatabaseReply reply; - reply.setInfo("database does not exist"_sd); - return reply; + return; } uassertStatusOK(ShardingLogging::get(opCtx)->logChangeChecked( @@ -131,10 +129,6 @@ DropDatabaseReply dropDatabaseLegacy(OperationContext* opCtx, StringData dbName) ShardingLogging::get(opCtx)->logChange( opCtx, "dropDatabase", dbName, BSONObj(), ShardingCatalogClient::kMajorityWriteConcern); - - DropDatabaseReply reply; - reply.setDropped(dbName); - return reply; } } // namespace mongo diff --git a/src/mongo/db/s/drop_database_legacy.h b/src/mongo/db/s/drop_database_legacy.h index f03f06c688d..78f0b4d0751 100644 --- a/src/mongo/db/s/drop_database_legacy.h +++ b/src/mongo/db/s/drop_database_legacy.h @@ -35,6 +35,6 @@ namespace mongo { -DropDatabaseReply dropDatabaseLegacy(OperationContext* opCtx, StringData dbName); +void dropDatabaseLegacy(OperationContext* opCtx, StringData dbName); } // namespace mongo diff --git a/src/mongo/db/s/shardsvr_drop_database_command.cpp b/src/mongo/db/s/shardsvr_drop_database_command.cpp index 617ec9a3eb3..3a4088d01e8 100644 --- a/src/mongo/db/s/shardsvr_drop_database_command.cpp +++ b/src/mongo/db/s/shardsvr_drop_database_command.cpp @@ -49,7 +49,6 @@ namespace { class ShardsvrDropDatabaseCommand final : public TypedCommand<ShardsvrDropDatabaseCommand> { public: using Request = ShardsvrDropDatabase; - using Response = DropDatabaseReply; std::string help() const override { return "Internal command, which is exported by the primary sharding server. Do not call " @@ -68,7 +67,7 @@ public: public: using InvocationBase::InvocationBase; - Response typedRun(OperationContext* opCtx) { + void typedRun(OperationContext* opCtx) { uassertStatusOK(ShardingState::get(opCtx)->canAcceptShardedCommands()); uassert(ErrorCodes::InvalidOptions, @@ -89,7 +88,8 @@ public: if (!useNewPath) { LOGV2_DEBUG( 5281110, 1, "Running legacy drop database procedure", "database"_attr = dbName); - return dropDatabaseLegacy(opCtx, dbName); + dropDatabaseLegacy(opCtx, dbName); + return; } LOGV2_DEBUG( @@ -102,9 +102,6 @@ public: auto dropDatabaseCoordinator = std::make_shared<DropDatabaseCoordinator>(opCtx, dbName); dropDatabaseCoordinator->run(opCtx).get(); - - // The following response can be omitted once 5.0 became last LTS - return Response(); } private: diff --git a/src/mongo/s/commands/cluster_drop_database_cmd.cpp b/src/mongo/s/commands/cluster_drop_database_cmd.cpp index 313da69ea31..7eff991cf4c 100644 --- a/src/mongo/s/commands/cluster_drop_database_cmd.cpp +++ b/src/mongo/s/commands/cluster_drop_database_cmd.cpp @@ -106,17 +106,10 @@ public: const auto remoteResponse = uassertStatusOK(cmdResponse.swResponse); uassertStatusOK(getStatusFromCommandResult(remoteResponse.data)); - - DropDatabaseReply reply; - reply.setDropped(dbName); - return reply; } catch (const ExceptionFor<ErrorCodes::NamespaceNotFound>&) { - // If the namespace isn't found, treat the drop as a success but inform about the - // failure. - DropDatabaseReply reply; - reply.setInfo("database does not exist"_sd); - return reply; + // If the namespace isn't found, treat the drop as a success } + return {}; } }; } clusterDropDatabaseCmd; diff --git a/src/mongo/s/request_types/sharded_ddl_commands.idl b/src/mongo/s/request_types/sharded_ddl_commands.idl index bebedb8853f..2e142c46424 100644 --- a/src/mongo/s/request_types/sharded_ddl_commands.idl +++ b/src/mongo/s/request_types/sharded_ddl_commands.idl @@ -133,8 +133,6 @@ commands: namespace: ignored api_version: "" cpp_name: ShardsvrDropDatabase - # The reply can completely removed once 5.0 becomes last lts - reply_type: DropDatabaseReply _shardsvrDropDatabaseParticipant: description: "Internal command sent to participants shards to drop a database." |