Bug 1528371 - engine-setup fails to upgrade postgres from 9.2 to 9.5 if the system wide locale differs from system wide locale at first installation time
Summary: engine-setup fails to upgrade postgres from 9.2 to 9.5 if the system wide loc...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: Setup.EngineCommon
Version: 4.2.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: ovirt-4.2.2
: 4.2.2.2
Assignee: Yedidyah Bar David
QA Contact: Lucie Leistnerova
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-12-21 16:14 UTC by Simone Tiraboschi
Modified: 2018-05-17 11:21 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
This update enables engine-setup to upgrade PostgreSQL 9.2 to 9.5, even when the locale of the 9.2 database is different from the system locale.
Clone Of:
Environment:
Last Closed: 2018-03-29 10:56:09 UTC
oVirt Team: Integration
Embargoed:
rule-engine: ovirt-4.2+
ylavi: blocker+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1579268 0 urgent CLOSED Upgrade of PostgreSQL during RHV 4.1 to 4.2 upgrade fails with locale mismatch 2022-07-09 13:52:49 UTC
oVirt gerrit 88232 0 'None' MERGED packaging: setup: postgres95: Pass locale 2020-05-12 13:16:13 UTC
oVirt gerrit 88246 0 'None' MERGED packaging: setup: postgres95: Pass locale 2020-05-12 13:16:14 UTC
oVirt gerrit 91335 0 'None' MERGED packaging: setup: postgres95: Pass locale 2020-05-12 13:16:14 UTC

Internal Links: 1579268

Description Simone Tiraboschi 2017-12-21 16:14:16 UTC
Description of problem:
engine-setup fails to upgrade postgres from 9.2 to 9.5 if the system wide locale differs from system wide locale at first installation time

engine-setup initializes its DB in en_US.UTF-8 while postgres own DB is initialized in system wide locale.
pg_upgrade cannot change DB locale on the fly on upgrades.

So if the user changed the system wide locale before running engine-setup to update the system from 4.1 to 4.2 and so from postgres 9.2 to postgres 9.5, engine-setup will fail with:

2017-12-20 15:53:42,967+0100 DEBUG otopi.plugins.ovirt_engine_setup.ovirt_engine.db.dbmsupgrade plugin.execute:926 execute-output: ('/opt/rh/rh-postgresql95/root/usr/bin/postgresql-setup', '--upgrade', '--upgrade-from=postgresql') stderr:
 * upgrading from 'postgresql.service' to 'rh-postgresql95-postgresql.service'
 * Upgrading database.
ERROR: pg_upgrade tool failed
ERROR: Upgrade failed.
 * See /var/lib/pgsql/upgrade_rh-postgresql95-postgresql.log for details.

2017-12-20 15:53:42,968+0100 DEBUG otopi.transaction transaction._prepare:66 exception during prepare phase
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/otopi/transaction.py", line 62, in _prepare
    element.prepare()
  File "/usr/share/ovirt-engine/setup/ovirt_engine_setup/engine_common/postgres.py", line 716, in prepare
    raiseOnError=True,
  File "/usr/lib/python2.7/site-packages/otopi/plugin.py", line 931, in execute
    command=args[0],
RuntimeError: Command '/opt/rh/rh-postgresql95/root/usr/bin/postgresql-setup' failed to execute

And in /var/lib/pgsql/upgrade_rh-postgresql95-postgresql.log something like:
Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for reg* system OID user data types                ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for invalid "line" user columns                    ok
Creating dump of global objects                             ok
Creating dump of database schemas
  engine
  ovirt_engine_history
  postgres
  template1
                                                            ok

lc_collate values for database "postgres" do not match:  old "en_US.UTF-8", new "de_DE.UTF-8"
Failure, exiting


Version-Release number of selected component (if applicable):
4.2 beta

How reproducible:
100%

Steps to Reproduce:
1. setup oVirt-engine 4.1 with a specific locale
2. change system wide locale
3. add 4.2 repo and try to upgrade with engine-setup

Actual results:
RuntimeError: Command '/opt/rh/rh-postgresql95/root/usr/bin/postgresql-setup' failed to execute

Expected results:
A successful upgrade or a clear error stating how to fix 

Additional info:

workaround:
check the expected system wide locale in /var/lib/pgsql/upgrade_rh-postgresql95-postgresql.log, temporary set it under /etc/locale.conf, execute engine-setup to upgrade to 4.2 and then you can safely revert back /etc/locale.conf to what you need

Comment 1 Lucie Leistnerova 2018-03-07 12:41:23 UTC
Upgrade of engine with changed locales was successful and migrated databases stayed en_US.UTF-8. The same for DWH upgrade on separate machine.

verified in ovirt-engine-setup-4.2.2.2-0.1.el7.noarch

Comment 2 Sandro Bonazzola 2018-03-29 10:56:09 UTC
This bugzilla is included in oVirt 4.2.2 release, published on March 28th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.2 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.