diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2021-02-05 06:17:58 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-02-05 13:17:13 +0000 |
commit | 12585ccedf9215901d21351d6f5da9f2dd337395 (patch) | |
tree | c8469bbf5421495ab0b6e47cfda1f711c658a206 /src/mongo/db/s/shardsvr_drop_collection_command.cpp | |
parent | b360736c85080cfbd8ccdd7c5edddc553a7f6285 (diff) | |
download | mongo-12585ccedf9215901d21351d6f5da9f2dd337395.tar.gz |
SERVER-54283 Make the checks for new sharded DDL code path be uniform
Diffstat (limited to 'src/mongo/db/s/shardsvr_drop_collection_command.cpp')
-rw-r--r-- | src/mongo/db/s/shardsvr_drop_collection_command.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/mongo/db/s/shardsvr_drop_collection_command.cpp b/src/mongo/db/s/shardsvr_drop_collection_command.cpp index 0cd8bd76f20..d141793eeed 100644 --- a/src/mongo/db/s/shardsvr_drop_collection_command.cpp +++ b/src/mongo/db/s/shardsvr_drop_collection_command.cpp @@ -60,6 +60,13 @@ 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; } @@ -68,13 +75,6 @@ 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,10 +88,16 @@ public: << opCtx->getWriteConcern().wMode, opCtx->getWriteConcern().wMode == WriteConcernOptions::kMajority); - if (!feature_flags::gShardingFullDDLSupport.isEnabled( - serverGlobalParams.featureCompatibility) || - feature_flags::gDisableIncompleteShardingDDLSupport.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 (!useNewPath) { LOGV2_DEBUG(5280951, 1, "Running legacy drop collection procedure", |