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

problems with MONGO_MODULE_STARTUP_OPTIONS macros

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Internal Code
    • None
    • ALL

      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.

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

              Created:
              Updated:
              Resolved: