-
Bug
-
Resolution: Fixed
-
Normal
-
None
-
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': '
', '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.