diff options
author | Gabriel Marks <gabriel.marks@mongodb.com> | 2022-11-17 19:55:55 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-11-17 21:09:28 +0000 |
commit | 669df50d87d20b0190dd272a51eb256944f1a480 (patch) | |
tree | c58860ee21e90174f0ce68df7bfce3285bb9f9e4 /src/mongo/db/server_parameter.h | |
parent | 1301f35e5dcb08e55d79c7213cc48165c2b49156 (diff) | |
download | mongo-669df50d87d20b0190dd272a51eb256944f1a480.tar.gz |
SERVER-65809 Add min_fcv IDL option for server parameters
Diffstat (limited to 'src/mongo/db/server_parameter.h')
-rw-r--r-- | src/mongo/db/server_parameter.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/mongo/db/server_parameter.h b/src/mongo/db/server_parameter.h index 29b3347ec7b..3ecc6a5b6f5 100644 --- a/src/mongo/db/server_parameter.h +++ b/src/mongo/db/server_parameter.h @@ -44,6 +44,7 @@ #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/logical_time.h" #include "mongo/db/tenant_id.h" +#include "mongo/util/version/releases.h" #define MONGO_SERVER_PARAMETER_REGISTER(name) \ MONGO_INITIALIZER_GENERAL( \ @@ -217,16 +218,28 @@ public: _redact = true; } - virtual bool isEnabled() const { - return !featureFlagIsDisabled(); - } + bool isEnabled() const; + + // Return whether this server parameter is compatible with the given FCV. + virtual bool isEnabledOnVersion( + const multiversion::FeatureCompatibilityVersion& targetFCV) const; void setFeatureFlag(FeatureFlag* featureFlag) { _featureFlag = featureFlag; } + void setMinFCV(const multiversion::FeatureCompatibilityVersion& minFCV) { + _minFCV = minFCV; + } + protected: - bool featureFlagIsDisabled() const; + bool featureFlagIsDisabledOnVersion( + const multiversion::FeatureCompatibilityVersion& targetFCV) const; + + bool minFCVIsLessThanOrEqualToVersion( + const multiversion::FeatureCompatibilityVersion& fcv) const { + return !_minFCV || fcv >= *_minFCV; + } // Helper for translating setParameter values from BSON to string. StatusWith<std::string> _coerceToString(const BSONElement&); @@ -234,6 +247,7 @@ protected: private: std::string _name; FeatureFlag* _featureFlag = nullptr; + boost::optional<multiversion::FeatureCompatibilityVersion> _minFCV = boost::none; ServerParameterType _type; bool _testOnly = false; bool _redact = false; |