Merge lp:~wallyworld/launchpad/latestpublishedreleases-1071581 into lp:launchpad

Proposed by Ian Booth
Status: Superseded
Proposed branch: lp:~wallyworld/launchpad/latestpublishedreleases-1071581
Merge into: lp:launchpad
Diff against target: 60 lines (+56/-0)
1 file modified
database/schema/patch-2209-38-0.sql (+56/-0)
To merge this branch: bzr merge lp:~wallyworld/launchpad/latestpublishedreleases-1071581
Reviewer Review Type Date Requested Status
Stuart Bishop (community) db Approve
William Grant Pending
Review via email: mp+132466@code.launchpad.net

This proposal has been superseded by a proposal from 2012-11-05.

Commit message

Add new table for reporting on publications, and a table to allow garbo jobs to persist state between runs.

Description of the change

This db patch adds 2 new tables.

1. LatestPublishedReleases

Stores information about the latest published source packages. Effectively denormalised SPPH and SPR data. Required for efficient reporting.

I added indices which are required immediately for the task at hand.

I also added a reference to SPR, even though it's not used right now; it likely will be in the future.

Since it's for reporting only, I left off the FK references. This allows the referenced objects to be deleted and the reporting data can stay behind.

2. GarboJobState

A more robust alternative to using memcache to allow garbo jobs to store their state between runs.

To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) wrote :

Discussed on IRC. Putting the FK constraints in is a good idea unless we can demonstrate performance is a problem.

Revision history for this message
Stuart Bishop (stub) :
review: Approve (db)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'database/schema/patch-2209-38-0.sql'
2--- database/schema/patch-2209-38-0.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-38-0.sql 2012-11-05 22:18:22 +0000
4@@ -0,0 +1,56 @@
5+-- Copyright 2012 Canonical Ltd. This software is licensed under the
6+-- GNU Affero General Public License version 3 (see the file LICENSE).
7+
8+SET client_min_messages=ERROR;
9+
10+CREATE TABLE LatestPersonSourcePackageReleaseCache (
11+ id serial PRIMARY KEY,
12+ publication integer NOT NULL REFERENCES sourcepackagepublishinghistory(id),
13+ date_uploaded timestamp without time zone NOT NULL,
14+ creator integer REFERENCES person(id),
15+ maintainer integer REFERENCES person(id),
16+ archive_purpose integer NOT NULL,
17+ upload_archive integer NOT NULL REFERENCES archive(id),
18+ upload_distroseries integer NOT NULL REFERENCES distroseries(id),
19+ sourcepackagename integer NOT NULL REFERENCES sourcepackagename(id),
20+ sourcepackagerelease integer NOT NULL REFERENCES sourcepackagerelease(id)
21+);
22+
23+
24+CREATE INDEX latestpersonsourcepackagereleasecache__creator__idx
25+ ON LatestPersonSourcePackageReleaseCache USING btree (creator) WHERE (creator IS NOT NULL);
26+
27+CREATE INDEX latestpersonsourcepackagereleasecache__maintainer__idx
28+ ON LatestPersonSourcePackageReleaseCache USING btree (maintainer) WHERE (maintainer IS NOT NULL);
29+
30+CREATE INDEX latestpersonsourcepackagereleasecache__archive_purpose__idx
31+ ON LatestPersonSourcePackageReleaseCache USING btree (archive_purpose);
32+
33+ALTER TABLE LatestPersonSourcePackageReleaseCache ADD CONSTRAINT creator__upload_archive__upload_distroseries__sourcepackagename__key
34+ UNIQUE (creator, upload_archive, upload_distroseries, sourcepackagename);
35+
36+ALTER TABLE LatestPersonSourcePackageReleaseCache ADD CONSTRAINT maintainer__upload_archive__upload_distroseries__sourcepackagename__key
37+ UNIQUE (maintainer, upload_archive, upload_distroseries, sourcepackagename);
38+
39+COMMENT ON TABLE LatestPersonSourcePackageReleaseCache IS 'LatestPersonSourcePackageReleaseCache: The most recent published source package releases for a given (distroseries, archive, sourcepackage).';
40+COMMENT ON COLUMN LatestPersonSourcePackageReleaseCache.creator IS 'The creator of the source package release.';
41+COMMENT ON COLUMN LatestPersonSourcePackageReleaseCache.maintainer IS 'The maintainer of the source package in the DSC.';
42+COMMENT ON COLUMN LatestPersonSourcePackageReleaseCache.upload_archive IS 'The target archive for the release.';
43+COMMENT ON COLUMN LatestPersonSourcePackageReleaseCache.sourcepackagename IS 'The SourcePackageName of the release.';
44+COMMENT ON COLUMN LatestPersonSourcePackageReleaseCache.upload_distroseries IS 'The distroseries into which the sourcepackagerelease was published.';
45+COMMENT ON COLUMN LatestPersonSourcePackageReleaseCache.sourcepackagerelease IS 'The sourcepackagerelease which was published.';
46+COMMENT ON COLUMN LatestPersonSourcePackageReleaseCache.archive_purpose IS 'The purpose of the archive, e.g. COMMERCIAL. See the ArchivePurpose DBSchema item.';
47+COMMENT ON COLUMN LatestPersonSourcePackageReleaseCache.date_uploaded IS 'The date/time on which the source was actually published into the archive.';
48+
49+
50+CREATE TABLE GarboJobState (
51+ name text PRIMARY KEY,
52+ json_data text
53+);
54+
55+COMMENT ON TABLE GarboJobState IS 'Contains persistent state for named garbo jobs.';
56+COMMENT ON COLUMN GarboJobState.name IS 'The name of the job.';
57+COMMENT ON COLUMN GarboJobState.json_data IS 'A JSON struct containing data for the job.';
58+
59+
60+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 38, 0);