[SERVER-47897] CurOp should use monotonic clock source for duration measurements Created: 01/May/20 Updated: 29/Oct/23 Resolved: 11/Jun/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 4.7.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Nicholas Zolnierz | Assignee: | James Wahlin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | greenerbuild, qopt-team | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Operating System: | ALL | ||||||||||||
| Participants: | |||||||||||||
| Linked BF Score: | 16 | ||||||||||||
| Description |
|
In several spots, curOp uses curTimeMicros64 which delegates to gettimeofday() on linux. This is not guaranteed to be monotonically increasing and can lead to incorrect reporting for metrics. |
| Comments |
| Comment by Githook User [ 10/Jun/20 ] |
|
Author: {'name': 'James Wahlin', 'email': 'james@mongodb.com', 'username': 'jameswahlin'}Message: |
| Comment by James Wahlin [ 11/May/20 ] |
|
As part of this work, we should consider adding back this invariant which will be removed under |
| Comment by James Wahlin [ 08/May/20 ] |
|
Using SystemTickSource appears to be the right solution for duration measurement. It uses a monotonic clock to record points in time and is unaffected by NTP time adjustments so safer for comparison. It can provide the microsecond granularity that the current curTimeMicros64() call provides. |