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

Add sleeps to session_test.cpp to account for discrepancy between curTimeMicros and Date_t clock sources [v4.0]

    XMLWordPrintable

Details

    • Task
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 4.0.14
    • Replication
    • None
    • Fully Compatible
    • Repl 2019-11-18
    • 12

    Description

      In the "ReportStashedState" and "ReportUnstashedState" unit tests inside session_test.cpp, startWallClockTime value may not be strictly greater than or equal to startTime since the former is measured using curTimeMicros64() and the latter using Date_t::now() which use different clock sources. If the "real" (i.e. absolute) time is, for example, 4.6 milliseconds, then curTimeMicros64() may return 4600, but we would round it down to 4 milliseconds. At the same time, Date_t::now() may return 5 milliseconds, since it is lower precision. So, we may see startTime actually be greater than startWallClockTime. This is just a discrepancy in the unit tests, and not important for how we track these stats in a real system. To prevent this issue in the tests, we can add artificial sleeps to the unit tests after we record startTime but before we record the startWallClockTime value.

      Attachments

        Issue Links

          Activity

            People

              william.schultz@mongodb.com William Schultz (Inactive)
              william.schultz@mongodb.com William Schultz (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: