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

Avoid reading the clock to compute $$NOW

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • 5

      erin.zhu@mongodb.com noticed this show up in some of our query stats profiles while investigating perf changes caused by SERVER-79736. I don't think there's any reason we need to go into "Date_t::now()" to populate this variable. Definitely we shouldn't need to for the purposes of reporting query stats. But also in general we may be able to share a clock read from the CurOp object or something rather than re-read the clock which can involve a mutex for a VectorClock.

      Specifically in cmd_with_let_shape.cpp in makeDummyExpCtx, it ends up calling generateRuntimeConstants in variables.cpp where it takes the VectorClock mutex. Actually, this is the path as of SERVER-79736, looks like it has changed since then but I assume its doing something similar. 

            Assignee:
            charlie.swanson@mongodb.com Charlie Swanson
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: