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

reinforce MONGO_LOGV2_DEFAULT_COMPONENT placement rule

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • Service Arch 2023-09-18

      Rerun the tool from SERVER-52604.

      See Slack announcement.
      https://mongodb.slack.com/archives/C1MT4NHF0/p1694046326160709
      Quoted here:

      Hey all, quick memo (more of a reminder):
      As you probably know, the #define MONGO_LOGV2_DEFAULT_COMPONENT is necessary in a server .cpp file that wants to use logging.

      • The old rule was that this definition must appear before the #include block at the top of a .cpp file.
      • The new rule is that this definition must appear after the #include block. A complete reversal!

      This change happened about 16 months ago in SERVER-52604, which included a codebase sweep. However, since that sweep, 20+ instances of the old style have come in. These old-style definitions may not break anything immediately, but they make it impossible to LOGV2 from headers that they include, and could be trouble for a C++ modules rollout, or cause other subtle modularity problems.
      I'm going to do another sweep of the codebase and fix these again (it's easy because I have a tool that does it), but I do want to get the word out.
      Thx!

      This is really just tracking the work to run the script again.
      https://gist.github.com/BillyDonahue/48c2746b9a761e1d1ecc930486d83aa5

            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: