Uploaded image for project: 'ListenBrainz'
  1. ListenBrainz
  2. LB-42

MessyBrainz transaction problem with duplicate items

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • None
    • MessyBrainz
    • None

      We're seeing an error adding some data to MessyBrainz

      IntegrityError: (psycopg2.IntegrityError) duplicate key value violates unique constraint "data_sha256_ndx_recording_json"
      DETAIL: Key (data_sha256)=(914270aaec6a29f3362ad9d2e42eac73f5a441fcad82d8f63c758a6cd7e98ae9) already exists.
      [SQL: 'INSERT INTO recording_json (data, data_sha256, meta_sha256)\n VALUES (%(data)s, %(data_sha256)s, %(meta_sha256)s)\n RETURNING id'] [parameters: {'meta_sha256': '23ad84d76fb9032303703d930ea9a994a2fa4e6144442c393cb55c1b198a3a59', 'data': '

      {"artist":"Everything But the Girl","spotify_id":"http://open.spotify.com/track/29QX3OUpMxOi0eUFbOenRI","title":"Twin Cities"}

      ', 'data_sha256': '914270aaec6a29f3362ad9d2e42eac73f5a441fcad82d8f63c758a6cd7e98ae9'}]

      My thoughts are that we're still not handling transactions correctly, and we're trying to insert the same data twice. We need to wrap the code for a single insert in a manual transaction (instead of using flask-sqlalchemy's auto-transaction code) and see if this fixes it.

            alastairp Alastair Porter
            alastairp Alastair Porter
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package