IntegrityError: update or delete on table "job" violates foreign key constraint "buildqueue__job__fk" on table "buildqueue"

Bug #602333 reported by Paul Hummer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Jeroen T. Vermeulen

Bug Description

See OOPS-1648ED2488 - I think this was caused by my deletion work. I'll land this prior to landing the Administrative UI so that it's all ready when the UI is available.x

Related branches

Curtis Hovey (sinzui)
Changed in launchpad-code:
milestone: 10.07 → 10.08
Revision history for this message
Paul Hummer (rockstar) wrote :

After spending a week trying to figure out WTF is going on, and fixing a menagerie of bugs around this, I have determined that this is actually a translations bug.

Changed in launchpad-code:
status: In Progress → New
importance: High → Undecided
assignee: Paul Hummer (rockstar) → nobody
affects: launchpad-code → rosetta
Changed in rosetta:
milestone: 10.08 → none
tags: removed: recipe
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

The root problem is that Branch removes BranchJobs in the database, whereas TranslationTemplatesBuildJob (which is backed by the BranchJob table) expects to be cleaned up through destroySelf calls that let it clean up the associated BuildQueue. This is a reasonable optimization since we have had performance problems when deleting branches in the past. The job records stick around indefinitely after completion, so a branch may have accumulated too many to process individually python-side. BuildQueue records are deleted after completion, which is why the problem isn't always visible.

TranslationTemplatesBuildJob is part of two class families (branch jobs and build-farm jobs) that impose conflicting requirements. BranchJob has a cascading delete on its foreign key to Job, which means that objects backed by BranchJob rows are required to support direct deletion. BuildQueue on the other hand expects to be deleted before the Job goes, through a destroySelf on the TranslationTemplatesBuildJob. It would not be reasonable to make Job deletions cascade to BuildQueue just to support this one case.

I'm attaching a branch that fixes this by having branch deletion clean up attached BuildQueue records first.

Changed in rosetta:
status: New → In Progress
assignee: nobody → Jeroen T. Vermeulen (jtv)
importance: Undecided → High
milestone: none → 10.08
Revision history for this message
Launchpad QA Bot (lpqabot) wrote : Bug fixed by a commit
tags: added: qa-needstesting
Changed in rosetta:
status: In Progress → Fix Committed
tags: added: qa-ok
removed: qa-needstesting
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.