Add Siphon ClickHouse replica for the prevented packages ledger
What does this MR do and why?
Part 3 of 5. It adds the ClickHouse side of the prevented-packages ledger, so the dashboard can eventually read from a replica instead of Postgres. Part 1 has merged — both the table (!253941 (merged)) and the model (!255353 (merged)) — so nothing blocks this now. The branch has been rebased onto master and carries only the ClickHouse artifacts: 3 commits, 8 files, no application Ruby and no db/structure.sql change. It previously carried Part 1's commits as well, which is what the conflict flag was. Still mergeable in parallel with Part 2.
The migrations and schema artifacts are generated output from rails generate gitlab:click_house:siphon dependency_firewall_prevented_packages --with-traversal-path. Two migrations create siphon_dependency_firewall_prevented_packages (a ReplacingMergeTree keyed on _siphon_replicated_at/_siphon_deleted, primary key (traversal_path, id)) and its companion table ordered by the Postgres primary key, plus the db/siphon/tables YAML, the ClickHouse schema dump, schema cache entries and schema_migrations markers.
One edit is not generated, and it is the thing to look at first: db/click_house/main.sql carries a hand-inserted hunk adding siphon_dependency_firewall_prevented_packages_pg_pkey_ordered_mv. The generated dump captured only the two CREATE TABLE statements and left out the materialized view that the 20260904105331 migration creates. clickhouse:check-schema compares the dump against a migrated database and is not allowed to fail, so this would have blocked the pipeline. The view sits at the alphabetical position the dump generator emits, so regenerating the dump produces no further change for this table.
Nothing reads from this table yet; query-time deduplication of versioned rows is Part 4's job. Getting the table actually replicating in a live ClickHouse cluster needs coordination with the ClickHouse Datastore group, and that has to happen before Part 4's read flag (dependency_firewall_clickhouse_reads) can be enabled anywhere.
Work item: gitlab-org/gitlab#627538
References
How to set up and validate locally
- Run
bundle exec rake gitlab:clickhouse:migrate. - Confirm all three objects exist in the
gitlab_clickhouse_developmentdatabase: the two tables and the_mvmaterialized view, with the expected columns, engine and primary key. - Run
bundle exec rspec spec/db/clickhouse_siphon_tables_spec.rb. It passes, 80 examples. - Regenerate the dump with
bundle exec rake gitlab:clickhouse:schema:dumpand confirm nothing further changes for this table. Caveat: a local ClickHouse on a different version from CI's produces unrelated cosmetic churn in other teams' tables in that file, such asORDER BY idrendered asORDER BY (id). That should not be committed. - The replicated column set matches the merged Postgres table: all 10 columns, with
Nullableonly onlast_blocked_at,last_warned_atandseverity.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
- I have evaluated the MR acceptance checklist for this MR.