Merge lp:~cjwatson/launchpad/db-process-accepted-bugs-job into lp:launchpad/db-devel

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: no longer in the source branch.
Merged at revision: 11843
Proposed branch: lp:~cjwatson/launchpad/db-process-accepted-bugs-job
Merge into: lp:launchpad/db-devel
Diff against target: 140 lines (+51/-6)
5 files modified
database/sampledata/current-dev.sql (+14/-3)
database/sampledata/current.sql (+14/-3)
database/schema/comments.sql (+8/-0)
database/schema/patch-2209-27-2.sql (+13/-0)
database/schema/security.cfg (+2/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad/db-process-accepted-bugs-job
Reviewer Review Type Date Requested Status
Stuart Bishop (community) db Approve
Benji York (community) code Approve
Robert Collins db Pending
Review via email: mp+119320@code.launchpad.net

Commit message

Add ProcessAcceptedBugsJob table.

Description of the change

== Summary ==

Bug 745799: Some uploads can't be accepted within the timeout, principally because they have to close lots of bugs and dealing with structural subscriptions is very slow.

== Proposed fix ==

I describe my proposed fix in detail in https://bugs.launchpad.net/launchpad/+bug/745799/comments/20. We aren't likely to be able to solve the structural subscription problem any time soon, and uploads can close arbitrarily large numbers of bugs, so in order to get rid of the queue script in Launchpad (the only remaining purpose of which is to work around timeouts with processing some uploads) we need to move bug processing to run asynchronously.

This is the DB part of this change.

== Pre-implementation notes ==

http://irclogs.ubuntu.com/2012/08/04/%23launchpad-dev.html#t01:49

== LOC Rationale ==

+46, depending on how you want to count DB changes. Even with the associated code changes, this will still be dwarfed by removing the queue script (-1956).

To post a comment you must log in.
Revision history for this message
Benji York (benji) wrote :

The code in this branch is perfect in every way.

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

Sorry, I hadn't actually meant to ask for a code review but couldn't withdraw the request once I'd made it :-)

Revision history for this message
Stuart Bishop (stub) wrote :

This is fine.

It would be nice to drop the id column and just use job as the primary key, but I understand that we probably have existing code that relies on id and the table should be small in any case.

review: Approve (db)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'database/sampledata/current-dev.sql'
2--- database/sampledata/current-dev.sql 2012-08-03 19:21:19 +0000
3+++ database/sampledata/current-dev.sql 2012-08-16 15:24:31 +0000
4@@ -762,9 +762,6 @@
5
6
7
8-
9-
10-
11 SET SESSION AUTHORIZATION DEFAULT;
12
13 ALTER TABLE account DISABLE TRIGGER ALL;
14@@ -3535,6 +3532,13 @@
15 ALTER TABLE bugsubscriptionfilterimportance ENABLE TRIGGER ALL;
16
17
18+ALTER TABLE bugsubscriptionfilterinformationtype DISABLE TRIGGER ALL;
19+
20+
21+
22+ALTER TABLE bugsubscriptionfilterinformationtype ENABLE TRIGGER ALL;
23+
24+
25 ALTER TABLE bugsubscriptionfiltermute DISABLE TRIGGER ALL;
26
27
28@@ -9013,6 +9017,13 @@
29 ALTER TABLE potranslation ENABLE TRIGGER ALL;
30
31
32+ALTER TABLE processacceptedbugsjob DISABLE TRIGGER ALL;
33+
34+
35+
36+ALTER TABLE processacceptedbugsjob ENABLE TRIGGER ALL;
37+
38+
39 ALTER TABLE productjob DISABLE TRIGGER ALL;
40
41
42
43=== modified file 'database/sampledata/current.sql'
44--- database/sampledata/current.sql 2012-08-03 19:21:19 +0000
45+++ database/sampledata/current.sql 2012-08-16 15:24:31 +0000
46@@ -762,9 +762,6 @@
47
48
49
50-
51-
52-
53 SET SESSION AUTHORIZATION DEFAULT;
54
55 ALTER TABLE account DISABLE TRIGGER ALL;
56@@ -3469,6 +3466,13 @@
57 ALTER TABLE bugsubscriptionfilterimportance ENABLE TRIGGER ALL;
58
59
60+ALTER TABLE bugsubscriptionfilterinformationtype DISABLE TRIGGER ALL;
61+
62+
63+
64+ALTER TABLE bugsubscriptionfilterinformationtype ENABLE TRIGGER ALL;
65+
66+
67 ALTER TABLE bugsubscriptionfiltermute DISABLE TRIGGER ALL;
68
69
70@@ -8936,6 +8940,13 @@
71 ALTER TABLE potranslation ENABLE TRIGGER ALL;
72
73
74+ALTER TABLE processacceptedbugsjob DISABLE TRIGGER ALL;
75+
76+
77+
78+ALTER TABLE processacceptedbugsjob ENABLE TRIGGER ALL;
79+
80+
81 ALTER TABLE productjob DISABLE TRIGGER ALL;
82
83
84
85=== modified file 'database/schema/comments.sql'
86--- database/schema/comments.sql 2012-07-31 20:35:05 +0000
87+++ database/schema/comments.sql 2012-08-16 15:24:31 +0000
88@@ -715,6 +715,14 @@
89 COMMENT ON COLUMN PreviewDiff.target_revision_id IS 'The target branch revision_id used to generate this diff.';
90
91
92+-- ProcessAcceptedBugsJob
93+COMMENT ON TABLE ProcessAcceptedBugsJob IS 'Contains references to jobs for modifying bugs in response to accepting package uploads.';
94+COMMENT ON COLUMN ProcessAcceptedBugsJob.job IS 'The Job related to this ProcessAcceptedBugsJob.';
95+COMMENT ON COLUMN ProcessAcceptedBugsJob.distroseries IS 'The DistroSeries of the accepted upload.';
96+COMMENT ON COLUMN ProcessAcceptedBugsJob.sourcepackagerelease IS 'The SourcePackageRelease of the accepted upload.';
97+COMMENT ON COLUMN ProcessAcceptedBugsJob.json_data IS 'A JSON struct containing data for the job.';
98+
99+
100 -- Product
101 COMMENT ON TABLE Product IS 'Product: a DOAP Product. This table stores core information about an open source product. In Launchpad, anything that can be shipped as a tarball would be a product, and in some cases there might be products for things that never actually ship, depending on the project. For example, most projects will have a ''website'' product, because that allows you to file a Malone bug against the project website. Note that these are not actual product releases, which are stored in the ProductRelease table.';
102 COMMENT ON COLUMN Product.owner IS 'The Product owner would typically be the person who created this product in Launchpad. But we will encourage the upstream maintainer of a product to become the owner in Launchpad. The Product owner can edit any aspect of the Product, as well as appointing people to specific roles with regard to the Product. Also, the owner can add a new ProductRelease and also edit Rosetta POTemplates associated with this product.';
103
104=== added file 'database/schema/patch-2209-27-2.sql'
105--- database/schema/patch-2209-27-2.sql 1970-01-01 00:00:00 +0000
106+++ database/schema/patch-2209-27-2.sql 2012-08-16 15:24:31 +0000
107@@ -0,0 +1,13 @@
108+-- Copyright 2012 Canonical Ltd. This software is licensed under the
109+-- GNU Affero General Public License version 3 (see the file LICENSE).
110+
111+SET client_min_messages=ERROR;
112+
113+CREATE TABLE ProcessAcceptedBugsJob (
114+ job integer PRIMARY KEY REFERENCES Job ON DELETE CASCADE UNIQUE NOT NULL,
115+ distroseries integer REFERENCES DistroSeries NOT NULL,
116+ sourcepackagerelease integer REFERENCES SourcePackageRelease NOT NULL,
117+ json_data text
118+);
119+
120+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 27, 2);
121
122=== modified file 'database/schema/security.cfg'
123--- database/schema/security.cfg 2012-08-06 03:47:42 +0000
124+++ database/schema/security.cfg 2012-08-16 15:24:31 +0000
125@@ -266,6 +266,7 @@
126 public.polloption = SELECT, INSERT, UPDATE, DELETE
127 public.potexport = SELECT
128 public.previewdiff = SELECT, INSERT, UPDATE, DELETE
129+public.processacceptedbugsjob = SELECT, INSERT, UPDATE, DELETE
130 public.productjob = SELECT, INSERT, UPDATE, DELETE
131 public.productrelease = SELECT, INSERT, UPDATE, DELETE
132 public.productreleasefile = SELECT, INSERT, DELETE
133@@ -1521,6 +1522,7 @@
134 [process_accepted]
135 type=user
136 groups=queued
137+public.processacceptedbugsjob = SELECT, INSERT
138
139 [session]
140 type=user

Subscribers

People subscribed via source and target branches

to status/vote changes: