Add version, deleted columns to ci_finished_builds CH table

What does this MR do and why?

  • Add version and deleted columns to ci_finished_builds table

These ⬇️ will be handled in the next MR

  • Update ReplacingMergeTree engine configuration to use (version, deleted) parameters for proper deduplication
  • Engine settings cannot be changed as a meta update in ClickHouse, so we have to create a tmp table, attach the partitions to the new tmp table, and exchange the table names with no latency.

Reference:

#580441 (comment 2959651447)

How to set up and validate locally

To setup clickhouse: https://docs.gitlab.com/development/database/clickhouse/clickhouse_within_gitlab/

  • Run migration up:
bundle exec rake gitlab:clickhouse:migrate
  • open clickhouse console:
gdk clickhouse
  • Run this in clickhouse console and verify if the columns are present:
USE gitlab_clickhouse_development;

SHOW CREATE TABLE ci_finished_builds;
  • Run migration down:
bundle exec rake gitlab:clickhouse:rollback:main STEP=1
  • Run this in clichouse console and verify the columns are dropped:
SHOW CREATE TABLE ci_finished_builds;

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Narendran

Merge request reports

Loading