[SERVER-40166] Force BG clock now == Date_t::lastNow Created: 15/Mar/19  Updated: 29/Oct/23  Resolved: 21/Mar/19

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 4.1.10, 4.0.10

Type: New Feature Priority: Major - P3
Reporter: Mira Carey Assignee: Mira Carey
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
related to SERVER-40165 generate wtimeout deadlines with the ... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.0
Sprint: Service Arch 2019-03-25
Participants:
Linked BF Score: 8

 Description   

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



 Comments   
Comment by Githook User [ 19/Apr/19 ]

Author:

{'email': 'jcarey@argv.me', 'name': 'Jason Carey', 'username': 'hanumantmk'}

Message: SERVER-40166 Force BG clock now >= Date_t::lastNow

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

(cherry picked from commit d32ddac33c48b5e2d2885c2862d6abd88e7f26d2)
Branch: v4.0
https://github.com/mongodb/mongo/commit/43fb7ff820793bcc94e160133cc1dacd12bec1c8

Comment by Githook User [ 21/Mar/19 ]

Author:

{'name': 'Jason Carey', 'username': 'hanumantmk', 'email': 'jcarey@argv.me'}

Message: SERVER-40166 Force BG clock now >= Date_t::lastNow

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
Branch: master
https://github.com/mongodb/mongo/commit/d32ddac33c48b5e2d2885c2862d6abd88e7f26d2

Generated at Thu Feb 08 04:54:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.