ServerStatus needs initializer[s].

XMLWordPrintableJSON

    • Server Programmability
    • Fully Compatible
    • ALL
    • Service Arch 2021-10-04
    • 30
    • 2
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The ServerStatus command implementation has two variables here that are evaluated upon every run. _started is const so it cannot race but it is set pre-main which isn't quite right. _runCalled however is called upon first run(). Unfortunately, run() has no synchronization guarantees.

      So we should replace _runCalled with _sectionsLocked, make a MONGO_INITIALIZER to set _sectionsLocked, and use invariant instead of verify here.

      It's probably also worthwhile to move _started to be a ServiceContext Decoration+ConstructorAction. It is currently records a time before main(). Instead, it should record a time after main() after the ServiceContext used with ServerStatus is constructed.

       

      Acceptance criteria:

      Update the ServerStatus command so that updating the _runCalled data member is not racy.

            Assignee:
            Unassigned
            Reporter:
            Benjamin Caimano (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: