-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Internal Code
-
None
Many numeric server parameters only make sense with positive values, or non-negative, but this is often not enforced. There may be negative impacts to the server if this is done (either deliberately or accidentally).
Part of the problem seems to be that there is no MONGO_EXPORT_SERVER_PARAMETER variant that can enforce simple restrictions on the permitted values. This means enforcing restrictions requires using ExportedServerParameter directly (with a fair amount of boilerplate), or MONGO_INITIALIZER hacks to enforce the restrictions through other means (only works for startup parameters). For the case of numeric parameters, SERVER-27520 explored the possibility of permitting unsigned types for parameters (and decided against it).
This ticket is to request a simple and easy way of enforcing simple restrictions for the most common cases, eg. min and/or max numeric value, string value from a set of allowed strings, non-empty string.
I can imagine a variant of MONGO_EXPORT_SERVER_PARAMETER which takes an extra argument to a "ServerParameterValidator" object (templated for genericism), which ExportedServerParameter then uses in the default validate() method. We could then provide some pre-canned ServerParameterValidators for the commonly-needed restrictions.
- duplicates
-
SERVER-34345 Make it easier to provide validation rules for server parameters
- Closed
- is duplicated by
-
SERVER-31719 Long overflow in setParameter
- Closed
- related to
-
SERVER-27520 Allow unsigned types for MONGO_EXPORT_SERVER_PARAMETER
- Closed
-
SERVER-30387 maxLogSizeKB parameter should only be positive
- Closed
-
SERVER-30388 ttlMonitorSleepSecs parameter should only be positive
- Closed
-
SERVER-34952 Require validators for non-boolean server parameters
- Closed