[SERVER-43077] problems with MONGO_MODULE_STARTUP_OPTIONS macros Created: 29/Aug/19  Updated: 06/Dec/22  Resolved: 29/Aug/19

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Billy Donahue Assignee: DO NOT USE - Backlog - Dev Tools
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-40811 Eliminate MONGO_INITIALIZER kruft Closed
Assigned Teams:
Developer Tools
Operating System: ALL
Participants:

 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.



 Comments   
Comment by Billy Donahue [ 29/Aug/19 ]

Nevermind. Was fixed by https://github.com/mongodb/mongo/commit/5b29bae61192a3a449d729691b1765bb4ade3dea .
I was looking at an old branch.

Generated at Thu Feb 08 05:02:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.