Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The WAL failover monitor tracks the duration spent writing to the primary and secondary WAL directories. Previously it was possible for updates to these durations to be negative (despite implicitly using the time.Time's monotonic time), because the time was retrieved before acquiring the mutex guarding the accumulated durations. A goroutine that measured the current time first was not necessarily the first to enter the critical section and update the monitor's lastAccumulateIntoDurations field. This commit moves these time measurements under the mutex and adds an assertion that the monitor's understanding of time moves monotonically forward. Informs cockroachdb/cockroach#136317.
- Loading branch information