[19.2] Remove project_id FKs from two Geo verification state tables

What does this MR do and why?

Backport of !247719 (merged) to 19.2.

Removes the hard project_id foreign keys from packages_nuget_symbol_states (fk_3e841eeb5d) and packages_package_file_states (fk_e568054097).

Both columns are sharding keys copied from a parent row — by a BackfillDesiredShardingKeyJob, then on every insert and update by the sharding-key sync triggers. A hard FK on a copied value can only be as safe as the parent's own reference to projects, and packages_nuget_symbols has neither a foreign key nor a loose foreign key to projects. Deleting a project hard-cascades packages_packages away and fk_rails_5df972da14 nulls the symbol's package_id, but the symbol row survives holding a dangling project_id until Packages::Nuget::CleanupStaleSymbolsWorker destroys it.

This is the same failure mode that caused the professional_teal_sparrow Sev1 (incident review) via packages_helm_metadata_cache_states, which was backported to 19.0, 19.1 and 19.2 in !246366 (merged), !246367 (merged) and !246416 (merged).

Row cleanup is unaffected: both state tables are cleaned up by loose foreign keys on their parents (async_delete on packages_nuget_symbol_id and package_file_id), and both parents carry *_loose_fk_trigger delete-tracking triggers, so a state row is removed when its parent goes. The IS NOT NULL check constraints are unchanged.

The finalize migrations that copy that value into the hard-FK'd column shipped in 19.0, so an instance already on 19.2 has run them. This backport removes the contradictory foreign key so the sharding-key sync triggers cannot reintroduce a violation on insert or update, and so the child constraint no longer contradicts its parent. The upgrade-aborting case itself is fixed by the 19.0 backport.

Resolves #606941 for 19.2.

MR acceptance checklist

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

  • This MR is backporting a bug fix, documentation update, or spec fix, previously merged in the default branch.
  • The MR that fixed the bug on the default branch has been deployed to GitLab.com (not applicable for documentation or spec changes).
  • The MR title is descriptive (e.g. "Backport of 'title of default branch MR'"). This is important, since the title will be copied to the patch blog post.
  • Required labels have been applied to this merge request
  • This MR has been approved by a maintainer (only one approval is required).
  • Ensure the e2e:test-on-omnibus-ee job has succeeded, or if it has failed, investigate the failures. If you determine the failures are unrelated, you may proceed. If you need assistance investigating, request help in the #s_developer_experience Slack channel to confirm the failures are unrelated to the merge request.

Note to the merge request author and maintainer

If you have questions about the patch release process, please:

Edited by Douglas Barbosa Alexandre

Merge request reports

Loading