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
=== modified file 'database/schema/comments.sql'
--- database/schema/comments.sql 2011-08-01 12:22:06 +0000
+++ database/schema/comments.sql 2011-08-01 12:22:11 +0000
@@ -1893,14 +1893,14 @@
1893that we do not keep a history of these, so if someone sets it correctly,1893that we do not keep a history of these, so if someone sets it correctly,
1894then someone else sets it incorrectly, we lose the first setting.';1894then someone else sets it incorrectly, we lose the first setting.';
18951895
1896COMMENT ON TABLE PackagingJob IS 'A Job related to a Packaging entry.';1896COMMENT ON TABLE TranslationSharingJob IS 'A Job related to a Packaging entry.';
1897COMMENT ON COLUMN PackagingJob.id IS '';1897COMMENT ON COLUMN TranslationSharingJob.id IS '';
1898COMMENT ON COLUMN PackagingJob.job IS 'The Job related to this PackagingJob.';1898COMMENT ON COLUMN TranslationSharingJob.job IS 'The Job related to this TranslationSharingJob.';
1899COMMENT ON COLUMN PackagingJob.job_type IS 'An enumeration specifying the type of job to perform.';1899COMMENT ON COLUMN TranslationSharingJob.job_type IS 'An enumeration specifying the type of job to perform.';
1900COMMENT ON COLUMN PackagingJob.productseries IS 'The productseries of the Packaging.';1900COMMENT ON COLUMN TranslationSharingJob.productseries IS 'The productseries of the Packaging.';
1901COMMENT ON COLUMN PackagingJob.sourcepackagename IS 'The sourcepackage of the Packaging.';1901COMMENT ON COLUMN TranslationSharingJob.sourcepackagename IS 'The sourcepackage of the Packaging.';
1902COMMENT ON COLUMN PackagingJob.distroseries IS 'The distroseries of the Packaging.';1902COMMENT ON COLUMN TranslationSharingJob.distroseries IS 'The distroseries of the Packaging.';
1903COMMENT ON COLUMN PackagingJob.potemplate IS 'A POTemplate to restrict the job to or NULL if all templates need to be handled.';1903COMMENT ON COLUMN TranslationSharingJob.potemplate IS 'A POTemplate to restrict the job to or NULL if all templates need to be handled.';
19041904
1905-- Translator / TranslationGroup1905-- Translator / TranslationGroup
19061906
19071907
=== added file 'database/schema/patch-2208-99-0.sql'
--- database/schema/patch-2208-99-0.sql 1970-01-01 00:00:00 +0000
+++ database/schema/patch-2208-99-0.sql 2011-08-01 12:22:11 +0000
@@ -0,0 +1,11 @@
1-- Copyright 2011 Canonical Ltd. This software is licensed under the
2-- GNU Affero General Public License version 3 (see the file LICENSE).
3SET client_min_messages=ERROR;
4
5ALTER TABLE PackagingJob
6 RENAME TO TranslationSharingJob;
7
8ALTER INDEX packagingjob__job__idx
9 RENAME TO translationsharingjob__job__idx;
10
11INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 99, 0);
012
=== modified file 'lib/lp/translations/model/translationsharingjob.py'
--- lib/lp/translations/model/translationsharingjob.py 2011-08-01 12:22:06 +0000
+++ lib/lp/translations/model/translationsharingjob.py 2011-08-01 12:22:11 +0000
@@ -65,7 +65,7 @@
65class TranslationSharingJob(StormBase):65class TranslationSharingJob(StormBase):
66 """Base class for jobs related to a packaging."""66 """Base class for jobs related to a packaging."""
6767
68 __storm_table__ = 'PackagingJob'68 __storm_table__ = 'TranslationSharingJob'
6969
70 id = Int(primary=True)70 id = Int(primary=True)
7171