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

admin/sql/updates/20220720-mbs-12508.sh produces ERROR: duplicate key

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • None
    • None
    • Database setup, Scripts
    • None

      at:

      https://github.com/metabrainz/musicbrainz-docker/releases/tag/v-2022-08-08

      git checkout v-2022-08-08

      ...

      sudo docker-compose exec musicbrainz ./admin/sql/updates/20220720-mbs-12508.sh

      produces:

      ...

      Fri 19 Aug 2022 10:38:35 PM UTC: Restoring saved tag data from tmp tables
          ...
          ERROR:  duplicate key value violates unique constraint "tag_idx_name"
          DETAIL:  Key (name)=(abdullah al maruf) already exists.
          rmdir: failed to remove '/tmp/mbscript-HpL8vQCE': Directory not empty

      And replication fails:

          'INSERT INTO "musicbrainz"."recording_meta" ("id", "rating", "rating_count") VALUES (?, ?, ?)'
          (32856769  )
      23505 DBD::Pg::st execute failed: ERROR:  duplicate key value violates unique constraint "recording_meta_pkey"
      DETAIL:  Key (id)=(32856769) already exists. [for Statement "INSERT INTO "musicbrainz"."recording_meta" ("id", "rating", "rating_count") VALUES (?, ?, ?)" with ParamValues: 1='32856769', 2=undef, 3=undef]
       at /musicbrainz-server/admin/replication/../../lib/Sql.pm line 116.
          Sql::catch {...} (MusicBrainz::Server::Exceptions::DatabaseError=HASH(0x56464e537d70)) called at /root/perl5/lib/perl5/Try/Tiny.pm line 123
          Try::Tiny::try(CODE(0x56464e5463b0), Try::Tiny::Catch=REF(0x56464e53ffc8)) called at /musicbrainz-server/admin/replication/../../lib/Sql.pm line 117
          Sql::do(Sql=HASH(0x56464e3dbfa0), "INSERT INTO \"musicbrainz\".\"recording_meta\" (\"id\", \"rating\", \""..., 32856769, undef, undef) called at /musicbrainz-server/admin/replication/ProcessReplicationChanges line 332
          main::mirrorInsert(Sql=HASH(0x56464e0a9f18), Sql=HASH(0x56464e3dbfa0), ARRAY(0x56464dfa9a40), 1234353948) called at /musicbrainz-server/admin/replication/ProcessReplicationChanges line 269
          main::mirrorCommand("i", Sql=HASH(0x56464e0a9f18), Sql=HASH(0x56464e3dbfa0), ARRAY(0x56464dfa9a40), 1234353948, CODE(0x56464e546068)) called at /musicbrainz-server/admin/replication/ProcessReplicationChanges line 178

      My database is borked.  How to recover?

            bitmap Michael Wiencek
            wolfram.alpha Stewart Dickson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                Version Package