summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorJordi Serra Torrens <jordi.serra-torrens@mongodb.com>2022-02-01 09:50:41 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-01 10:19:05 +0000
commit0374b5211c22c67471bea8dffb0a28b68d1eec1a (patch)
tree8fa5722dd0f124b9bc7ffb49c452ea9a96c38d98 /src/mongo/db
parent2517a648edea4f63153e5ef9af448380f38915a0 (diff)
downloadmongo-0374b5211c22c67471bea8dffb0a28b68d1eec1a.tar.gz
SERVER-62849 Drain recoverable RefineCollectionShardKeyCoordinators on FCV downgrade
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/commands/set_feature_compatibility_version_command.cpp13
1 files changed, 13 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 aae37683145..540d8657f6f 100644
--- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
+++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
@@ -80,6 +80,7 @@
#include "mongo/logv2/log.h"
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/s/pm2423_feature_flags_gen.h"
+#include "mongo/s/refine_collection_shard_key_coordinator_feature_flags_gen.h"
#include "mongo/s/resharding/resharding_feature_flag_gen.h"
#include "mongo/stdx/unordered_set.h"
#include "mongo/util/exit.h"
@@ -397,6 +398,18 @@ public:
opCtx, DDLCoordinatorTypeEnum::kCollMod);
}
+ // TODO SERVER-62850 Remove when 6.0 branches-out
+ if (actualVersion > requestedVersion &&
+ !feature_flags::gFeatureFlagRecoverableRefineCollectionShardKeyCoordinator
+ .isEnabledOnVersion(requestedVersion)) {
+ // No more (recoverable) ReshardCollectionCoordinators will start because we
+ // have already switched the FCV value to kDowngrading. Wait for the ongoing
+ // RefineCollectionCoordinators to finish.
+ ShardingDDLCoordinatorService::getService(opCtx)
+ ->waitForCoordinatorsOfGivenTypeToComplete(
+ opCtx, DDLCoordinatorTypeEnum::kRefineCollectionShardKey);
+ }
+
// If we are only running phase-1, then we are done
return true;
}