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

IDL Compiler Should Generate Constant for Cluster Server Parameter Names

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Server Programmability
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      Right now the IDL generator hardcodes the parameter name when creating the IDLServerParameterWithStorage type. For example, this cluster parameter will generate the following block:

      TenantIdMap<PauseMigrationsDuringMultiUpdatesParam> pauseMigrationsDuringMultiUpdates;
      MONGO_SERVER_PARAMETER_REGISTER(idl_93f9b7ae669be332db86ad17ee9a278d1404cd21)(InitializerContext*) {
          /**
           * Cluster parameter determining if chunk migrations should be prevented while updateMany or deleteMany operations are ongoing.
           */
          [[maybe_unused]] auto* scp_0 = ([]() -> ServerParameter* {
              auto* ret = makeIDLServerParameterWithStorage<ServerParameterType::kClusterWide>("pauseMigrationsDuringMultiUpdates", pauseMigrationsDuringMultiUpdates);
              return ret;
          })();
      
      }
      

      And it will generate the following constants:

          static constexpr auto k_idFieldName = "_id"_sd;
          static constexpr auto kClusterParameterTimeFieldName = "clusterParameterTime"_sd;
          static constexpr auto kClusterServerParameterFieldName = "ClusterServerParameter"_sd;
          static constexpr auto kEnabledFieldName = "enabled"_sd;
      

      It would be nice if the "pauseMigrationsDuringMultiUpdates" string literal was also defined as a constant. Right now we have to hardcode these values elsewhere if we want to reference cluster server parameter names.

      The same issue might also affect ordinary (non-cluster) server parameters as well.

            Assignee:
            Unassigned Unassigned
            Reporter:
            brett.nawrocki@mongodb.com Brett Nawrocki
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: