summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/shardsvr_rename_collection_command.cpp
diff options
context:
space:
mode:
authorTommaso Tocci <tommaso.tocci@mongodb.com>2021-08-02 08:40:32 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-08-02 09:23:31 +0000
commitb8daadc92980492cf6ff021b710882468d41dc99 (patch)
tree36e3de521e4dabfc826b19cd6eab8dba5fc273ed /src/mongo/db/s/shardsvr_rename_collection_command.cpp
parentdef8791009754e0705937815a4bea7ed2e94e4e0 (diff)
downloadmongo-b8daadc92980492cf6ff021b710882468d41dc99.tar.gz
SERVER-53066 Remove shardingFullDDLSupport feature guard
Diffstat (limited to 'src/mongo/db/s/shardsvr_rename_collection_command.cpp')
-rw-r--r--src/mongo/db/s/shardsvr_rename_collection_command.cpp68
1 files changed, 0 insertions, 68 deletions
diff --git a/src/mongo/db/s/shardsvr_rename_collection_command.cpp b/src/mongo/db/s/shardsvr_rename_collection_command.cpp
index afbff47b809..3994993dcde 100644
--- a/src/mongo/db/s/shardsvr_rename_collection_command.cpp
+++ b/src/mongo/db/s/shardsvr_rename_collection_command.cpp
@@ -29,74 +29,19 @@
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kCommand
-#include "mongo/platform/basic.h"
-
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/catalog/rename_collection.h"
#include "mongo/db/commands.h"
-#include "mongo/db/db_raii.h"
-#include "mongo/db/s/collection_sharding_state.h"
-#include "mongo/db/s/dist_lock_manager.h"
#include "mongo/db/s/rename_collection_coordinator.h"
-#include "mongo/db/s/sharded_rename_collection_gen.h"
-#include "mongo/db/s/sharding_ddl_50_upgrade_downgrade.h"
#include "mongo/db/s/sharding_ddl_coordinator_service.h"
-#include "mongo/db/s/sharding_ddl_util.h"
#include "mongo/db/s/sharding_state.h"
#include "mongo/logv2/log.h"
#include "mongo/s/cluster_commands_helpers.h"
-#include "mongo/s/grid.h"
#include "mongo/s/request_types/sharded_ddl_commands_gen.h"
namespace mongo {
namespace {
-bool isCollectionSharded(OperationContext* opCtx, const NamespaceString& nss) {
- try {
- Grid::get(opCtx)->catalogClient()->getCollection(opCtx, nss);
- return true;
- } catch (ExceptionFor<ErrorCodes::NamespaceNotFound>&) {
- // The collection is unsharded or doesn't exist
- return false;
- }
-} // namespace
-
-bool renameIsAllowedOnNS(const NamespaceString& nss) {
- if (nss.isSystem()) {
- return nss.isLegalClientSystemNS(serverGlobalParams.featureCompatibility);
- }
-
- return !nss.isOnInternalDb();
-}
-
-RenameCollectionResponse renameCollectionLegacy(OperationContext* opCtx,
- const ShardsvrRenameCollection& request,
- const NamespaceString& fromNss) {
- const auto& toNss = request.getTo();
-
- auto fromDbDistLock = uassertStatusOK(DistLockManager::get(opCtx)->lock(
- opCtx, fromNss.db(), "renameCollection", DistLockManager::kDefaultLockTimeout));
-
- auto fromCollDistLock = uassertStatusOK(DistLockManager::get(opCtx)->lock(
- opCtx, fromNss.ns(), "renameCollection", DistLockManager::kDefaultLockTimeout));
-
- auto toCollDistLock = uassertStatusOK(DistLockManager::get(opCtx)->lock(
- opCtx, toNss.ns(), "renameCollection", DistLockManager::kDefaultLockTimeout));
-
- // Make sure that source and target collection are not sharded
- uassert(ErrorCodes::IllegalOperation,
- str::stream() << "source namespace '" << fromNss << "' must not be sharded",
- !isCollectionSharded(opCtx, fromNss));
- uassert(ErrorCodes::IllegalOperation,
- str::stream() << "cannot rename to sharded collection '" << toNss << "'",
- !isCollectionSharded(opCtx, toNss));
-
- RenameCollectionOptions options{request.getDropTarget(), request.getStayTemp()};
- validateAndRunRenameCollection(opCtx, fromNss, toNss, options);
-
- return RenameCollectionResponse(ChunkVersion::UNSHARDED());
-}
-
class ShardsvrRenameCollectionCommand final : public TypedCommand<ShardsvrRenameCollectionCommand> {
public:
using Request = ShardsvrRenameCollection;
@@ -132,19 +77,6 @@ public:
opCtx->setAlwaysInterruptAtStepDownOrUp();
- FixedFCVRegion fixedFCVRegion(opCtx);
-
- const bool useNewPath =
- feature_flags::gShardingFullDDLSupport.isEnabled(*fixedFCVRegion);
-
- if (fromNss.db() != toNss.db()) {
- sharding_ddl_util::checkDbPrimariesOnTheSameShard(opCtx, fromNss, toNss);
- }
-
- if (!useNewPath) {
- return renameCollectionLegacy(opCtx, req, fromNss);
- }
-
uassert(ErrorCodes::InvalidOptions,
str::stream() << Request::kCommandName
<< " must be called with majority writeConcern, got "