[SERVER-43695] Add sleeps to session_test.cpp to account for discrepancy between curTimeMicros and Date_t clock sources [v4.0] Created: 27/Sep/19 Updated: 29/Oct/23 Resolved: 12/Nov/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Replication |
| Affects Version/s: | None |
| Fix Version/s: | 4.0.14 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | William Schultz (Inactive) | Assignee: | William Schultz (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Sprint: | Repl 2019-11-18 | ||||||||||||
| Participants: | |||||||||||||
| Linked BF Score: | 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. |
| Comments |
| Comment by Githook User [ 11/Nov/19 ] |
|
Author: {'username': 'will62794', 'email': 'william.schultz@mongodb.com', 'name': 'William Schultz'}Message: |