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

problems with MONGO_MODULE_STARTUP_OPTIONS macros

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Internal Code
    • Labels:
      None
    • Operating System:
      ALL

      Description

      Some initializers emitted by these macros are subtly incorrect.

      • MONGO_STARTUP_OPTIONS_POST emits a function with the _Store suffix instead of _Post suffix as documented.

      /**
        * Macro to define an initializer function named "<fname>_Post" ...
      */
      #define MONGO_STARTUP_OPTIONS_POST(fname) \
              fname##_Store, ("BeginPostStartupOptionStorage"), ("EndPostStartupOptionStorage"))
      
      

      ....

      • Every phase has its own closed initializer range, after a Begin$X initializer and before an End$X initializer.

      -#define MONGO_GENERAL_STARTUP_OPTIONS_REGISTER(fname)                    \
      -    MONGO_INITIALIZER_GENERAL(fname##_Register,                          \
      -                              ("BeginGeneralStartupOptionRegistration"), \
      -                              ("EndGeneralStartupOptionRegistration"))
      

      But we seem to have flubbed the MONGO_MODULE_STARTUP_OPTIONS_REGISTER rule, which is defined to occur after EndGeneralStartupOptionRegistration and before EndStartupOptionRegistration, which is two "ends" and not its own well-defined interval. I'm not sure what the implications of this are but it doesn't appear to be intentional.

      -#define MONGO_MODULE_STARTUP_OPTIONS_REGISTER(fname) \

      • MONGO_INITIALIZER_GENERAL(fname##_Register, \
      • ("EndGeneralStartupOptionRegistration"), \
      • ("EndStartupOptionRegistration"))

      We should emit these macros in a more structurally clear way. There's a lot of boilerplate in src/mongo/util/options_parser/startup_option_init.h that can be reduced.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-server-devtools DO NOT USE - Backlog - Dev Tools
              Reporter:
              billy.donahue Billy Donahue
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: