Bug 1525976

Summary: On Centos7 docker engine upgrade fails from 4.1 to 4.2 with due to encoding of postgres database
Product: [oVirt] ovirt-engine Reporter: Katerina Koukiou <kkoukiou>
Component: Setup.EngineAssignee: Eli Mesika <emesika>
Status: CLOSED NOTABUG QA Contact: Pavel Stehlik <pstehlik>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.1.7.6CC: bugs, kkoukiou, mperina
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-15 07:16:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Katerina Koukiou 2017-12-14 14:15:47 UTC
Description of problem:

How reproducible:

Steps to Reproduce:
1. Upgrade engine from ovirt-4.1 to ovirt-4.2 in Centos 7 docker container.

Actual results:

Upgrading of postgresql during engine-setup fails with the following.



-----------------------------------

[root@2fbce6e08864 /]# cat /var/lib/pgsql/upgrade_rh-postgresql95-postgresql.log
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
  postgres
  template1
                                                            ok

encodings for database "postgres" do not match:  old "SQL_ASCII", new "UTF8"
Failure, exiting
-----------------------------------

Expected results:

ovirt-setup should handle the encodings of all databases and succed the postgresql upgrade.

Additional info:

From ovirt-engine-setup.log : http://pastebin.test.redhat.com/540848

List of Databases: http://pastebin.test.redhat.com/540849

Comment 1 Katerina Koukiou 2017-12-14 15:48:49 UTC
Maybe it will help to mention here that when I run engine-setup (not upgrading)I get differences in the encoding of the databases (apart from engine) like following:

After 4.1 engine setup:
postgres=# \l
                                  List of databases
   Name    |  Owner   | Encoding  |   Collate   |    Ctype    |   Access privileges   
-----------+----------+-----------+-------------+-------------+-----------------------
 engine    | engine   | UTF8      | en_US.UTF-8 | en_US.UTF-8 | 
 postgres  | postgres | SQL_ASCII | C           | C           | 
 template0 | postgres | SQL_ASCII | C           | C           | =c/postgres          +
           |          |           |             |             | postgres=CTc/postgres
 template1 | postgres | SQL_ASCII | C           | C           | =c/postgres          +
           |          |           |             |             | postgres=CTc/postgres
(4 rows)


After 4.2 engine setup:

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

Comment 2 Martin Perina 2017-12-14 16:12:01 UTC
Hmm, I didn't know that we have released oVirt 4.1 as a docker image. Where is this image downloaded from?

Comment 3 Katerina Koukiou 2017-12-14 16:23:25 UTC
@Martin Perina I am using some Centos7 image from dockerhub, https://hub.docker.com/r/chrismeyers/centos7/.

You can see more info about how I am running the tests in this PR: https://github.com/oVirt/ovirt-ansible-engine-setup/pull/1/files#diff-fdf20b77748edf2237d05f41bf9a411a

Comment 4 Katerina Koukiou 2017-12-14 16:59:50 UTC
JFYI I realized the aforementioned behavior accurs only when locale isi not UTF-8 but POSIX.
When locale is UTF-8 everything works as expected.

Comment 5 Martin Perina 2017-12-15 07:16:38 UTC
Also mentioned in [1], that we support database only in en_US.UTF-8 locale, so closing as not a bug

[1] https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.1/html/installation_guide/appe-preparing_a_remote_postgresql_database_for_use_with_the_red_hat_enterprise_virtualization_manager