Merge lp:~gmb/launchpad/bugwatchhistory-db-bug-538091 into lp:launchpad/db-devel

Proposed by Graham Binns on 2010-03-12
Status: Merged
Approved by: Stuart Bishop on 2010-03-18
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~gmb/launchpad/bugwatchhistory-db-bug-538091
Merge into: lp:launchpad/db-devel
Diff against target: 41 lines (+26/-0)
2 files modified
database/schema/comments.sql (+10/-0)
database/schema/patch-2207-39-0.sql (+16/-0)
To merge this branch: bzr merge lp:~gmb/launchpad/bugwatchhistory-db-bug-538091
Reviewer Review Type Date Requested Status
Stuart Bishop 2010-03-12 Approve on 2010-03-18
Björn Tillenius db 2010-03-15 Pending
Jonathan Lange db 2010-03-12 Pending
Review via email: mp+21262@code.launchpad.net

Commit Message

Add a BugWatchActivity table to the DB.

Description of the Change

This branch adds a BugWatchActivity table to the database. We'll use this table to track the activity history of each bug watch. This will enable us to track failures in updates, both transient and otherwise, and will allow us to provide users with a better UI for helping to fix broken bug watches (amongst other things).

We'll create a job in garbo to prune bug watch activity older than a given time (say, a month) so as to reduce DB bloat.

To post a comment you must log in.
Stuart Bishop (stub) wrote :

The naming seems a little odd. The table appears to only be logging errors, so it is more of an error log than an activity log. If it is logging successes too, then error_type and error_message are the odd names.

Stuart Bishop (stub) wrote :

The OOPS pruner will need to be updated when this table is being used btw. as we shouldn't be removing OOPS codes from disk that have been linked.

Graham Binns (gmb) wrote :

On 15 March 2010 08:22, Stuart Bishop <email address hidden> wrote:
> The naming seems a little odd. The table appears to only be logging errors, so it is more of an error log than an activity log. If it is logging successes too, then error_type and error_message are the odd names.

It's logging successes to, but when successful error_type and
error_message will be NULL.

We could rename error_message to message, but I'm not sure what we
could call error_type.

Graham Binns (gmb) wrote :

Hi Stuart, Jono, Bjorn (though I think Bjorn's unavailable this week),

Is there any reason this can't land? I'd like to land it before the end of 10.03 week 2 since we're sprinting on checkwatches in week 3.

Stuart Bishop (stub) wrote :

Land it. Leave Bjorn's pending review where it is so he can find this and catch up.

Stuart Bishop (stub) wrote :

> Land it. Leave Bjorn's pending review where it is so he can find this and
> catch up.

Or should I say... land it after I've reviewed it :)

Stuart Bishop (stub) wrote :

patch-2207-39-0.sql

I personally think 'result' is a better name for error_type, and 'message' or 'description' for error message. Or perhaps result_code and result_message.

Opinions?

review: Approve
Graham Binns (gmb) wrote :

On 18 March 2010 08:04, Stuart Bishop <email address hidden> wrote:
> Review: Approve
> patch-2207-39-0.sql
>
> I personally think 'result' is a better name for error_type, and 'message' or 'description' for error message. Or perhaps result_code and result_message.
>
> Opinions?

Agreed. 'result' gives us the scope to add success states, too, so we
can track partial successes (e.g. status synced but not comments and
so on), which might come in handy.

Thanks!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'database/schema/comments.sql'
2--- database/schema/comments.sql 2010-02-25 20:30:56 +0000
3+++ database/schema/comments.sql 2010-03-18 09:02:47 +0000
4@@ -321,6 +321,16 @@
5 COMMENT ON COLUMN BugWatch.remote_lp_bug_id IS 'The bug in Launchpad that the remote bug is pointing at. This can be different than the BugWatch.bug column, since the same remote bug can be linked from multiple bugs in Launchpad, but the remote bug can only link to a single bug in Launchpad. The main use case for this column is to avoid having to query the remote bug tracker for this information, in order to decide whether we need to give this information to the remote bug tracker.';
6
7
8+-- BugWatchActivity
9+
10+COMMENT ON TABLE BugWatchActivity IS 'This table contains a record of each update for a given bug watch. This allows us to track whether a given update was successful or not and, if not, the details of the error which caused the update to fail.';
11+COMMENT ON COLUMN BugWatchActivity.bug_watch IS 'The bug_watch to which this activity entry relates.';
12+COMMENT ON COLUMN BugWatchActivity.activity_date IS 'The datetime at which the activity occurred.';
13+COMMENT ON COLUMN BugWatchActivity.result IS 'The result of the update. Legal values are defined in the BugWatchErrorType enumeration. An update is considered successful if its error_type is NULL.';
14+COMMENT ON COLUMN BugWatchActivity.message IS 'The message (if any) associated with the update.';
15+COMMENT ON COLUMN BugWatchActivity.oops_id IS 'The OOPS id, if any, associated with the error that caused the update to fail.';
16+
17+
18 -- BugAffectsPerson
19
20 COMMENT ON TABLE BugAffectsPerson IS 'This table maintains a mapping between bugs and users indicating that they are affected by that bug. The value is calculated and cached in the Bug.users_affected_count column.';
21
22=== added file 'database/schema/patch-2207-39-0.sql'
23--- database/schema/patch-2207-39-0.sql 1970-01-01 00:00:00 +0000
24+++ database/schema/patch-2207-39-0.sql 2010-03-18 09:02:47 +0000
25@@ -0,0 +1,16 @@
26+SET client_min_messages=ERROR;
27+
28+CREATE TABLE BugWatchActivity(
29+ id serial NOT NULL PRIMARY KEY,
30+ bug_watch integer NOT NULL REFERENCES BugWatch(id),
31+ activity_date timestamp without time zone
32+ DEFAULT timezone('UTC'::text, now()) NOT NULL,
33+ result integer,
34+ message text,
35+ oops_id text
36+);
37+
38+CREATE INDEX bugwatchactivity__date__idx ON BugWatchActivity(activity_date);
39+CREATE INDEX bugwatchactivity__bug_watch__idx ON BugWatchActivity(bug_watch);
40+
41+INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 39, 0);

Subscribers

People subscribed via source and target branches

to status/vote changes: