The ci_finished_builds ClickHouse table contains records where started_at > finished_at
We have records in ci_finished_builds
where the started_at
field contains a more recent value than finished_at
:
This happens due to the fact that the corresponding records in ci_builds
have a NULL started_at
value, and the started_at
defaults to now()
in the CH ci_finished_builds
table. Looking closer to the ci_builds
table, we can see that most of the situations where status = "failed"
comprise a failure_reason
of ci_quota_exceeded
or protected_environment_failure
:
There are some cases where status = "success"
, but those seem to be anomalies dating back to 2018.
Proposed solution
- Drop records where
started_at > finished_at
- Make
started_at
default to 0 - Filter out such values from the materialized views
- (Optional) Filter out records with an integer seconds component of
started_at
(an artifact that we default tonow()
instead ofnow64()
). - (Optional) Start capturing
failure_reason
inci_finished_builds