Merge ~cjwatson/launchpad:db-xpph-datepublished into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: eb603fb50b04e5938a63eb117b3564e4fc2cdb76
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:db-xpph-datepublished
Merge into: launchpad:master
Diff against target: 19 lines (+13/-0)
1 file modified
database/schema/patch-2210-13-1.sql (+13/-0)
Reviewer Review Type Date Requested Status
William Grant db Approve
Review via email: mp+383880@code.launchpad.net

Commit message

Add xPPH indexes where datepublished is NULL

Description of the change

These will be useful for upcoming publisher changes that use `datepublished IS NULL` rather than `status = PENDING` to decide whether publication records need to have their files published to disk.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) wrote :

Do we also need some that include distroseries?

review: Approve (db)
Revision history for this message
Colin Watson (cjwatson) wrote :

I can't currently think of a reason to add ones with distroseries. These indexes will be used by (I believe only) Publisher.getPendingSourcePublications, Publisher.getPendingBinaryPublications, and PublishFTPMaster.getDirtySuites. The first only uses distroseries for ordering; the second joins distroarchseries and then again only uses it for ordering; and the third doesn't pass distroseries/distroarchseries to archive.getPublishedSources/archive.getAllPublishedBinaries.

Unless you think that archive.getPublishedSources and archive.getAllPublishedBinaries would be landmines without distroseries-based indexes to support potential uses of them with both distro(arch)series and only_unpublished=True (my upcoming replacement for status=PENDING)?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/database/schema/patch-2210-13-1.sql b/database/schema/patch-2210-13-1.sql
2new file mode 100644
3index 0000000..b054b18
4--- /dev/null
5+++ b/database/schema/patch-2210-13-1.sql
6@@ -0,0 +1,13 @@
7+-- Copyright 2020 Canonical Ltd. This software is licensed under the
8+-- GNU Affero General Public License version 3 (see the file LICENSE).
9+
10+SET client_min_messages=ERROR;
11+
12+CREATE INDEX sourcepackagepublishinghistory__archive__status__datepublished__idx
13+ ON SourcePackagePublishingHistory (archive, status)
14+ WHERE datepublished IS NULL;
15+CREATE INDEX binarypackagepublishinghistory__archive__status__datepublished__idx
16+ ON BinaryPackagePublishingHistory (archive, status)
17+ WHERE datepublished IS NULL;
18+
19+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 13, 1);

Subscribers

People subscribed via source and target branches

to status/vote changes: