From acd63757fc74f12ac38632e523aace1cabc508a6 Mon Sep 17 00:00:00 2001 From: Sergi Mateo Bellido Date: Thu, 23 Feb 2023 10:00:13 +0000 Subject: SERVER-70831 Relying on the critical section for dropCollection --- .../set_feature_compatibility_version_command.cpp | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/mongo/db/commands') diff --git a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp index 11deb0947d3..83e1784e716 100644 --- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp +++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp @@ -324,6 +324,18 @@ public: ->waitForCoordinatorsOfGivenTypeToComplete( opCtx, DDLCoordinatorTypeEnum::kRenameCollectionPre63Compatible); } + // TODO SERVER-73627: Remove once 7.0 becomes last LTS. + if (serverGlobalParams.clusterRole == ClusterRole::ShardServer && + feature_flags::gDropCollectionHoldingCriticalSection.isEnabledOnVersion( + requestedVersion)) { + ShardingDDLCoordinatorService::getService(opCtx) + ->waitForCoordinatorsOfGivenTypeToComplete( + opCtx, DDLCoordinatorTypeEnum::kDropCollectionPre70Compatible); + + ShardingDDLCoordinatorService::getService(opCtx) + ->waitForCoordinatorsOfGivenTypeToComplete( + opCtx, DDLCoordinatorTypeEnum::kDropDatabasePre70Compatible); + } return true; } @@ -455,6 +467,19 @@ public: opCtx, DDLCoordinatorTypeEnum::kRenameCollectionPre63Compatible); } + // TODO SERVER-73627: Remove once 7.0 becomes last LTS. + if (serverGlobalParams.clusterRole == ClusterRole::ShardServer && + requestedVersion > actualVersion && + feature_flags::gDropCollectionHoldingCriticalSection.isEnabledOnVersion( + requestedVersion)) { + ShardingDDLCoordinatorService::getService(opCtx) + ->waitForCoordinatorsOfGivenTypeToComplete( + opCtx, DDLCoordinatorTypeEnum::kDropCollectionPre70Compatible); + ShardingDDLCoordinatorService::getService(opCtx) + ->waitForCoordinatorsOfGivenTypeToComplete( + opCtx, DDLCoordinatorTypeEnum::kDropDatabasePre70Compatible); + } + LOGV2(6744302, "setFeatureCompatibilityVersion succeeded", "upgradeOrDowngrade"_attr = upgradeOrDowngrade, @@ -504,6 +529,18 @@ private: opCtx, DDLCoordinatorTypeEnum::kRenameCollection); } + // TODO SERVER-73627: Remove once 7.0 becomes last LTS. + if (actualVersion > requestedVersion && + !feature_flags::gDropCollectionHoldingCriticalSection.isEnabledOnVersion( + requestedVersion)) { + ShardingDDLCoordinatorService::getService(opCtx) + ->waitForCoordinatorsOfGivenTypeToComplete(opCtx, + DDLCoordinatorTypeEnum::kDropCollection); + ShardingDDLCoordinatorService::getService(opCtx) + ->waitForCoordinatorsOfGivenTypeToComplete(opCtx, + DDLCoordinatorTypeEnum::kDropDatabase); + } + // TODO SERVER-68373 remove once 7.0 becomes last LTS if (actualVersion > requestedVersion) { // Drain the QE compact coordinator because it persists state that is -- cgit v1.2.1