summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands
diff options
context:
space:
mode:
authorSergi Mateo Bellido <sergi.mateo-bellido@mongodb.com>2023-02-23 10:00:13 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-02-23 11:33:45 +0000
commitacd63757fc74f12ac38632e523aace1cabc508a6 (patch)
treea15a2b7278ad5f1edadf03753dd2d22a0e184eb3 /src/mongo/db/commands
parent5ee40fa2dc77876c2885a19bc02ff15a1ea1dde8 (diff)
downloadmongo-acd63757fc74f12ac38632e523aace1cabc508a6.tar.gz
SERVER-70831 Relying on the critical section for dropCollection
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r--src/mongo/db/commands/set_feature_compatibility_version_command.cpp37
1 files changed, 37 insertions, 0 deletions
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