← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/launchpad/getBinariesForDomination-bulk into lp:launchpad

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/launchpad/getBinariesForDomination-bulk into lp:launchpad with lp:~jtv/launchpad/bug-884649-branch-1 as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #884649 in Launchpad itself: "Ubuntu publisher is taking more than an hour to complete"
  https://bugs.launchpad.net/launchpad/+bug/884649

For more details, see:
https://code.launchpad.net/~jtv/launchpad/getBinariesForDomination-bulk/+merge/81020

This is a little side-note to some Dominator optimization work I'm doing for bug 884649: bulk-fetch BinaryPackageReleases when querying for BinaryPackagePublishingHistory records.

There is no functional change, so existing tests apply unchanged.

As far as I can tell, the only performance downside to this is that the query returns more data; nothing else about the query changes, and there should be very little duplication between the extra objects (any duplication only happens, as far as I can see, when a package moves from one component to another or something relatively rare along those lines).

Existing tests:
{{{
./bin/test -vvc lp.archivepublisher.tests.test_dominator
}}}

No lint.


Jeroen
-- 
https://code.launchpad.net/~jtv/launchpad/getBinariesForDomination-bulk/+merge/81020
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/launchpad/getBinariesForDomination-bulk into lp:launchpad.
=== modified file 'lib/lp/archivepublisher/domination.py'
--- lib/lp/archivepublisher/domination.py	2011-11-02 13:36:51 +0000
+++ lib/lp/archivepublisher/domination.py	2011-11-02 13:36:53 +0000
@@ -491,7 +491,16 @@
         main_clauses.extend(bpph_location_clauses)
 
         store = IStore(BinaryPackagePublishingHistory)
-        return store.find(BinaryPackagePublishingHistory, *main_clauses)
+
+        # We're going to access the BPRs as well.  Since we make the
+        # database look them up anyway, and since there won't be many
+        # duplications among them, load them alongside the publications.
+        # We'll also want their BinaryPackageNames, but adding those to
+        # the join would complicate the query.
+        query = store.find(
+            (BinaryPackagePublishingHistory, BinaryPackageRelease),
+            *main_clauses)
+        return DecoratedResultSet(query, itemgetter(0))
 
     def dominateBinaries(self, distroseries, pocket):
         """Perform domination on binary package publications.


Follow ups