Merge lp:~lifeless/launchpad/bug-421901 into lp:launchpad/db-devel
- bug-421901
- Merge into db-devel
Proposed by
Robert Collins
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Michael Hudson-Doyle | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 10416 | ||||
Proposed branch: | lp:~lifeless/launchpad/bug-421901 | ||||
Merge into: | lp:launchpad/db-devel | ||||
Diff against target: |
349 lines (+142/-76) 7 files modified
database/sampledata/current-dev.sql (+36/-36) database/sampledata/current.sql (+36/-36) lib/lp/bugs/interfaces/bugmessage.py (+4/-0) lib/lp/bugs/model/bugmessage.py (+4/-0) lib/lp/scripts/garbo.py (+32/-0) lib/lp/scripts/tests/test_garbo.py (+21/-0) lib/lp/testing/pgsql.py (+9/-4) |
||||
To merge this branch: | bzr merge lp:~lifeless/launchpad/bug-421901 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Hudson-Doyle | Approve | ||
Review via email: mp+56861@code.launchpad.net |
Commit message
[r=mwhudson][bug=421901] Add a migration task for the denormalisation into BugMessage.owner.
Description of the change
Add a migration task for the denormalisation into BugMessage.owner. This completes the work we can sensibly do until the next database downtime window.
To post a comment you must log in.
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 2011-03-30 10:46:24 +0000 | |||
3 | +++ database/sampledata/current-dev.sql 2011-04-08 00:45:52 +0000 | |||
4 | @@ -3403,42 +3403,42 @@ | |||
5 | 3403 | 3403 | ||
6 | 3404 | ALTER TABLE bugmessage DISABLE TRIGGER ALL; | 3404 | ALTER TABLE bugmessage DISABLE TRIGGER ALL; |
7 | 3405 | 3405 | ||
44 | 3406 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (1, 2, 1, NULL, NULL, 0); | 3406 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (1, 2, 1, NULL, NULL, 0, 16); |
45 | 3407 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (2, 1, 3, NULL, NULL, 0); | 3407 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (2, 1, 3, NULL, NULL, 0, 12); |
46 | 3408 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (3, 1, 4, NULL, NULL, 1); | 3408 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (3, 1, 4, NULL, NULL, 1, 12); |
47 | 3409 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (4, 2, 5, NULL, NULL, 1); | 3409 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (4, 2, 5, NULL, NULL, 1, 12); |
48 | 3410 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (5, 2, 6, NULL, NULL, 2); | 3410 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (5, 2, 6, NULL, NULL, 2, 12); |
49 | 3411 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (6, 4, 7, NULL, NULL, 0); | 3411 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (6, 4, 7, NULL, NULL, 0, 12); |
50 | 3412 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (7, 5, 8, NULL, NULL, 0); | 3412 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (7, 5, 8, NULL, NULL, 0, 12); |
51 | 3413 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (8, 6, 9, NULL, NULL, 0); | 3413 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (8, 6, 9, NULL, NULL, 0, 12); |
52 | 3414 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (9, 3, 10, NULL, NULL, 0); | 3414 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (9, 3, 10, NULL, NULL, 0, 12); |
53 | 3415 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (10, 7, 11, NULL, NULL, 0); | 3415 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (10, 7, 11, NULL, NULL, 0, 16); |
54 | 3416 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (11, 8, 14, NULL, NULL, 0); | 3416 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (11, 8, 14, NULL, NULL, 0, 12); |
55 | 3417 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (12, 9, 15, NULL, NULL, 0); | 3417 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (12, 9, 15, NULL, NULL, 0, 16); |
56 | 3418 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (13, 10, 17, NULL, NULL, 0); | 3418 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (13, 10, 17, NULL, NULL, 0, 16); |
57 | 3419 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (14, 10, 16, NULL, NULL, 1); | 3419 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (14, 10, 16, NULL, NULL, 1, 16); |
58 | 3420 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (15, 11, 24, NULL, NULL, 0); | 3420 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (15, 11, 24, NULL, NULL, 0, 26); |
59 | 3421 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (16, 11, 25, NULL, NULL, 1); | 3421 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (16, 11, 25, NULL, NULL, 1, 50); |
60 | 3422 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (17, 11, 26, NULL, NULL, 2); | 3422 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (17, 11, 26, NULL, NULL, 2, 66); |
61 | 3423 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (18, 11, 27, NULL, NULL, 3); | 3423 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (18, 11, 27, NULL, NULL, 3, 63); |
62 | 3424 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (19, 11, 28, NULL, NULL, 4); | 3424 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (19, 11, 28, NULL, NULL, 4, 27); |
63 | 3425 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (20, 11, 29, NULL, NULL, 5); | 3425 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (20, 11, 29, NULL, NULL, 5, 33); |
64 | 3426 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (21, 11, 30, NULL, NULL, 6); | 3426 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (21, 11, 30, NULL, NULL, 6, 3); |
65 | 3427 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (22, 12, 31, NULL, NULL, 0); | 3427 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (22, 12, 31, NULL, NULL, 0, 8); |
66 | 3428 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (23, 12, 33, NULL, NULL, 1); | 3428 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (23, 12, 33, NULL, NULL, 1, 45); |
67 | 3429 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (24, 12, 34, NULL, NULL, 2); | 3429 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (24, 12, 34, NULL, NULL, 2, 13); |
68 | 3430 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (25, 12, 35, NULL, NULL, 3); | 3430 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (25, 12, 35, NULL, NULL, 3, 9); |
69 | 3431 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (26, 12, 36, NULL, NULL, 4); | 3431 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (26, 12, 36, NULL, NULL, 4, 6); |
70 | 3432 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (27, 13, 37, NULL, NULL, 0); | 3432 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (27, 13, 37, NULL, NULL, 0, 12); |
71 | 3433 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (28, 13, 38, NULL, NULL, 1); | 3433 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (28, 13, 38, NULL, NULL, 1, 12); |
72 | 3434 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (29, 14, 39, NULL, NULL, 0); | 3434 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (29, 14, 39, NULL, NULL, 0, 63); |
73 | 3435 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (30, 15, 40, NULL, NULL, 0); | 3435 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (30, 15, 40, NULL, NULL, 0, 16); |
74 | 3436 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (31, 15, 44, 11, '<4284D7D1.6010208@gmx.de>', 1); | 3436 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (31, 15, 44, 11, '<4284D7D1.6010208@gmx.de>', 1, 243614); |
75 | 3437 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (32, 15, 45, 11, '<20050517185429.GB20786@spring.luon.net>', 2); | 3437 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (32, 15, 45, 11, '<20050517185429.GB20786@spring.luon.net>', 2, 243615); |
76 | 3438 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (33, 15, 46, 11, '<428A44E9.6090802@gmx.de>', 3); | 3438 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (33, 15, 46, 11, '<428A44E9.6090802@gmx.de>', 3, 243614); |
77 | 3439 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (34, 15, 47, 11, '<20050517202044.GA23231@spring.luon.net>', 4); | 3439 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (34, 15, 47, 11, '<20050517202044.GA23231@spring.luon.net>', 4, 243615); |
78 | 3440 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (35, 15, 48, 11, '<20050617140011.GA15638@piware.de>', 5); | 3440 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (35, 15, 48, 11, '<20050617140011.GA15638@piware.de>', 5, 243616); |
79 | 3441 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (36, 15, 49, 11, '<42BD2E36.9090809@gmx.de>', 6); | 3441 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (36, 15, 49, 11, '<42BD2E36.9090809@gmx.de>', 6, 243614); |
80 | 3442 | 3442 | ||
81 | 3443 | 3443 | ||
82 | 3444 | ALTER TABLE bugmessage ENABLE TRIGGER ALL; | 3444 | ALTER TABLE bugmessage ENABLE TRIGGER ALL; |
83 | 3445 | 3445 | ||
84 | === modified file 'database/sampledata/current.sql' | |||
85 | --- database/sampledata/current.sql 2011-03-18 15:28:46 +0000 | |||
86 | +++ database/sampledata/current.sql 2011-04-08 00:45:52 +0000 | |||
87 | @@ -3342,42 +3342,42 @@ | |||
88 | 3342 | 3342 | ||
89 | 3343 | ALTER TABLE bugmessage DISABLE TRIGGER ALL; | 3343 | ALTER TABLE bugmessage DISABLE TRIGGER ALL; |
90 | 3344 | 3344 | ||
127 | 3345 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (1, 2, 1, NULL, NULL, 0); | 3345 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (1, 2, 1, NULL, NULL, 0, 16); |
128 | 3346 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (2, 1, 3, NULL, NULL, 0); | 3346 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (2, 1, 3, NULL, NULL, 0, 12); |
129 | 3347 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (3, 1, 4, NULL, NULL, 1); | 3347 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (3, 1, 4, NULL, NULL, 1, 12); |
130 | 3348 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (4, 2, 5, NULL, NULL, 1); | 3348 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (4, 2, 5, NULL, NULL, 1, 12); |
131 | 3349 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (5, 2, 6, NULL, NULL, 2); | 3349 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (5, 2, 6, NULL, NULL, 2, 12); |
132 | 3350 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (6, 4, 7, NULL, NULL, 0); | 3350 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (6, 4, 7, NULL, NULL, 0, 12); |
133 | 3351 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (7, 5, 8, NULL, NULL, 0); | 3351 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (7, 5, 8, NULL, NULL, 0, 12); |
134 | 3352 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (8, 6, 9, NULL, NULL, 0); | 3352 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (8, 6, 9, NULL, NULL, 0, 12); |
135 | 3353 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (9, 3, 10, NULL, NULL, 0); | 3353 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (9, 3, 10, NULL, NULL, 0, 12); |
136 | 3354 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (10, 7, 11, NULL, NULL, 0); | 3354 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (10, 7, 11, NULL, NULL, 0, 16); |
137 | 3355 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (11, 8, 14, NULL, NULL, 0); | 3355 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (11, 8, 14, NULL, NULL, 0, 12); |
138 | 3356 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (12, 9, 15, NULL, NULL, 0); | 3356 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (12, 9, 15, NULL, NULL, 0, 16); |
139 | 3357 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (13, 10, 17, NULL, NULL, 0); | 3357 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (13, 10, 17, NULL, NULL, 0, 16); |
140 | 3358 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (14, 10, 16, NULL, NULL, 1); | 3358 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (14, 10, 16, NULL, NULL, 1, 16); |
141 | 3359 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (15, 11, 24, NULL, NULL, 0); | 3359 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (15, 11, 24, NULL, NULL, 0, 26); |
142 | 3360 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (16, 11, 25, NULL, NULL, 1); | 3360 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (16, 11, 25, NULL, NULL, 1, 50); |
143 | 3361 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (17, 11, 26, NULL, NULL, 2); | 3361 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (17, 11, 26, NULL, NULL, 2, 66); |
144 | 3362 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (18, 11, 27, NULL, NULL, 3); | 3362 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (18, 11, 27, NULL, NULL, 3, 63); |
145 | 3363 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (19, 11, 28, NULL, NULL, 4); | 3363 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (19, 11, 28, NULL, NULL, 4, 27); |
146 | 3364 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (20, 11, 29, NULL, NULL, 5); | 3364 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (20, 11, 29, NULL, NULL, 5, 33); |
147 | 3365 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (21, 11, 30, NULL, NULL, 6); | 3365 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (21, 11, 30, NULL, NULL, 6, 3); |
148 | 3366 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (22, 12, 31, NULL, NULL, 0); | 3366 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (22, 12, 31, NULL, NULL, 0, 8); |
149 | 3367 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (23, 12, 33, NULL, NULL, 1); | 3367 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (23, 12, 33, NULL, NULL, 1, 45); |
150 | 3368 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (24, 12, 34, NULL, NULL, 2); | 3368 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (24, 12, 34, NULL, NULL, 2, 13); |
151 | 3369 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (25, 12, 35, NULL, NULL, 3); | 3369 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (25, 12, 35, NULL, NULL, 3, 9); |
152 | 3370 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (26, 12, 36, NULL, NULL, 4); | 3370 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (26, 12, 36, NULL, NULL, 4, 6); |
153 | 3371 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (27, 13, 37, NULL, NULL, 0); | 3371 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (27, 13, 37, NULL, NULL, 0, 12); |
154 | 3372 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (28, 13, 38, NULL, NULL, 1); | 3372 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (28, 13, 38, NULL, NULL, 1, 12); |
155 | 3373 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (29, 14, 39, NULL, NULL, 0); | 3373 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (29, 14, 39, NULL, NULL, 0, 63); |
156 | 3374 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (30, 15, 40, NULL, NULL, 0); | 3374 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (30, 15, 40, NULL, NULL, 0, 16); |
157 | 3375 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (31, 15, 44, 11, '<4284D7D1.6010208@gmx.de>', 1); | 3375 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (31, 15, 44, 11, '<4284D7D1.6010208@gmx.de>', 1, 243614); |
158 | 3376 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (32, 15, 45, 11, '<20050517185429.GB20786@spring.luon.net>', 2); | 3376 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (32, 15, 45, 11, '<20050517185429.GB20786@spring.luon.net>', 2, 243615); |
159 | 3377 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (33, 15, 46, 11, '<428A44E9.6090802@gmx.de>', 3); | 3377 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (33, 15, 46, 11, '<428A44E9.6090802@gmx.de>', 3, 243614); |
160 | 3378 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (34, 15, 47, 11, '<20050517202044.GA23231@spring.luon.net>', 4); | 3378 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (34, 15, 47, 11, '<20050517202044.GA23231@spring.luon.net>', 4, 243615); |
161 | 3379 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (35, 15, 48, 11, '<20050617140011.GA15638@piware.de>', 5); | 3379 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (35, 15, 48, 11, '<20050617140011.GA15638@piware.de>', 5, 243616); |
162 | 3380 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index) VALUES (36, 15, 49, 11, '<42BD2E36.9090809@gmx.de>', 6); | 3380 | INSERT INTO bugmessage (id, bug, message, bugwatch, remote_comment_id, index, owner) VALUES (36, 15, 49, 11, '<42BD2E36.9090809@gmx.de>', 6, 243614); |
163 | 3381 | 3381 | ||
164 | 3382 | 3382 | ||
165 | 3383 | ALTER TABLE bugmessage ENABLE TRIGGER ALL; | 3383 | ALTER TABLE bugmessage ENABLE TRIGGER ALL; |
166 | 3384 | 3384 | ||
167 | === modified file 'lib/lp/bugs/interfaces/bugmessage.py' | |||
168 | --- lib/lp/bugs/interfaces/bugmessage.py 2011-03-02 15:34:31 +0000 | |||
169 | +++ lib/lp/bugs/interfaces/bugmessage.py 2011-04-08 00:45:52 +0000 | |||
170 | @@ -31,6 +31,7 @@ | |||
171 | 31 | from lp.app.validators.attachment import attachment_size_constraint | 31 | from lp.app.validators.attachment import attachment_size_constraint |
172 | 32 | from lp.bugs.interfaces.bug import IBug | 32 | from lp.bugs.interfaces.bug import IBug |
173 | 33 | from lp.bugs.interfaces.bugwatch import IBugWatch | 33 | from lp.bugs.interfaces.bugwatch import IBugWatch |
174 | 34 | from lp.registry.interfaces.person import IPerson | ||
175 | 34 | from lp.services.fields import Title | 35 | from lp.services.fields import Title |
176 | 35 | 36 | ||
177 | 36 | 37 | ||
178 | @@ -52,6 +53,9 @@ | |||
179 | 52 | bugwatchID = Int(title=u'The bugwatch id.', readonly=True) | 53 | bugwatchID = Int(title=u'The bugwatch id.', readonly=True) |
180 | 53 | remote_comment_id = TextLine( | 54 | remote_comment_id = TextLine( |
181 | 54 | title=u"The id this comment has in the bugwatch's bug tracker.") | 55 | title=u"The id this comment has in the bugwatch's bug tracker.") |
182 | 56 | ownerID = Attribute("The ID of the owner mirrored from the message") | ||
183 | 57 | owner = Object(schema=IPerson, | ||
184 | 58 | title=u"The Message owner mirrored from the message.", readonly=True) | ||
185 | 55 | 59 | ||
186 | 56 | 60 | ||
187 | 57 | class IBugMessageSet(Interface): | 61 | class IBugMessageSet(Interface): |
188 | 58 | 62 | ||
189 | === modified file 'lib/lp/bugs/model/bugmessage.py' | |||
190 | --- lib/lp/bugs/model/bugmessage.py 2011-03-02 15:34:31 +0000 | |||
191 | +++ lib/lp/bugs/model/bugmessage.py 2011-04-08 00:45:52 +0000 | |||
192 | @@ -29,6 +29,7 @@ | |||
193 | 29 | IBugMessage, | 29 | IBugMessage, |
194 | 30 | IBugMessageSet, | 30 | IBugMessageSet, |
195 | 31 | ) | 31 | ) |
196 | 32 | from lp.registry.interfaces.person import validate_public_person | ||
197 | 32 | 33 | ||
198 | 33 | 34 | ||
199 | 34 | class BugMessage(SQLBase): | 35 | class BugMessage(SQLBase): |
200 | @@ -46,6 +47,9 @@ | |||
201 | 46 | remote_comment_id = StringCol(notNull=False, default=None) | 47 | remote_comment_id = StringCol(notNull=False, default=None) |
202 | 47 | # -- The index of the message is cached in the DB. | 48 | # -- The index of the message is cached in the DB. |
203 | 48 | index = IntCol(notNull=True) | 49 | index = IntCol(notNull=True) |
204 | 50 | # -- The owner, cached from the message table using triggers. | ||
205 | 51 | owner = ForeignKey(dbName='owner', foreignKey='Person', | ||
206 | 52 | storm_validator=validate_public_person, notNull=False) | ||
207 | 49 | 53 | ||
208 | 50 | def __repr__(self): | 54 | def __repr__(self): |
209 | 51 | return "<BugMessage at 0x%x message=%s index=%s>" % ( | 55 | return "<BugMessage at 0x%x message=%s index=%s>" % ( |
210 | 52 | 56 | ||
211 | === modified file 'lib/lp/scripts/garbo.py' | |||
212 | --- lib/lp/scripts/garbo.py 2011-03-31 20:55:25 +0000 | |||
213 | +++ lib/lp/scripts/garbo.py 2011-04-08 00:45:52 +0000 | |||
214 | @@ -64,6 +64,7 @@ | |||
215 | 64 | from lp.bugs.interfaces.bug import IBugSet | 64 | from lp.bugs.interfaces.bug import IBugSet |
216 | 65 | from lp.bugs.model.bug import Bug | 65 | from lp.bugs.model.bug import Bug |
217 | 66 | from lp.bugs.model.bugattachment import BugAttachment | 66 | from lp.bugs.model.bugattachment import BugAttachment |
218 | 67 | from lp.bugs.model.bugmessage import BugMessage | ||
219 | 67 | from lp.bugs.model.bugnotification import BugNotification | 68 | from lp.bugs.model.bugnotification import BugNotification |
220 | 68 | from lp.bugs.model.bugwatch import BugWatchActivity | 69 | from lp.bugs.model.bugwatch import BugWatchActivity |
221 | 69 | from lp.bugs.scripts.checkwatches.scheduler import ( | 70 | from lp.bugs.scripts.checkwatches.scheduler import ( |
222 | @@ -692,6 +693,36 @@ | |||
223 | 692 | """ | 693 | """ |
224 | 693 | 694 | ||
225 | 694 | 695 | ||
226 | 696 | class MirrorBugMessageOwner(TunableLoop): | ||
227 | 697 | """Mirror BugMessage.owner from Message. | ||
228 | 698 | |||
229 | 699 | Only needed until they are all set, after that triggers will maintain it. | ||
230 | 700 | """ | ||
231 | 701 | |||
232 | 702 | # Test migration did 3M in 2 hours, so 5000 is ~ 10 seconds - and thats the | ||
233 | 703 | # max we want to hold a DB lock open for. | ||
234 | 704 | minimum_chunk_size = 1000 | ||
235 | 705 | maximum_chunk_size = 5000 | ||
236 | 706 | |||
237 | 707 | def __init__(self, log, abort_time=None): | ||
238 | 708 | super(MirrorBugMessageOwner, self).__init__(log, abort_time) | ||
239 | 709 | self.store = IMasterStore(BugMessage) | ||
240 | 710 | self.isDone = IMasterStore(BugMessage).find( | ||
241 | 711 | BugMessage, BugMessage.ownerID==None).is_empty | ||
242 | 712 | |||
243 | 713 | def __call__(self, chunk_size): | ||
244 | 714 | """See `ITunableLoop`.""" | ||
245 | 715 | transaction.begin() | ||
246 | 716 | updated = self.store.execute("""update bugmessage set | ||
247 | 717 | owner=message.owner from message where | ||
248 | 718 | bugmessage.message=message.id and bugmessage.id in | ||
249 | 719 | (select id from bugmessage where owner is NULL limit %s);""" | ||
250 | 720 | % int(chunk_size) | ||
251 | 721 | ).rowcount | ||
252 | 722 | self.log.debug("Updated %s bugmessages." % updated) | ||
253 | 723 | transaction.commit() | ||
254 | 724 | |||
255 | 725 | |||
256 | 695 | class BugHeatUpdater(TunableLoop): | 726 | class BugHeatUpdater(TunableLoop): |
257 | 696 | """A `TunableLoop` for bug heat calculations.""" | 727 | """A `TunableLoop` for bug heat calculations.""" |
258 | 697 | 728 | ||
259 | @@ -1078,6 +1109,7 @@ | |||
260 | 1078 | class HourlyDatabaseGarbageCollector(BaseDatabaseGarbageCollector): | 1109 | class HourlyDatabaseGarbageCollector(BaseDatabaseGarbageCollector): |
261 | 1079 | script_name = 'garbo-hourly' | 1110 | script_name = 'garbo-hourly' |
262 | 1080 | tunable_loops = [ | 1111 | tunable_loops = [ |
263 | 1112 | MirrorBugMessageOwner, | ||
264 | 1081 | OAuthNoncePruner, | 1113 | OAuthNoncePruner, |
265 | 1082 | OpenIDConsumerNoncePruner, | 1114 | OpenIDConsumerNoncePruner, |
266 | 1083 | OpenIDConsumerAssociationPruner, | 1115 | OpenIDConsumerAssociationPruner, |
267 | 1084 | 1116 | ||
268 | === modified file 'lib/lp/scripts/tests/test_garbo.py' | |||
269 | --- lib/lp/scripts/tests/test_garbo.py 2011-03-31 20:55:25 +0000 | |||
270 | +++ lib/lp/scripts/tests/test_garbo.py 2011-04-08 00:45:52 +0000 | |||
271 | @@ -55,6 +55,7 @@ | |||
272 | 55 | ZopelessDatabaseLayer, | 55 | ZopelessDatabaseLayer, |
273 | 56 | ) | 56 | ) |
274 | 57 | from lp.archiveuploader.dscfile import findFile | 57 | from lp.archiveuploader.dscfile import findFile |
275 | 58 | from lp.bugs.model.bugmessage import BugMessage | ||
276 | 58 | from lp.bugs.model.bugnotification import ( | 59 | from lp.bugs.model.bugnotification import ( |
277 | 59 | BugNotification, | 60 | BugNotification, |
278 | 60 | BugNotificationRecipient, | 61 | BugNotificationRecipient, |
279 | @@ -932,3 +933,23 @@ | |||
280 | 932 | self.assertFalse(spr.changelog == None) | 933 | self.assertFalse(spr.changelog == None) |
281 | 933 | self.assertTrue(spr.changelog.restricted) | 934 | self.assertTrue(spr.changelog.restricted) |
282 | 934 | self.assertEqual(changelog, spr.changelog.read()) | 935 | self.assertEqual(changelog, spr.changelog.read()) |
283 | 936 | |||
284 | 937 | def test_mirror_bugmessages(self): | ||
285 | 938 | # Nuke the owner in sampledata. | ||
286 | 939 | con = DatabaseLayer._db_fixture.superuser_connection() | ||
287 | 940 | try: | ||
288 | 941 | cur = con.cursor() | ||
289 | 942 | cur.execute("ALTER TABLE bugmessage " | ||
290 | 943 | "DISABLE TRIGGER bugmessage__owner__mirror") | ||
291 | 944 | cur.execute("UPDATE bugmessage set owner=NULL") | ||
292 | 945 | cur.execute("ALTER TABLE bugmessage " | ||
293 | 946 | "ENABLE TRIGGER bugmessage__owner__mirror") | ||
294 | 947 | con.commit() | ||
295 | 948 | finally: | ||
296 | 949 | con.close() | ||
297 | 950 | store = IMasterStore(BugMessage) | ||
298 | 951 | unmigrated = store.find(BugMessage, BugMessage.ownerID==None).count | ||
299 | 952 | self.assertNotEqual(0, unmigrated()) | ||
300 | 953 | self.runHourly() | ||
301 | 954 | self.assertEqual(0, unmigrated()) | ||
302 | 955 | |||
303 | 935 | 956 | ||
304 | === modified file 'lib/lp/testing/pgsql.py' | |||
305 | --- lib/lp/testing/pgsql.py 2011-02-19 13:50:19 +0000 | |||
306 | +++ lib/lp/testing/pgsql.py 2011-04-08 00:45:52 +0000 | |||
307 | @@ -220,9 +220,14 @@ | |||
308 | 220 | connection_parameters.append('port=%s' % self.host) | 220 | connection_parameters.append('port=%s' % self.host) |
309 | 221 | return ' '.join(connection_parameters) | 221 | return ' '.join(connection_parameters) |
310 | 222 | 222 | ||
311 | 223 | def superuser_connection(self, dbname=None): | ||
312 | 224 | if dbname is None: | ||
313 | 225 | dbname = self.dbname | ||
314 | 226 | return psycopg2.connect(self._connectionString(dbname)) | ||
315 | 227 | |||
316 | 223 | def generateResetSequencesSQL(self): | 228 | def generateResetSequencesSQL(self): |
317 | 224 | """Return a SQL statement that resets all sequences.""" | 229 | """Return a SQL statement that resets all sequences.""" |
319 | 225 | con = psycopg2.connect(self._connectionString(self.dbname)) | 230 | con = self.superuser_connection() |
320 | 226 | cur = con.cursor() | 231 | cur = con.cursor() |
321 | 227 | try: | 232 | try: |
322 | 228 | return generateResetSequencesSQL(cur) | 233 | return generateResetSequencesSQL(cur) |
323 | @@ -243,7 +248,7 @@ | |||
324 | 243 | # anyway (because they might have been incremented even if | 248 | # anyway (because they might have been incremented even if |
325 | 244 | # nothing was committed), making sure not to disturb the | 249 | # nothing was committed), making sure not to disturb the |
326 | 245 | # 'committed' flag, and we're done. | 250 | # 'committed' flag, and we're done. |
328 | 246 | con = psycopg2.connect(self._connectionString(self.dbname)) | 251 | con = self.superuser_connection() |
329 | 247 | cur = con.cursor() | 252 | cur = con.cursor() |
330 | 248 | if self.reset_sequences_sql is None: | 253 | if self.reset_sequences_sql is None: |
331 | 249 | resetSequences(cur) | 254 | resetSequences(cur) |
332 | @@ -261,7 +266,7 @@ | |||
333 | 261 | # template database that are slow in dropping off. | 266 | # template database that are slow in dropping off. |
334 | 262 | attempts = 60 | 267 | attempts = 60 |
335 | 263 | for counter in range(0, attempts): | 268 | for counter in range(0, attempts): |
337 | 264 | con = psycopg2.connect(self._connectionString(self.template)) | 269 | con = self.superuser_connection(self.template) |
338 | 265 | try: | 270 | try: |
339 | 266 | con.set_isolation_level(0) | 271 | con.set_isolation_level(0) |
340 | 267 | cur = con.cursor() | 272 | cur = con.cursor() |
341 | @@ -321,7 +326,7 @@ | |||
342 | 321 | attempts = 100 | 326 | attempts = 100 |
343 | 322 | for i in range(0, attempts): | 327 | for i in range(0, attempts): |
344 | 323 | try: | 328 | try: |
346 | 324 | con = psycopg2.connect(self._connectionString(self.template)) | 329 | con = self.superuser_connection(self.template) |
347 | 325 | except psycopg2.OperationalError, x: | 330 | except psycopg2.OperationalError, x: |
348 | 326 | if 'does not exist' in x: | 331 | if 'does not exist' in x: |
349 | 327 | return | 332 | return |
As discussed on IRC, for /me/ superuser_ connection( ) is a clearer name than root_connection() ('root' is a touch overloaded and I didn't get the intent in this context).
Other than that, looks fine.