Skip to content

Backfill vulnerabilities.finding_id column

What does this MR do and why?

This MR schedules a batched background migration to backfill the vulnerabilities.finding_id column in attempt to create a proper 1:1 relationship between records in vulnerabilities and vulnerability_occurrences tables.

See &11030 (closed) for a high level overview

Related to #418971 (closed)

Database review

Query plan

UPDATE vulnerabilities
SET finding_id = vulnerability_occurrences.id
FROM vulnerability_occurrences
WHERE vulnerabilities.id IN (<100 ids here>)
AND vulnerabilities.id = vulnerability_occurrences.vulnerability_id

Cold cache: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/21644/commands/70316

Warm cache: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/21644/commands/70317

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Michał Zając

Merge request reports