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

artist_credit_gid_redirect blocks deleting artist credits

XMLWordPrintable

      We are seeing issues where an FK in artist_credit_gid_redirect is still there when trying to remove a supposedly empty artist credit (see below). This should never happen, since the redirect should have been moved to whatever the previous AC now redirects to, or otherwise it should be removed if the previous AC is removed without a redirect being set (not sure when this should happen, but maybe that's the issue here?).

      Sentry Issue: MUSICBRAINZ-SERVER-1G

      Sentry Issue 2: MUSICBRAINZ-SERVER-1G

      None: Failed query:
      	'UPDATE recording SET artist_credit = ? WHERE id = ?'
      	(3226492 29981264)
      23503 DBD::Pg::st execute failed: ERROR:  update or delete on table "artist_credit" violates foreign key constraint "artist_credit_gid_redirect_fk_new_id" on table "artist_credit_gid_redirect"
      DETAIL:  Key (id)=(3329863) is still referenced from table "artist_credit_gid_redirect".
      CONTEXT:  SQL statement "DELETE FROM artist_credit WHERE id = 3329863"
      PL/pgSQL function dec_ref_count(character varying,integer,integer) line 9 at EXECUTE
      SQL statement "SELECT dec_ref_count('artist_credit', OLD.artist_credit, 1)"
      PL/pgSQL function a_upd_recording() line 4 at PERFORM [for Statement "UPDATE recording SET artist_credit = ? WHERE id = ?" with ParamValues: 1='3226492', 2='29981264']
      
      	Sql::catch {...} (MusicBrainz::Server::Exceptions::DatabaseError=HASH(0x558d28ed5808)) called at /home/musicbrainz/carton-local/lib/perl5/Try/Tiny.pm line 123
      	Try::Tiny::try(CODE(0x558d28ed9030), Try::Tiny::Catch=REF(0x558d286cf1d8)) called at /home/musicbrainz/musicbrainz-server/admin/../lib/Sql.pm line 117
      	Sql::do(Sql=HASH(0x558d1f0a12c0), "UPDATE recording SET artist_credit = ? WHERE id = ?", 3226492, 29981264) called at /home/musicbrainz/musicbrainz-server/admin/../lib/Sql.pm line 203
      	Sql::update_row(Sql=HASH(0x558d1f0a12c0), "recording", HASH(0x558d1e9340b0), HASH(0x558d28eefdd8)) called at /home/musicbrainz/musicbrainz-server/admin/../lib/MusicBrainz/Server/Data/Recording.pm line 226
      	MusicBrainz::Server::Data::Recording::update(MusicBrainz::Server::Data::Recording=HASH(0x558d27a92bd0), 29981264, HASH(0x558d28ed5e68)) called at /home/musicbrainz/carton-local/lib/perl5/x86_64-linux-gnu-thread-multi/Class/MOP/Method/Wrapped.pm line 56
      	MusicBrainz::Server::Data::Recording::_wrapped_update(MusicBrainz::Server::Data::Recording=HASH(0x558d27a92bd0), 29981264, HASH(0x558d28ed5e68)) called at /home/musicbrainz/carton-local/lib/perl5/x86_64-linux-gnu-thread-multi/Class/MOP/Method/Wrapped.pm line 97
      	MusicBrainz::Server::Data::Recording::update(MusicBrainz::Server::Data::Recording=HASH(0x558d27a92bd0), 29981264, HASH(0x558d28ed5e68)) called at /home/musicbrainz/musicbrainz-server/admin/../lib/MusicBrainz/Server/Edit/Generic/Edit.pm line 91
      	MusicBrainz::Server::Edit::Generic::Edit::try {...} () called at /home/musicbrainz/carton-local/lib/perl5/Try/Tiny.pm line 102
      	eval {...} called at /home/musicbrainz/carton-local/lib/perl5/Try/Tiny.pm line 93
      	Try::Tiny::try(CODE(0x558d28eef748), Try::Tiny::Catch=REF(0x558d28ed5718)) called at /home/musicbrainz/musicbrainz-server/admin/../lib/MusicBrainz/Server/Edit/Generic/Edit.pm line 109
      	MusicBrainz::Server::Edit::Generic::Edit::__ANON__(MusicBrainz::Server::Edit::Recording::Edit=HASH(0x558d28ee5b48)) called at /home/musicbrainz/carton-local/lib/perl5/x86_64-linux-gnu-thread-multi/Moose/Meta/Method/Overridden.pm line 38
      	MusicBrainz::Server::Edit::Generic::Edit::accept(MusicBrainz::Server::Edit::Recording::Edit=HASH(0x558d28ee5b48)) called at /home/musicbrainz/carton-local/lib/perl5/x86_64-linux-gnu-thread-multi/Class/MOP/Method/Wrapped.pm line 44
      	MusicBrainz::Server::Edit::Recording::Edit::_wrapped_accept(MusicBrainz::Server::Edit::Recording::Edit=HASH(0x558d28ee5b48)) called at /home/musicbrainz/carton-local/lib/perl5/x86_64-linux-gnu-thread-multi/Class/MOP/Method/Wrapped.pm line 97
      	MusicBrainz::Server::Edit::Recording::Edit::accept(MusicBrainz::Server::Edit::Recording::Edit=HASH(0x558d28ee5b48)) called at /home/musicbrainz/musicbrainz-server/admin/../lib/MusicBrainz/Server/Data/Edit.pm line 774
      	MusicBrainz::Server::Data::Edit::try {...} () called at /home/musicbrainz/carton-local/lib/perl5/Try/Tiny.pm line 100
      	eval {...} called at /home/musicbrainz/carton-local/lib/perl5/Try/Tiny.pm line 93
      	Try::Tiny::try(CODE(0x558d28ef1b60), Try::Tiny::Catch=REF(0x558d28ee5a40)) called at /home/musicbrainz/musicbrainz-server/admin/../lib/MusicBrainz/Server/Data/Edit.pm line 809
      	MusicBrainz::Server::Data::Edit::_do_accept(MusicBrainz::Server::Data::Edit=HASH(0x558d1f3f9008), MusicBrainz::Server::Edit::Recording::Edit=HASH(0x558d
        File "Carp.pm", line 291, in Carp::croak
          sub croak   { die shortmess @_ }
        File "Sql.pm", line 333, in Try::Tiny::try
          croak $err;
        File "Sql.pm", line 335, in Sql::_auto_transaction
          }
        File "Sql.pm", line 340, in Sql::_run_in_transaction_one
          return _auto_transaction($sub, $sql);
        File "Sql.pm", line 355, in Sql::run_in_transaction
          return _run_in_transaction_one($sub, $sql_1);
      ...
      (3 additional frame(s) were not displayed)
      

            reosarevok Nicolás Tamargo
            dev-sentry Dev through Sentry
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package
                2022-09-06