-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: TestStatusAPICombinedStatements is flaky #69533
Description
It's happening on master. https://teamcity.cockroachdb.com/viewLog.html?buildId=3376012&tab=buildResultsDiv&buildTypeId=Cockroach_UnitTests_Test
My guess is it probably come from here. It's likely a time-related race condition.
In-memory stats gets assigned aggregated_ts when it's returned from the iterator API. The timestamp for in-memory is generated by truncating the current timestamp to nearest hour.
So concretely, suppose we insert stats at 15:43, it will have aggregated_ts = 15:00. If we issue a read with read timestamp at 16:00, and the in-memory stats is not yet flushed to disk, the in-memory stats with be returned with aggregated_ts = 16:00. Hence the test failure.
Solution here would be use the existing testing knobs in SQL stats to stub out the call to timeutil.Now() function to make sure the test is 100% deterministic.