diff options
author | Varun Ravichandran <varun.ravichandran@mongodb.com> | 2022-08-29 20:41:50 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-09-13 19:25:37 +0000 |
commit | c9d1d2ffdb057d4456c33720c69ddd7fab0f9818 (patch) | |
tree | 44a90d93d2f94d26242bf904011c81579d20ec6b | |
parent | aa13d918e5b82b6451a900860c9ff2ac1afc3953 (diff) | |
download | mongo-c9d1d2ffdb057d4456c33720c69ddd7fab0f9818.tar.gz |
SERVER-69167: Verify that FCV has been initialized before cluster parameter feature flag checks
4 files changed, 20 insertions, 0 deletions
diff --git a/src/mongo/db/commands/get_cluster_parameter_command.cpp b/src/mongo/db/commands/get_cluster_parameter_command.cpp index 35060c90ed4..6f87839e88d 100644 --- a/src/mongo/db/commands/get_cluster_parameter_command.cpp +++ b/src/mongo/db/commands/get_cluster_parameter_command.cpp @@ -65,6 +65,11 @@ public: using InvocationBase::InvocationBase; Reply typedRun(OperationContext* opCtx) { + uassert(ErrorCodes::UnknownFeatureCompatibilityVersion, + "FCV is not yet initialized, retry the command after FCV initialization has " + "completed", + serverGlobalParams.featureCompatibility.isVersionInitialized()); + uassert( ErrorCodes::IllegalOperation, "featureFlagClusterWideConfig not enabled", diff --git a/src/mongo/db/commands/set_cluster_parameter_command.cpp b/src/mongo/db/commands/set_cluster_parameter_command.cpp index 005f17d0c06..2049b3043e5 100644 --- a/src/mongo/db/commands/set_cluster_parameter_command.cpp +++ b/src/mongo/db/commands/set_cluster_parameter_command.cpp @@ -74,6 +74,11 @@ public: (serverGlobalParams.clusterRole == ClusterRole::None)); FixedFCVRegion fcvRegion(opCtx); + uassert(ErrorCodes::UnknownFeatureCompatibilityVersion, + "FCV is not yet initialized, retry the command after FCV initialization has " + "completed", + serverGlobalParams.featureCompatibility.isVersionInitialized()); + uassert( ErrorCodes::IllegalOperation, "Cannot set cluster parameter, gFeatureFlagClusterWideConfig is not enabled", diff --git a/src/mongo/db/s/config/configsvr_set_cluster_parameter_command.cpp b/src/mongo/db/s/config/configsvr_set_cluster_parameter_command.cpp index da76faa6593..24030e5fe57 100644 --- a/src/mongo/db/s/config/configsvr_set_cluster_parameter_command.cpp +++ b/src/mongo/db/s/config/configsvr_set_cluster_parameter_command.cpp @@ -61,6 +61,11 @@ public: const auto coordinatorCompletionFuture = [&]() -> SharedSemiFuture<void> { FixedFCVRegion fcvRegion(opCtx); + uassert(ErrorCodes::UnknownFeatureCompatibilityVersion, + "FCV is not yet initialized, retry the command after FCV initialization " + "has completed", + serverGlobalParams.featureCompatibility.isVersionInitialized()); + uassert(ErrorCodes::IllegalOperation, "featureFlagClusterWideConfig not enabled", gFeatureFlagClusterWideConfig.isEnabled( diff --git a/src/mongo/s/commands/cluster_get_cluster_parameter_cmd.cpp b/src/mongo/s/commands/cluster_get_cluster_parameter_cmd.cpp index 1058e6ebafd..4b6d49ebae1 100644 --- a/src/mongo/s/commands/cluster_get_cluster_parameter_cmd.cpp +++ b/src/mongo/s/commands/cluster_get_cluster_parameter_cmd.cpp @@ -66,6 +66,11 @@ public: using InvocationBase::InvocationBase; Reply typedRun(OperationContext* opCtx) { + uassert(ErrorCodes::UnknownFeatureCompatibilityVersion, + "FCV is not yet initialized, retry the command after FCV initialization has " + "completed", + serverGlobalParams.featureCompatibility.isVersionInitialized()); + uassert( ErrorCodes::IllegalOperation, "featureFlagClusterWideConfig not enabled", |