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

Move constant lookup values creation in change streams out of the hot path

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Trivial - P5 Trivial - P5
    • 8.2.0-rc0
    • Affects Version/s: None
    • Component/s: Change streams
    • None
    • Query Execution
    • Fully Compatible
    • QE 2025-03-17
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In change_stream_event_transform.cpp, there are several lookup values for constant strings (vectors & sets), which are put in function-local static variables.
      This means that the lookup values will be built at most once, the compiler needs to put in a guard variable to make the only-once initialization of the variables thread-safe: Link to compiler explorer

      While these guard variables have low overhead, we can fully avoid them by constructing the lookup values exactly once at program startup, by moving them out of the functions into the anonymous namespace.

            Assignee:
            jan.steemann@mongodb.com Jan Steemann
            Reporter:
            jan.steemann@mongodb.com Jan Steemann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              None
              None
              None
              None