Unique violation on POFileTranslator while merging TranslationMessages

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

Bug Description

The mv_pofiletranslator_translationmessage trigger function violates pofiletranslator__person__pofile__key while inserting into POFileTranslator in the "IF v_trash_old" section.

Full traceback: https://pastebin.canonical.com/17552/

This most likely happens because we don't remove all relevant pofiletranslator records when removing a translationmessage (select into v_old_entry seems to fetch a set of ids, but it doesn't: we should fix this).

Changed in rosetta:
importance: Undecided → High
status: New → Triaged
Changed in rosetta:
assignee: nobody → Jeroen T. Vermeulen (jtv)
milestone: none → 2.2.5
status: Triaged → In Progress
description: updated
tags: added: message-sharing
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

One thing that will go wrong is the deletion of the old POFileTranslator message. In the function, v_old_entry is the id of one POFileTranslator row referring to the TranslationMessage that's being changed. ("SELECT INTO" in the stored-procedure language uses the first result row and ignores the rest). But with message sharing there can be multiple POFileTranslator rows referring to that TranslationMessage.

A solution for that one would be to do only a "SELECT EXISTS" to check if there is a matching POFileTranslator row, and then make the DELETE match directly on latest_message = OLD.id instead of using an intermediate variable.

Revision history for this message
Данило Шеган (danilo) wrote :

I've got a branch ready to fix this. Putting up for review.

Changed in rosetta:
assignee: Jeroen T. Vermeulen (jtv) → Данило Шеган (danilo)
Revision history for this message
Данило Шеган (danilo) wrote :

Fixed in db-devel 8083. We'll need this in before we remove any TranslationMessages or we'll end up with bad data in POFileTranslator as well, or we'll hit constraints when trying to remove them.

Changed in rosetta:
status: In Progress → Fix Committed
Changed in rosetta:
status: Fix Committed → Fix Released
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

The fix has unmasked a different problem with the exact same symptom. See bug 382658.

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.