Skip to content

Synchronously validate `finding_id` FK on vulnerabilities

What does this MR do and why?

The foreign key was validated asynchronously in MR 131979

This commit is the async followup per the documentation

resolves: #425409 (closed)


Changelog: changed
EE: true

MR acceptance checklist

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

Screenshots or screen recordings

verifying async finished

  1. on postgres.ai, running \d+ vulnerabilities indicates the FK is valid:
  2. The MR widget from async MR shows Deployed to db/‎gprd‎ Dec 28, 2023, 3:55 AM
  3. chatops also shows it on db/gprd
MR widget from async migration \d+ vulnerabilities /chatops run auto_deploy status 518dc47f7f11ec980ec7acf893b22c83520d0c42
image image image

migration output

bundle exec rails db:migrate
main: == [advisory_lock_connection] object_id: 182880, pg_backend_pid: 361338
main: == 20240102101409 ValidateFindingIdOnVulnerabilities: migrating ===============
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0003s
main: -- execute("ALTER TABLE vulnerabilities VALIDATE CONSTRAINT fk_4e64972902;")
main:    -> 0.0004s
main: -- execute("RESET statement_timeout")
main:    -> 0.0002s
main: == 20240102101409 ValidateFindingIdOnVulnerabilities: migrated (0.0275s) ======

main: == [advisory_lock_connection] object_id: 182880, pg_backend_pid: 361338
ci: == [advisory_lock_connection] object_id: 183120, pg_backend_pid: 361340
ci: == 20240102101409 ValidateFindingIdOnVulnerabilities: migrating ===============
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0003s
ci: -- execute("ALTER TABLE vulnerabilities VALIDATE CONSTRAINT fk_4e64972902;")
ci:    -> 0.0004s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0003s
ci: == 20240102101409 ValidateFindingIdOnVulnerabilities: migrated (0.0153s) ======

ci: == [advisory_lock_connection] object_id: 183120, pg_backend_pid: 361340
bundle exec rails db:rollback:main
main: == [advisory_lock_connection] object_id: 182360, pg_backend_pid: 360456
main: == 20240102101409 ValidateFindingIdOnVulnerabilities: reverting ===============
main: == 20240102101409 ValidateFindingIdOnVulnerabilities: reverted (0.0031s) ======

main: == [advisory_lock_connection] object_id: 182360, pg_backend_pid: 360456
bundle exec rails db:rollback:ci
ci: == [advisory_lock_connection] object_id: 182320, pg_backend_pid: 360889
ci: == 20240102101409 ValidateFindingIdOnVulnerabilities: reverting ===============
ci: == 20240102101409 ValidateFindingIdOnVulnerabilities: reverted (0.0086s) ======

ci: == [advisory_lock_connection] object_id: 182320, pg_backend_pid: 360889

Related to #425409 (closed)

Edited by Michael Becker

Merge request reports

Loading