diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2021-02-05 10:25:24 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-02-05 15:48:48 +0000 |
commit | 39da42536af53f23b92cc0f4cab02586859dc777 (patch) | |
tree | a2713a9446fbd6dce832c443fb7c52f2c5024437 | |
parent | bd26a7d1e47f1df8d7b55eaab2041b404a6d9892 (diff) | |
download | mongo-39da42536af53f23b92cc0f4cab02586859dc777.tar.gz |
Revert "SERVER-54283 Make the checks for new sharded DDL code path be uniform"
This reverts commit 12585ccedf9215901d21351d6f5da9f2dd337395.
4 files changed, 40 insertions, 66 deletions
diff --git a/src/mongo/db/s/shardsvr_create_collection_command.cpp b/src/mongo/db/s/shardsvr_create_collection_command.cpp index ab8c8053e68..23efc3558d3 100644 --- a/src/mongo/db/s/shardsvr_create_collection_command.cpp +++ b/src/mongo/db/s/shardsvr_create_collection_command.cpp @@ -184,14 +184,14 @@ public: using Request = ShardsvrCreateCollection; using Response = CreateCollectionResponse; - std::string help() const override { - return "Internal command. Do not call directly. Creates a collection."; - } - bool adminOnly() const override { return false; } + std::string help() const override { + return "Internal command. Do not call directly. Creates a collection."; + } + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -215,26 +215,18 @@ public: "Create Collection path has not been implemented", request().getShardKey()); - bool useNewPath = [&] { - // TODO (SERVER-53092): Use the FCV lock in order to "reserve" operation as running - // in new or legacy mode - return feature_flags::gShardingFullDDLSupport.isEnabled( - serverGlobalParams.featureCompatibility) && - feature_flags::gDisableIncompleteShardingDDLSupport.isEnabled( - serverGlobalParams.featureCompatibility); - }(); - - if (!useNewPath) { + if (feature_flags::gShardingFullDDLSupport.isEnabled( + serverGlobalParams.featureCompatibility)) { + LOGV2_DEBUG( + 5277910, 1, "Running new create collection procedure", "namespace"_attr = ns()); + return createCollection(opCtx, ns(), request()); + } else { LOGV2_DEBUG(5277911, 1, "Running legacy create collection procedure", "namespace"_attr = ns()); return createCollectionLegacy(opCtx, ns(), request()); } - - LOGV2_DEBUG( - 5277910, 1, "Running new create collection procedure", "namespace"_attr = ns()); - return createCollection(opCtx, ns(), request()); } private: diff --git a/src/mongo/db/s/shardsvr_drop_collection_command.cpp b/src/mongo/db/s/shardsvr_drop_collection_command.cpp index d141793eeed..0cd8bd76f20 100644 --- a/src/mongo/db/s/shardsvr_drop_collection_command.cpp +++ b/src/mongo/db/s/shardsvr_drop_collection_command.cpp @@ -60,13 +60,6 @@ void dropCollectionLegacy(OperationContext* opCtx, const NamespaceString& nss) { class ShardsvrDropCollectionCommand final : public TypedCommand<ShardsvrDropCollectionCommand> { public: - using Request = ShardsvrDropCollection; - - std::string help() const override { - return "Internal command, which is exported by the primary sharding server. Do not call " - "directly. Drops a collection."; - } - bool acceptsAnyApiVersionParameters() const override { return true; } @@ -75,6 +68,13 @@ public: return Command::AllowedOnSecondary::kNever; } + std::string help() const override { + return "Internal command, which is exported by the primary sharding server. Do not call " + "directly. Drops a collection."; + } + + using Request = ShardsvrDropCollection; + class Invocation final : public InvocationBase { public: using InvocationBase::InvocationBase; @@ -88,16 +88,10 @@ public: << opCtx->getWriteConcern().wMode, opCtx->getWriteConcern().wMode == WriteConcernOptions::kMajority); - bool useNewPath = [&] { - // TODO (SERVER-53092): Use the FCV lock in order to "reserve" operation as running - // in new or legacy mode - return feature_flags::gShardingFullDDLSupport.isEnabled( - serverGlobalParams.featureCompatibility) && - feature_flags::gDisableIncompleteShardingDDLSupport.isEnabled( - serverGlobalParams.featureCompatibility); - }(); - - if (!useNewPath) { + if (!feature_flags::gShardingFullDDLSupport.isEnabled( + serverGlobalParams.featureCompatibility) || + feature_flags::gDisableIncompleteShardingDDLSupport.isEnabled( + serverGlobalParams.featureCompatibility)) { LOGV2_DEBUG(5280951, 1, "Running legacy drop collection procedure", diff --git a/src/mongo/db/s/shardsvr_drop_database_command.cpp b/src/mongo/db/s/shardsvr_drop_database_command.cpp index 64194ab6cc4..98bdcfed9ad 100644 --- a/src/mongo/db/s/shardsvr_drop_database_command.cpp +++ b/src/mongo/db/s/shardsvr_drop_database_command.cpp @@ -63,14 +63,6 @@ DropDatabaseReply dropDatabaseLegacy(OperationContext* opCtx, StringData dbName) 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 " - "directly. Drops a database."; - } - bool acceptsAnyApiVersionParameters() const override { return true; } @@ -79,6 +71,14 @@ public: return Command::AllowedOnSecondary::kNever; } + std::string help() const override { + return "Internal command, which is exported by the primary sharding server. Do not call " + "directly. Drops a database."; + } + + using Request = ShardsvrDropDatabase; + using Response = DropDatabaseReply; + class Invocation final : public InvocationBase { public: using InvocationBase::InvocationBase; @@ -94,16 +94,11 @@ public: const auto dbName = request().getDbName(); - bool useNewPath = [&] { - // TODO (SERVER-53092): Use the FCV lock in order to "reserve" operation as running - // in new or legacy mode - return feature_flags::gShardingFullDDLSupport.isEnabled( - serverGlobalParams.featureCompatibility) && - feature_flags::gDisableIncompleteShardingDDLSupport.isEnabled( - serverGlobalParams.featureCompatibility); - }(); + if (!feature_flags::gShardingFullDDLSupport.isEnabled( + serverGlobalParams.featureCompatibility) || + feature_flags::gDisableIncompleteShardingDDLSupport.isEnabled( + serverGlobalParams.featureCompatibility)) { - if (!useNewPath) { LOGV2_DEBUG( 5281110, 1, "Running legacy drop database procedure", "database"_attr = dbName); return dropDatabaseLegacy(opCtx, dbName); diff --git a/src/mongo/db/s/shardsvr_rename_collection_command.cpp b/src/mongo/db/s/shardsvr_rename_collection_command.cpp index 502dcd08247..245e9fc9f0d 100644 --- a/src/mongo/db/s/shardsvr_rename_collection_command.cpp +++ b/src/mongo/db/s/shardsvr_rename_collection_command.cpp @@ -207,14 +207,14 @@ public: using Request = ShardsvrRenameCollection; using Response = RenameCollectionResponse; - std::string help() const override { - return "Internal command. Do not call directly. Renames a collection."; - } - bool adminOnly() const override { return false; } + std::string help() const override { + return "Internal command. Do not call directly. Renames a collection."; + } + AllowedOnSecondary secondaryAllowed(ServiceContext*) const override { return AllowedOnSecondary::kNever; } @@ -229,17 +229,10 @@ public: auto const shardingState = ShardingState::get(opCtx); uassertStatusOK(shardingState->canAcceptShardedCommands()); + bool newPath = feature_flags::gShardingFullDDLSupport.isEnabled( + serverGlobalParams.featureCompatibility); - bool useNewPath = [&] { - // TODO (SERVER-53092): Use the FCV lock in order to "reserve" operation as running - // in new or legacy mode - return feature_flags::gShardingFullDDLSupport.isEnabled( - serverGlobalParams.featureCompatibility) && - feature_flags::gDisableIncompleteShardingDDLSupport.isEnabled( - serverGlobalParams.featureCompatibility); - }(); - - if (!isCollectionSharded(opCtx, fromNss) || !useNewPath) { + if (!isCollectionSharded(opCtx, fromNss) || !newPath) { return renameUnshardedCollection(opCtx, req, fromNss); } |