Skip to content

Fix deadlock in migration by splitting it up in two

Administrator requested to merge mrn+es/fix-migration-deadlock into main

Created by: mrnugget

This fixes the migration introduced in #40899 by splitting it up into two.

As a single migration the previous version would crash with a deadlock when trying to drop the 2nd trigger with

DROP TRIGGER IF EXISTS trig_recalc_gitserver_repos_statistics_on_update ON gitserver_repos;

We could replicate this in a production database console.

Splitting up the recreation of the two triggers into two transactions avoids the deadlock.

Test plan

  • Ran migrations on production to confirm

Merge request reports

Loading