Unique constraint violation in importer

Bug #373139 reported by Jeroen T. Vermeulen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Critical
Данило Шеган

Bug Description

The importer has been failing one file with this error:

2009-05-06 19:54:08 ERROR Got an unexpected exception while importing English (United Kingdom) (en_GB) translation of avogadro in Avogadro trunk
 -> http://launchpadlibrarian.net/26406514/zz6q7eI41bJTVGCqmBC5t3j4kpR.txt (duplicate key value violates unique constraint "tm__potmsgset__language__no_variant__shared__current__key"
)

Full traceback saved for posterity here: https://pastebin.canonical.com/17297/

This appears to be the failing file: https://pastebin.canonical.com/17296/

description: updated
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

What I don't understand is how this unique constraint could have triggered given that, in our current schema as I see it, this unique constraint includes variant even though variant is null.

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

No, no, no, I misread. This is not one of the broken constraints of bug 373151. This is another one, without potemplate (so this one is for shared messages). The broken constraints are for diverged messages, so they include potemplate.

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

After some joint bug-hunting with Danilo, the conclusion is that POTMsgSet.updateTranslation sets matching_message.potemplate after possibly setting is_current. That means that the is_current validator is run (and unsets a previously current message) against existing current messages for the _old_ potemplate value.

When we set is_imported afterwards, that validator tries to flush the intermediate state to the database in order to perform its check, and runs into the unique constraint.

The fix is to set matching_message.potemplate earlier. But we must still be careful when we do that: the pre-existing current/imported flags on the message could also cause this kind of conflict.

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Danilo and I have been looking into this.

Changed in rosetta:
importance: Undecided → Critical
milestone: none → 2.2.5
status: New → Triaged
status: Triaged → In Progress
summary: - Unique violation in importer
+ Unique constraint violation in importer
Changed in rosetta:
assignee: nobody → Данило Шеган (danilo)
tags: added: message-sharing
Revision history for this message
Данило Шеган (danilo) wrote :

Fixed in devel 8430.

Changed in rosetta:
status: In Progress → Fix Committed
Revision history for this message
Данило Шеган (danilo) wrote :

Cherry-picked on Friday.

Changed in rosetta:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.