Uploaded image for project: 'MusicBrainz Server'
  1. MusicBrainz Server
  2. MBS-11896

Remove the unique_primary_for_locale triggers and associated functions

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Normal Normal
    • 2021-10-04
    • None
    • Schema Change
    • None

      These triggers ensure that if an alias is set to primary_for_locale = true, we unset primary_for_locale on all other aliases for that locale & entity to avoid uniqueness violations on the *_alias_idx_primary index.

      There's a major problem here: cascading triggers do not mix well with dbmirror, and can break replication. This is because when row-level AFTER triggers are cascaded, the innermost recordchange trigger is run first (inverse of the actual statement order). This is exactly what caused MBS-9366, and is a very hard problem to fix in dbmirror properly; it's much safer to outright ban cascading updates on replicated tables.

      Even ignoring the replication issue, we don't need these triggers. Avoiding duplicate primary locales can be handled by the application (and already is). If it wasn't, it even seems better to have the application fail with a unique index violation (since that indicates it's not accounting the changes properly) than silently change the data.

            reosarevok Nicolás Tamargo
            bitmap Michael Wiencek
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package
                2021-10-04