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

Force BG clock now == Date_t::lastNow

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.10, 4.0.10
    • Affects Version/s: None
    • Component/s: Internal Code
    • Labels:
    • Fully Compatible
    • v4.0
    • Service Arch 2019-03-25
    • 8

      Currently our fast clock is implemented by a background thread which wakes up every 10ms if callers continue to check it's time. If that background thread get's descheduled for a long time for some reason, this can cause the background threads time to drift substantially.

      If we:

      • force every read of date_t::now to update a new date_t::lastNow
      • change the background thread so that it's responsibility is to wake up and call Date_t::now() (if readers are still present)
      • change the background thread clock source now() to return date_t::lastNow

      We'll get a world in which we have the same target granularity + thread quiescence as before, but additionally ensure that even if the background thread can't be scheduled, that lastNow() will still be pushed loosely forward if there are callers of Date_t::now() elsewhere in the system. This should ensure a tighter bound on the spread between the precise and fast clock sources

            mira.carey@mongodb.com Mira Carey
            mira.carey@mongodb.com Mira Carey
            0 Vote for this issue
            1 Start watching this issue