Merge lp:~gmb/launchpad/add-bugheatjob-table into lp:launchpad/db-devel

Proposed by Graham Binns
Status: Merged
Approved by: Graham Binns
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~gmb/launchpad/add-bugheatjob-table
Merge into: lp:launchpad/db-devel
Diff against target: 34 lines (+17/-0)
2 files modified
database/schema/comments.sql (+6/-0)
database/schema/patch-2207-28-0.sql (+11/-0)
To merge this branch: bzr merge lp:~gmb/launchpad/add-bugheatjob-table
Reviewer Review Type Date Requested Status
Stuart Bishop (community) db Approve
Jonathan Lange (community) db Approve
Review via email: mp+17620@code.launchpad.net

Commit message

Add a BugHeatJob table to the database.

To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) wrote :

This branch adds a DB patch to create a BugHeatJob table. Bug heat calculation jobs will use this table to work out which bug they need to update.

Revision history for this message
Jonathan Lange (jml) wrote :

Looks good to me. I think it's a Good Thing to follow the branch job pattern here: more code re-use potential.

Also, maybe this will make it easier to use jobs for other things in the bugs app.

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

The id column needs to be of type 'serial PRIMARY KEY', not 'integer PRIMARY KEY'.

Otherwise the DB patch is fine. patch-2207-28-0.sql.

I wouldn't mind rejecting this though, as we appear to be building our own messaging system instead of using a messaging system. Other job tables are for longer running tasks where we need to store state during the run - we might need them even if we switched from a poll based notification to a pull based using RabbitMQ or similar. The use cases for BugJob I can imagine are just using this table as a queue.

review: Approve (db)
Revision history for this message
Graham Binns (gmb) wrote :

On Tue, Jan 19, 2010 at 03:26:36AM -0000, Stuart Bishop wrote:
> Review: Approve db
> The id column needs to be of type 'serial PRIMARY KEY', not 'integer PRIMARY KEY'.
>
> Otherwise the DB patch is fine. patch-2207-28-0.sql.

Thanks.

> I wouldn't mind rejecting this though, as we appear to be building our
> own messaging system instead of using a messaging system. Other job
> tables are for longer running tasks where we need to store state
> during the run - we might need them even if we switched from a poll
> based notification to a pull based using RabbitMQ or similar. The use
> cases for BugJob I can imagine are just using this table as a queue.

I agree. However, time constraints for getting this working (it turns
out that we need it RSN for both bug heat and fixing checkwatches) mean
that we need to go ahead with the less perfect solution.

The sooner we can get to using RabbitMQ, the better.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified symlink 'bzrplugins/builder'
2=== target was u'../sourcecode/bzr-builder'
3=== modified file 'database/schema/comments.sql'
4--- database/schema/comments.sql 2010-01-13 05:55:29 +0000
5+++ database/schema/comments.sql 2010-01-19 15:26:20 +0000
6@@ -163,6 +163,12 @@
7 COMMENT ON COLUMN BugBranch.whiteboard IS 'Additional information about the status of the bugfix in this branch.';
8 COMMENT ON COLUMN BugBranch.registrant IS 'The person who linked the bug to the branch.';
9
10+-- BugJob
11+COMMENT ON TABLE BugJob IS 'Contains references to jobs to be run against Bugs.';
12+COMMENT ON COLUMN BugJob.bug IS 'The bug on which the job is to be run.';
13+COMMENT ON COLUMN BugJob.job_type IS 'The type of job (enumeration value). Allows us to query the database for a given subset of BugJobs.';
14+COMMENT ON COLUMN BugJob.json_data IS 'A JSON struct containing data for the job.';
15+
16 -- BugNomination
17 COMMENT ON TABLE BugNomination IS 'A bug nominated for fixing in a distroseries or productseries';
18 COMMENT ON COLUMN BugNomination.bug IS 'The bug being nominated.';
19
20=== added file 'database/schema/patch-2207-28-0.sql'
21--- database/schema/patch-2207-28-0.sql 1970-01-01 00:00:00 +0000
22+++ database/schema/patch-2207-28-0.sql 2010-01-19 15:26:20 +0000
23@@ -0,0 +1,11 @@
24+SET client_min_messages=ERROR;
25+
26+CREATE TABLE BugJob(
27+ id serial NOT NULL PRIMARY KEY,
28+ job integer NOT NULL REFERENCES Job(id),
29+ bug integer NOT NULL REFERENCES Bug(id),
30+ job_type integer NOT NULL,
31+ json_data text
32+);
33+
34+INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 28, 0)

Subscribers

People subscribed via source and target branches

to status/vote changes: