Bug 1579268 - Upgrade of PostgreSQL during RHV 4.1 to 4.2 upgrade fails with locale mismatch
Summary: Upgrade of PostgreSQL during RHV 4.1 to 4.2 upgrade fails with locale mismatch
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 4.2.3
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: ovirt-4.2.3-1
: ---
Assignee: Yedidyah Bar David
QA Contact: Lucie Leistnerova
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-17 09:31 UTC by Peter McGowan
Modified: 2022-07-09 09:55 UTC (History)
24 users (show)

Fixed In Version: ovirt-engine-4.2.3.6
Doc Type: If docs needed, set a value
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-06-21 12:02:48 UTC
oVirt Team: Integration
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Engine setup log (761.60 KB, text/plain)
2018-05-17 10:13 UTC, Peter McGowan
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1528371 0 high CLOSED engine-setup fails to upgrade postgres from 9.2 to 9.5 if the system wide locale differs from system wide locale at firs... 2021-02-22 00:41:40 UTC
Red Hat Knowledge Base (Solution) 3449481 0 None None None 2018-05-23 22:25:58 UTC
Red Hat Product Errata RHSA-2018:2071 0 normal SHIPPED_LIVE Moderate: Red Hat Virtualization Manager security, bug fix, and enhancement update 2018-06-27 14:02:00 UTC
oVirt gerrit 91334 0 'None' 'MERGED' 'Revert "packaging: setup: postgres95: Pass locale"' 2019-12-09 15:11:43 UTC
oVirt gerrit 91335 0 'None' 'MERGED' 'packaging: setup: postgres95: Pass locale' 2019-12-09 15:11:43 UTC
oVirt gerrit 91336 0 'None' 'MERGED' 'Revert "packaging: setup: postgres95: Pass locale"' 2019-12-09 15:11:43 UTC
oVirt gerrit 91337 0 'None' 'MERGED' 'packaging: setup: postgres95: Pass locale' 2019-12-09 15:11:43 UTC

Internal Links: 1528371

Description Peter McGowan 2018-05-17 09:31:02 UTC
Description of problem:
Attempting to upgrade a RHV 4.1 installation to 4.2 fails with an error during the PostgreSQL upgrade. The file /var/lib/pgsql/upgrade_rh-postgresql95-postgresql.log contains the error: 

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

The databases on the server do indeed have mixed locales:

postgres=# \l
                                             List of databases
         Name         |        Owner         | Encoding |   Collate   |    Ctype    |   Access privileges
----------------------+----------------------+----------+-------------+-------------+-----------------------
 engine               | engine               | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 ovirt_engine_history | ovirt_engine_history | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 postgres             | postgres             | UTF8     | en_GB.UTF-8 | en_GB.UTF-8 |
 template0            | postgres             | UTF8     | en_GB.UTF-8 | en_GB.UTF-8 | =c/postgres          +
                      |                      |          |             |             | postgres=CTc/postgres
 template1            | postgres             | UTF8     | en_GB.UTF-8 | en_GB.UTF-8 | =c/postgres          +
                      |                      |          |             |             | postgres=CTc/postgres
(5 rows)

The system locale is as follows:

# locale
LANG=en_GB.UTF-8
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=

Version-Release number of selected component (if applicable):
Upgrade from 4.1 to 4.2

How reproducible:
Every time

Steps to Reproduce:
1. Unsure. The existing RHV system was upgraded from 4.0 to 4.1, but I'm not sure how the original locale settings were created.

Actual results:
Upgrade failure

Expected results:
Upgrade success

Additional info:

Comment 1 Yaniv Lavi 2018-05-17 09:44:08 UTC
I believe many of our customers will be affected, by the unfiltered DB check.
Can you please assign urgently? I believe this is an async candidate.

Comment 2 Yedidyah Bar David 2018-05-17 09:52:16 UTC
(In reply to Peter McGowan from comment #0)
> Steps to Reproduce:
> 1. Unsure. The existing RHV system was upgraded from 4.0 to 4.1, but I'm not
> sure how the original locale settings were created.

This is the hard part :-(

I'd expected this bug to be fixed by the fix to bug 1528371 (that is, close it as duplicate of it), but apparently it's not, but not sure how to reproduce.

Please attach engine-setup logs, for a start, so that we can see we passed the correct/intended options to postgresql-setup. If we did, we need to understand how to reproduce.

Comment 3 Sandro Bonazzola 2018-05-17 10:09:54 UTC
Restoring lost needinfo

Comment 5 Peter McGowan 2018-05-17 10:13:41 UTC
Created attachment 1437871 [details]
Engine setup log

Comment 6 Peter McGowan 2018-05-17 10:22:06 UTC
As far as I can remember, the RHV 4.0 system was a clean RHEL 7 installed on 2017-12-05, expressly to upgrade a RHEV 3.6 environment. I would have installed a fairly basic RHEL 7 installation as suggested by the upgrade docs, then performed the steps to export the old 3.6 databases and install RHV 4.0. I don't remember explicitly setting the locale but I installed the RHEL 7 system using the GUI installer, so it was probably set by anaconda when I set my timezone.

Comment 7 Yedidyah Bar David 2018-05-17 10:22:55 UTC
Thanks. The fix for 1528371 didn't work - e.g., we didn't check lc_collate. Looking

Comment 8 Yedidyah Bar David 2018-05-17 10:32:44 UTC
OK, now I understand.

Seems like the fix for bug 1528371 for the 4.2 branch was broken.

Sorry, must have been something in the way I handled the back-porting.

Will fix soon.

Comment 10 Lucie Leistnerova 2018-05-28 11:45:59 UTC
Engine upgraded with postgres database in SQL_ASCII or en_GB.UTF-8 encoding with success.

verified in ovirt-engine-4.2.3.8-0.1.el7.noarch

Comment 14 Franta Kust 2019-05-16 13:08:49 UTC
BZ<2>Jira Resync


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