summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorMatt Kneiser <matt.kneiser@mongodb.com>2022-04-05 21:18:30 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-04-06 00:51:52 +0000
commitaa8f0cde15be400cb19aa02498e8091310f88bfd (patch)
treea36c992da6869600676b35e1b70fc2234a6f26b7 /src/mongo/db
parentca37741bc07b210ed864f456f0e0fdf55c26eab9 (diff)
downloadmongo-aa8f0cde15be400cb19aa02498e8091310f88bfd.tar.gz
Revert "SERVER-64603 Creates Skeleton for Renaming Database for Restore"
This reverts commit bfb041da4093fc8d8645aa20fc45b55723e2e789.
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/commands/SConscript12
-rw-r--r--src/mongo/db/commands/rename_database_for_restore_command.cpp114
-rw-r--r--src/mongo/db/commands/rename_database_for_restore_command.idl49
3 files changed, 0 insertions, 175 deletions
diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript
index f122a05c212..a6138057096 100644
--- a/src/mongo/db/commands/SConscript
+++ b/src/mongo/db/commands/SConscript
@@ -363,7 +363,6 @@ env.Library(
"plan_cache_clear_command.cpp",
"plan_cache_commands.cpp",
"rename_collection_cmd.cpp",
- "rename_database_for_restore_command.cpp",
"run_aggregate.cpp",
"sleep_command.cpp",
"validate.cpp",
@@ -432,7 +431,6 @@ env.Library(
'list_collections_filter',
'list_databases_command',
'rename_collection_idl',
- 'rename_database_for_restore_command_idl',
'test_commands_enabled',
'validate_db_metadata_command',
],
@@ -458,16 +456,6 @@ env.Library(
)
env.Library(
- target='rename_database_for_restore_command_idl',
- source=[
- 'rename_database_for_restore_command.idl',
- ],
- LIBDEPS_PRIVATE=[
- '$BUILD_DIR/mongo/idl/idl_parser',
- ],
-)
-
-env.Library(
target='set_index_commit_quorum_idl',
source=[
'set_index_commit_quorum.idl',
diff --git a/src/mongo/db/commands/rename_database_for_restore_command.cpp b/src/mongo/db/commands/rename_database_for_restore_command.cpp
deleted file mode 100644
index 91de5aa1b27..00000000000
--- a/src/mongo/db/commands/rename_database_for_restore_command.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * Copyright (C) 2022-present MongoDB, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the Server Side Public License, version 1,
- * as published by MongoDB, Inc.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * Server Side Public License for more details.
- *
- * You should have received a copy of the Server Side Public License
- * along with this program. If not, see
- * <http://www.mongodb.com/licensing/server-side-public-license>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the Server Side Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kCommand
-
-#include <string>
-
-#include "mongo/bson/bsonobj.h"
-#include "mongo/db/auth/authorization_session.h"
-#include "mongo/db/catalog/catalog_control.h"
-#include "mongo/db/commands.h"
-#include "mongo/db/commands/rename_database_for_restore_command_gen.h"
-#include "mongo/db/repl/replication_coordinator.h"
-#include "mongo/db/storage/storage_parameters_gen.h"
-#include "mongo/logv2/log.h"
-
-namespace mongo {
-namespace {
-
-class RenameDatabaseForRestoreCmd
- : public BasicCommandWithRequestParser<RenameDatabaseForRestoreCmd> {
-public:
- using Request = RenameDatabaseForRestoreCommand;
-
- bool skipApiVersionCheck() const override {
- // Internal command used by the restore procedure.
- return true;
- }
-
- AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
- return AllowedOnSecondary::kNever;
- }
-
- bool adminOnly() const {
- return true;
- }
-
- bool supportsWriteConcern(const BSONObj& cmd) const override {
- return false;
- }
-
- Status checkAuthForCommand(Client* client,
- const std::string& dbname,
- const BSONObj& cmdObj) const override {
- if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
- ResourcePattern::forClusterResource(), ActionType::internal)) {
- return Status(ErrorCodes::Unauthorized, "Unauthorized");
- }
-
- return Status::OK();
- }
-
- bool runWithRequestParser(OperationContext* opCtx,
- const std::string& db,
- const BSONObj& cmdObj,
- const RequestParser& requestParser,
- BSONObjBuilder& result) final {
- uassert(ErrorCodes::CommandFailed,
- "Cannot run the 'renameDatabaseForRestore' command when the "
- "'featureFlagDatabaseRenameDuringRestore' is disabled.",
- feature_flags::gDatabaseRenameDuringRestore.isEnabled(
- serverGlobalParams.featureCompatibility));
-
- uassert(ErrorCodes::CommandFailed,
- "This command can only be used in standalone mode",
- !repl::ReplicationCoordinator::get(opCtx)->getSettings().usingReplSets());
-
- uassert(ErrorCodes::CommandFailed,
- "This command can only be run during a restore procedure",
- storageGlobalParams.restore);
-
- const auto* cmd = &requestParser.request();
- auto from = cmd->getFrom();
- auto to = cmd->getTo();
-
- LOGV2(6460300, "CMD: renameDatabaseForRestore", "from"_attr = from, "to"_attr = to);
-
- return true;
- }
-
- void validateResult(const BSONObj& resultObj) final {
- return;
- }
-
-} renameDatabaseForRestoreCmd;
-
-} // namespace
-} // namespace mongo
diff --git a/src/mongo/db/commands/rename_database_for_restore_command.idl b/src/mongo/db/commands/rename_database_for_restore_command.idl
deleted file mode 100644
index 01af27396ee..00000000000
--- a/src/mongo/db/commands/rename_database_for_restore_command.idl
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright (C) 2022-present MongoDB, Inc.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the Server Side Public License, version 1,
-# as published by MongoDB, Inc.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# Server Side Public License for more details.
-#
-# You should have received a copy of the Server Side Public License
-# along with this program. If not, see
-# <http://www.mongodb.com/licensing/server-side-public-license>.
-#
-# As a special exception, the copyright holders give permission to link the
-# code of portions of this program with the OpenSSL library under certain
-# conditions as described in each individual source file and distribute
-# linked combinations including the program with the OpenSSL library. You
-# must comply with the Server Side Public License in all respects for
-# all of the code used other than as permitted herein. If you modify file(s)
-# with this exception, you may extend this exception to your version of the
-# file(s), but you are not obligated to do so. If you do not wish to do so,
-# delete this exception statement from your version. If you delete this
-# exception statement from all source files in the program, then also delete
-# it in the license file.
-#
-
-global:
- cpp_namespace: "mongo"
-
-imports:
- - "mongo/idl/basic_types.idl"
-
-commands:
- renameDatabaseForRestore:
- command_name: "renameDatabaseForRestore"
- description: "Rename Database during Restore"
- cpp_name: RenameDatabaseForRestoreCommand
- namespace: ignored
- api_version: ""
- strict: true
- fields:
- from:
- description: "Current Database Name to change"
- type: namespacestring
- to:
- description: "New Database Name"
- type: namespacestring