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

Allow IDL server parameter to be of type IDL enum

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Server Programmability
    • Programmability 2024-11-11, Programmability 2024-11-25, Programmability 2024-12-09

      The following example will cause the IDL compiler to generate C++ code which fails to compile

       

      enums:
          QueryPlanRankerMode:
              type: string
              values:
                  kAutomaticCE: "automaticCE"
                  kHistogramCE: "histogramCE"
                  kSamplingCE: "samplingCE"
                  kMultiPlanning: "multiPlanning"
      
      server_parameters:
        planRankerMode:
          description: "Enable cost-based ranking of query plans."
          set_at: [ startup, runtime ]
          cpp_varname: planRankerMode
          cpp_vartype: synchronized_value<QueryPlanRankerModeEnum>
          default:
              expr: QueryPlanRankerModeEnum::kAutomaticCE
          redact: false

       

      The current workaround is to generate the server parameter as a cpp_class, implement an append and setFromString function and access it at runtime using ServerParameterSet::getNodeParameterSet().

      This feature request will improve the usable of IDL. I've run into two cases in the past month where this would be useful.

            Assignee:
            adithi.raghavan@mongodb.com Adithi Raghavan
            Reporter:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: