Merge lp:~danilo/launchpad/bug-814580-cold-db into lp:launchpad

Proposed by Данило Шеган
Status: Rejected
Rejected by: Данило Шеган
Proposed branch: lp:~danilo/launchpad/bug-814580-cold-db
Merge into: lp:launchpad
Prerequisite: lp:~danilo/launchpad/bug-814580
Diff against target: 54 lines (+20/-9)
3 files modified
database/schema/comments.sql (+8/-8)
database/schema/patch-2208-99-0.sql (+11/-0)
lib/lp/translations/model/translationsharingjob.py (+1/-1)
To merge this branch: bzr merge lp:~danilo/launchpad/bug-814580-cold-db
Reviewer Review Type Date Requested Status
Robert Collins (community) Needs Resubmitting
Stuart Bishop Pending
Review via email: mp+69981@code.launchpad.net

Description of the change

= Bug 814580: post-cleanup =

This renames the table PackagingJob to TranslationSharingJob (model code has already been changed).

This requires a downtime deployment since all appservers have to be restarted after this change is deployed.

== Proposed fix ==

To post a comment you must log in.
13583. By Данило Шеган

Merged bug-814580 into bug-814580-cold-db.

Revision history for this message
Robert Collins (lifeless) wrote :

This will need approval from me or francis as we no long have routine coordinated downtime + schema + new appserver versions.

Whats the reason for needing a deploy-to-both ?

I'm guessing its the table rename? If so, I suggest you create a view that just presents the table, so that the same appserver code will work. Then once the appservers are upgraded, we can drop the view.

review: Needs Resubmitting
Revision history for this message
Данило Шеган (danilo) wrote :

Yes, it's only for the rename.

A view TranslationSharingJob mirroring PackagingJob is a great idea: that would then go into https://code.launchpad.net/~danilo/launchpad/bug-814580-db/+merge/69979 instead of this branch. However, modifications are a bit more complicated (CREATE RULE ON INSERT/UPDATE/DELETE will have to be provided as well). Even with all that, I am not sure if storm will work with it properly.

The code change from this branch would then go into https://code.launchpad.net/~danilo/launchpad/bug-814580/+merge/69978

And this branch could only drop the view and rename the table. Is that what you are suggesting?

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

Views with update rules are a pain, but this will work for transition.

I wonder if it is easier to do at the Python end? There we are usually only concerned with changing the __storm_table__ attribute on a single class based on if a table exists or if a db patch has been deployed, and could be done via database introspection or some mechanism like a flag being set in zookeeper.

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

Unmerged revisions

13583. By Данило Шеган

Merged bug-814580 into bug-814580-cold-db.

13582. By Данило Шеган

Add a DB patch to rename PackagingJob table to TranslationSharingJob.

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 2011-08-01 12:22:06 +0000
3+++ database/schema/comments.sql 2011-08-01 12:22:11 +0000
4@@ -1893,14 +1893,14 @@
5 that we do not keep a history of these, so if someone sets it correctly,
6 then someone else sets it incorrectly, we lose the first setting.';
7
8-COMMENT ON TABLE PackagingJob IS 'A Job related to a Packaging entry.';
9-COMMENT ON COLUMN PackagingJob.id IS '';
10-COMMENT ON COLUMN PackagingJob.job IS 'The Job related to this PackagingJob.';
11-COMMENT ON COLUMN PackagingJob.job_type IS 'An enumeration specifying the type of job to perform.';
12-COMMENT ON COLUMN PackagingJob.productseries IS 'The productseries of the Packaging.';
13-COMMENT ON COLUMN PackagingJob.sourcepackagename IS 'The sourcepackage of the Packaging.';
14-COMMENT ON COLUMN PackagingJob.distroseries IS 'The distroseries of the Packaging.';
15-COMMENT ON COLUMN PackagingJob.potemplate IS 'A POTemplate to restrict the job to or NULL if all templates need to be handled.';
16+COMMENT ON TABLE TranslationSharingJob IS 'A Job related to a Packaging entry.';
17+COMMENT ON COLUMN TranslationSharingJob.id IS '';
18+COMMENT ON COLUMN TranslationSharingJob.job IS 'The Job related to this TranslationSharingJob.';
19+COMMENT ON COLUMN TranslationSharingJob.job_type IS 'An enumeration specifying the type of job to perform.';
20+COMMENT ON COLUMN TranslationSharingJob.productseries IS 'The productseries of the Packaging.';
21+COMMENT ON COLUMN TranslationSharingJob.sourcepackagename IS 'The sourcepackage of the Packaging.';
22+COMMENT ON COLUMN TranslationSharingJob.distroseries IS 'The distroseries of the Packaging.';
23+COMMENT ON COLUMN TranslationSharingJob.potemplate IS 'A POTemplate to restrict the job to or NULL if all templates need to be handled.';
24
25 -- Translator / TranslationGroup
26
27
28=== added file 'database/schema/patch-2208-99-0.sql'
29--- database/schema/patch-2208-99-0.sql 1970-01-01 00:00:00 +0000
30+++ database/schema/patch-2208-99-0.sql 2011-08-01 12:22:11 +0000
31@@ -0,0 +1,11 @@
32+-- Copyright 2011 Canonical Ltd. This software is licensed under the
33+-- GNU Affero General Public License version 3 (see the file LICENSE).
34+SET client_min_messages=ERROR;
35+
36+ALTER TABLE PackagingJob
37+ RENAME TO TranslationSharingJob;
38+
39+ALTER INDEX packagingjob__job__idx
40+ RENAME TO translationsharingjob__job__idx;
41+
42+INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 99, 0);
43
44=== modified file 'lib/lp/translations/model/translationsharingjob.py'
45--- lib/lp/translations/model/translationsharingjob.py 2011-08-01 12:22:06 +0000
46+++ lib/lp/translations/model/translationsharingjob.py 2011-08-01 12:22:11 +0000
47@@ -65,7 +65,7 @@
48 class TranslationSharingJob(StormBase):
49 """Base class for jobs related to a packaging."""
50
51- __storm_table__ = 'PackagingJob'
52+ __storm_table__ = 'TranslationSharingJob'
53
54 id = Int(primary=True)
55