launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29562
[Merge] ~cjwatson/launchpad:optimize-latest-ppa-publications-for-distribution into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:optimize-latest-ppa-publications-for-distribution into launchpad:master.
Commit message:
Optimize getLatestPPASourcePublicationsForDistribution
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1979578 in Launchpad itself: "Launchpad issues a timeout error when trying to access PPAs in a private distribution"
https://bugs.launchpad.net/launchpad/+bug/1979578
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/436039
The previous query only filtered by `SourcePackagePublishingHistory.distroseries` and not by `Archive.distribution`. This forced PostgreSQL to look through all `SourcePackagePublishingHistory` rows trying to find one for the given distribution, and if the distribution is one where there are very few of those then it could take a long time before it finds any. (For Ubuntu, it always found appropriate rows very quickly.)
Adding an `Archive.distribution == distribution` condition seems reasonable, and makes the query run quickly on staging.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:optimize-latest-ppa-publications-for-distribution into launchpad:master.
diff --git a/lib/lp/soyuz/model/archive.py b/lib/lp/soyuz/model/archive.py
index c04e77f..05a4cbc 100644
--- a/lib/lp/soyuz/model/archive.py
+++ b/lib/lp/soyuz/model/archive.py
@@ -3562,6 +3562,7 @@ class ArchiveSet:
SourcePackagePublishingHistory.distroseries == DistroSeries.id,
Archive.private == False,
Archive._enabled == True,
+ Archive.distribution == distribution,
DistroSeries.distribution == distribution,
Archive.purpose == ArchivePurpose.PPA,
)