Change in ovirt-engine[master]: core: Fix db upgrade in PostgreSQL 8.x

amureini at redhat.com amureini at redhat.com
Thu Feb 14 17:12:29 UTC 2013


Allon Mureinik has submitted this change and it was merged.

Change subject: core: Fix db upgrade in PostgreSQL 8.x
......................................................................


core: Fix db upgrade in PostgreSQL 8.x

PostgreSQL 8.x and 9.x have a different behaviour regarding when inline
SQL queries in PL/pgSQL code is evaluated (see
http://wiki.postgresql.org/wiki/What%27s_new_in_PostgreSQL_9.0#PL.2FpgSQL_changes_which_may_cause_regressions).

The current problem in upgrading the database in PostgreSQL 8.x is the
min_refresh_rate column added in 03_02_0440_materialized_views_extensions.sql.

The relevant parts of current flow (before the patch):
1. pre_upgrade script 30 creates the materialized_views table
2. materialized view functions are created
3. [various upgrade scripts]
4. 03_02_0440_materialized_views_extensions.sql - add a column to
   materialized_views.

In 8.x variants, stage (2) will fail since the function can not compile
due to the missing column.

This patch changes the flow as follows:
1. pre_upgrade script 30 creates the materialized_views table
2. pre_upgrade script 40 adds the missing column
3. materialized view functions are created
4. [various upgrade scripts]

Note that the original
dbscripts/upgrade/03_02_0440_materialized_views_extensions.sql is
preserved for backwards compatibility. Since it is reentrant (the column
is only created if it did not previously exist), this is the safest way
to go.

Change-Id: Ifc40a2d40c067b1ace123c565cada27ddd26cc5c
Signed-off-by: Allon Mureinik <amureini at redhat.com>
---
A backend/manager/dbscripts/upgrade/pre_upgrade/0040_materialized_views_extensions.sql
1 file changed, 6 insertions(+), 0 deletions(-)

Approvals:
  Allon Mureinik: Verified; Looks good to me, approved


--
To view, visit http://gerrit.ovirt.org/12076
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifc40a2d40c067b1ace123c565cada27ddd26cc5c
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Alissa Bonas <abonas at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Eli Mesika <emesika at redhat.com>
Gerrit-Reviewer: Eyal Edri <eedri at redhat.com>
Gerrit-Reviewer: Itamar Heim <iheim at redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofrenkel at redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzaslavs at redhat.com>



More information about the Engine-commits mailing list