Default ci_finished_builds timestamps to zero
What does this MR do and why?
This MR adds clickhouse migrations to default ci_finished_builds
timestamps to zero, and change the materialized columns to default to zero, if the values become negative, or started_at
is NULL in PG.
Closes #436960 (closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Demo data from prod:
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
Run bundle exec rake gitlab:clickhouse:migrate:main
> INSERT INTO ci_finished_builds (id, finished_at) VALUES (9999999, '2023-01-01')
> SELECT id, created_at, queued_at, started_at, finished_at, duration, queueing_duration FROM ci_finished_builds FINAL WHERE id = 9999999
┌──────id─┬─────────────────created_at─┬──────────────────queued_at─┬─────────────────started_at─┬────────────────finished_at─┬─duration─┬─queueing_duration─┐
│ 9999999 │ 1970-01-01 00:00:00.000000 │ 1970-01-01 00:00:00.000000 │ 1970-01-01 00:00:00.000000 │ 2023-01-01 00:00:00.000000 │ 0 │ 0 │
└─────────┴────────────────────────────┴────────────────────────────┴────────────────────────────┴────────────────────────────┴──────────┴───────────────────┘