Skip to content

Remove additional vulnerability finding links

What does this MR do and why?

This MR removes all rows from the vulnerability_finding_links table. This is a step in fixing the bug where multiple links were created for the same finding. Subsequent tasks include adding a unique index and repopulating the table from raw metadata stored for the finding. This background migration needs to be run a second time, as a change in code from when the previous migration was in review caused data to be written to the table again (previous MR).

Screenshots or screen recordings

Query Plans
SELECT "vulnerability_finding_links"."id" FROM "vulnerability_finding_links" ORDER BY "vulnerability_finding_links"."id" ASC LIMIT 1;
https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/7304/commands/26004

SELECT "vulnerability_finding_links"."id" FROM "vulnerability_finding_links" WHERE "vulnerability_finding_links"."id" >= 1 ORDER BY "vulnerability_finding_links"."id" ASC LIMIT 1 OFFSET 50000;
https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/7304/commands/26005

SELECT MIN("vulnerability_finding_links"."id"), MAX("vulnerability_finding_links"."id") FROM "vulnerability_finding_links" WHERE "vulnerability_finding_links"."id" >= 1 AND "vulnerability_finding_links"."id" < 58493;
https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/7304/commands/26007

DELETE FROM vulnerability_finding_links WHERE id BETWEEN 1 AND 58493;
https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/7304/commands/26011

SELECT MIN("vulnerability_finding_links"."id"), MAX("vulnerability_finding_links"."id") FROM "vulnerability_finding_links" WHERE "vulnerability_finding_links"."id" >= 96922167
https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/7304/commands/26009

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

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

Related to #330882 (closed)

Merge request reports

Loading