Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-30389

Simple and generic way to restrict server parameter values

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 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.

            Assignee:
            backlog-server-platform DO NOT USE - Backlog - Platform Team
            Reporter:
            kevin.pulo@mongodb.com Kevin Pulo
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: