Background migration removing vuln finding links
requested to merge 330882-dependency-scanning-vulnerability-reports-a-lot-of-duplicate-links-clear-table into master
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.
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.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #330882 (closed)
Edited by Jonathan Schafer