Details
-
Improvement
-
Status: Closed
-
Major - P3
-
Resolution: Fixed
-
None
-
None
-
Fully Compatible
-
Repl 2020-09-07
Description
I was surprised when
if (const auto& fcv = serverGlobalParams.featureCompatibility; fcv.isVersionInitialized() && |
fcv.isGreaterThanOrEqualTo(ServerGlobalParams::FeatureCompatibility::Version::kVersion47)) {
|
// ... |
}
|
wouldn't compile. So the newly-added accessors (isLessThanOrEqualTo, isGreaterThanOrEqualTo, isLessThan, isGreaterThan, isUpgradingOrDowngrading) should be const-qualified.
However in addition to this it might be better if serverGlobalParams.featureCompatibility was a const ref, with some other name for the places that legitimately need to modify it, eg.
struct ServerGlobalParams {
|
// ...
|
|
struct FeatureCompatibility {
|
// ...
|
- } featureCompatibility;
|
+ } featureCompatibilityMutable;
|
+ const FeatureCompatibility& featureCompatibility = featureCompatibilityMutable;
|
|
// ...
|
}; |
This would have caught the missing const-qualifier on the accessors when they were added (in addition to helping prevent accidents).
Attachments
Issue Links
- related to
-
SERVER-49070 Add FCV gating helpers
-
- Closed
-