diff options
author | Huayu Ouyang <huayu.ouyang@mongodb.com> | 2020-10-06 15:47:19 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-10-08 21:08:43 +0000 |
commit | c390a3ed067ab283d8d3859b1f60b6fb004e7536 (patch) | |
tree | c668eecad4e33d903a8cd1adddab38ebb38157cc /src | |
parent | ecceabf2c79cd9dbbba11705d3d50d99a48f70f5 (diff) | |
download | mongo-c390a3ed067ab283d8d3859b1f60b6fb004e7536.tar.gz |
SERVER-50421 Alias internalValidateFeaturesAsMaster server parameter
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/commands/feature_compatibility_version.idl | 5 | ||||
-rw-r--r-- | src/mongo/db/mongod_main.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/server_options_server_helpers.cpp | 18 |
3 files changed, 17 insertions, 8 deletions
diff --git a/src/mongo/db/commands/feature_compatibility_version.idl b/src/mongo/db/commands/feature_compatibility_version.idl index ca4ff5652a9..881e7a25f73 100644 --- a/src/mongo/db/commands/feature_compatibility_version.idl +++ b/src/mongo/db/commands/feature_compatibility_version.idl @@ -37,11 +37,12 @@ server_parameters: cpp_class: name: FeatureCompatibilityVersionParameter override_ctor: true - internalValidateFeaturesAsMaster: + internalValidateFeaturesAsPrimary: + deprecated_name: "internalValidateFeaturesAsMaster" description: > Startup parameter to ignore featureCompatibilityVersion checks. This parameter cannot be set if the node is started with --replSet. This should never be set by end users. set_at: startup cpp_vartype: bool - cpp_varname: gInternalValidateFeaturesAsMaster + cpp_varname: gInternalValidateFeaturesAsPrimary default: true diff --git a/src/mongo/db/mongod_main.cpp b/src/mongo/db/mongod_main.cpp index 07629f33788..ba18280bddd 100644 --- a/src/mongo/db/mongod_main.cpp +++ b/src/mongo/db/mongod_main.cpp @@ -679,7 +679,7 @@ ExitCode _initAndListen(ServiceContext* serviceContext, int listenPort) { startTTLMonitor(serviceContext); } - if (replSettings.usingReplSets() || !gInternalValidateFeaturesAsMaster) { + if (replSettings.usingReplSets() || !gInternalValidateFeaturesAsPrimary) { serverGlobalParams.validateFeaturesAsMaster.store(false); } } diff --git a/src/mongo/db/server_options_server_helpers.cpp b/src/mongo/db/server_options_server_helpers.cpp index dc58d92985d..641ce12cca6 100644 --- a/src/mongo/db/server_options_server_helpers.cpp +++ b/src/mongo/db/server_options_server_helpers.cpp @@ -174,14 +174,22 @@ Status validateServerOptions(const moe::Environment& params) { haveAuthenticationMechanisms = false; } - if (parameters.find("internalValidateFeaturesAsMaster") != parameters.end()) { - // Command line options that are disallowed when internalValidateFeaturesAsMaster is - // specified. + bool internalValidateFeaturesAsPrimaryUsed = + parameters.find("internalValidateFeaturesAsPrimary") != parameters.end(); + bool internalValidateFeaturesAsMasterUsed = + parameters.find("internalValidateFeaturesAsMaster") != parameters.end(); + + if (internalValidateFeaturesAsPrimaryUsed || internalValidateFeaturesAsMasterUsed) { + // Command line options that are disallowed when internalValidateFeaturesAsPrimary or + // internalValidateFeaturesAsMaster, the deprecated alias, is specified. + std::string parameterName = internalValidateFeaturesAsPrimaryUsed + ? "internalValidateFeaturesAsPrimary" + : "internalValidateFeaturesAsMaster"; if (params.count("replication.replSet")) { return Status(ErrorCodes::BadValue, str::stream() << // - "Cannot specify both internalValidateFeaturesAsMaster and " - "replication.replSet"); + "Cannot specify both " + parameterName + + " and replication.replSet"); } } } |