Merge lp:~jtv/launchpad/bug-884649-branch-4 into lp:launchpad
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 14256 | ||||
Proposed branch: | lp:~jtv/launchpad/bug-884649-branch-4 | ||||
Merge into: | lp:launchpad | ||||
Diff against target: | 0 lines | ||||
To merge this branch: | bzr merge lp:~jtv/launchpad/bug-884649-branch-4 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Brad Crittenden (community) | code | Approve | |
Review via email: mp+81265@code.launchpad.net |
Commit message
Speed up 2nd-pass binary domination through caching.
Description of the change
= Summary =
The second pass of binary package domination has been taking far too long. It repeatedly queried for active architecture-
Generally, the query will be repeated for the same source package release across all architectures, with (after some other branches I landed for this bug) the same answer every time.
== Proposed fix ==
This branch picks the fruit from the tree planted and watered in the preceding branches for the same bug. It caches the result of that repetitive query between iterations.
== Pre-implementation notes ==
See the notes on bug 884649 for the plan we're following here. A few more low-risk optimizations remain to be added after this branch, if necessary:
* More bulk-loading of references to BinaryPackageBuild, SourcePackageRe
* As Raphaël suggested: use BinaryPackagePu
== Implementation details ==
It might have been possible to pre-populate the entire cache in one huge query. Surprisingly, memory footprint is probably not a limiting factor there. But now that the second domination pass skips packages where it's known that it won't do any good, it might be costly to figure out in advance exactly for which SourcePackageRe
I replaced BinaryPackagePu
== Tests ==
{{{
./bin/test -vvc lp.archivepubli
./bin/test -vvc lp.soyuz.
./bin/test -vvc lp.soyuz.
}}}
== Demo and Q/A ==
Upload & process a few revisions of a source package with both arch-specific and arch-independent binary packages. Maybe some pure arch-specific and arch-indep ones as well.
Sabotage a binary package for one architecture: reset the BPPH for one of the arch-specific binary packages (from a mixed source package) to Pending.
Run the dominator.
See that it functioned normally:
* Of the architecture-
* For the architecture you “sabotaged,” the last Published BPPH stays Published and the Pending one stays Pending.
* Architecture-
In other words, there should be two live versions of that arch-indep binary package. Its other releases should be superseded as normal though.
= Launchpad lint =
One pre-existing lint item that seems to be just cleverness confusing the linter. I'm not touching it.
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
./lib/lp/
204: redefinition of function 'copyright' from line 195
Hi Jeroen,
Lots of optimization here -- I know that warms your innards.
* I'm a little confused by find_live_ source_ version and find_live_ binary_ version_ pass_1. Both take an iterable called 'sorted_pubs'. In the former the "latest" is element [0] and in the later it is [-1] even though the comments say they are both sorted in descending order. Is that notion of "latest" really different?
* "This class looks up whether there are any." Could you complete that thought?
* I like your ArchSpecificPub licationsCache. I'm a bit (paranoidly) worried about the fragility of the order of elements returned by getKey and those expected by _lookUp ... but can't think of anything smart to suggest.
In find_live_ binary_ version_ pass_2 how long do you expect the sorted_pubs list to be? Would it be reasonable to use set-based methods to determine arch_indep_pubs after you already figured out arch_specific_pubs? BTW, I should pay more attention to itertools -- I learned about ifilter* from this review. Thanks!
* In test_hasArchSpe cificPublicatio ns_is_consisten t_and_correct, I don't understand the value of testing each entry in the cache twice.
Otherwise it looks good. Thanks.