Merge lp:~jtv/launchpad/bug-602333 into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Robert Collins |
Approved revision: | no longer in the source branch. |
Merged at revision: | 11161 |
Proposed branch: | lp:~jtv/launchpad/bug-602333 |
Merge into: | lp:launchpad |
Diff against target: |
321 lines (+116/-50) 4 files modified
lib/lp/code/model/branch.py (+41/-24) lib/lp/code/model/tests/test_branch.py (+56/-20) lib/lp/translations/interfaces/translationtemplatesbuildjob.py (+3/-0) lib/lp/translations/model/translationtemplatesbuildjob.py (+16/-6) |
To merge this branch: | bzr merge lp:~jtv/launchpad/bug-602333 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robert Collins (community) | Approve | ||
Launchpad code reviewers | code | Pending | |
Review via email: mp+30195@code.launchpad.net |
Commit message
Delete BuildQueue entries for BranchJobs on any Branch being deleted.
Description of the change
= Bug 602333 =
Deleting branches can fail because of foreign-key constraints in the buildfarm classes. It may be best to read the bug comments before reviewing this.
A branch can have BranchJobs attached. The references look like this:
Branch <- BranchJob -> Job
Branch deletion breaks the foreign-key constraint by deleting the Job; the schema is set up to let that deletion cascade to BranchJob.
One type of BranchJob is TranslationTemp
Branch <- BranchJob -> Job <- BuildQueue
The reference from BuildQueue to Job does not cascade deletions, so the Job cannot be deleted as long as the BuildQueue exists. Nor would it be reasonable to make it cascade, since BuildQueue in the general case has no connection to any BranchJob that might be deleted in this way. It's a peculiarity of TranslationTemp
After discussion with Aaron and Jono, I fixed this in a manner that's consistent with how the tie between Branch and BranchJob is broken: delete any BuildQueue entries straight from the database before deleting the Jobs.
Test:
{{{
./bin/test -vvc -m lp.code.
}}}
You'll also see some drive-by lint cleanups. And I moved two tests that were clearly in the wrong test case.
Jeroen