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

NamespaceString constants: immortality and constexprness

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Service Arch 2023-02-20

      NamespaceString cannot be constexpr, but it defines several dozen k-constants for reserved namespace values. These are not 100% init-safe, as they have static nonlocal storage duration and can be accessed when they aren't ready by the initializers of other TUs in the system.

      This can be worked around by changing the types of these constants to something that basically works like a NamespaceString, and is implicitly convertible to NamespaceString, but executes some memoizing instantiation code upon use.

      This requires either repeating the huge and growing list of identifiers a few times, or simply moving the constant definitions into an x-macro definition table that can be expanded multiple times. The latter is much better, and has the side benefit of reducing code churn and interface bloat in the namespace_string component's source code.

            Assignee:
            billy.donahue@mongodb.com Billy Donahue
            Reporter:
            billy.donahue@mongodb.com Billy Donahue
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: