Bug 1668301

Summary: Warn about possible glibc collation changes after pg_upgrade
Product: [Fedora] Fedora Reporter: Pavel Raiskup <praiskup>
Component: postgresqlAssignee: Patrik Novotný <panovotn>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 28CC: anon.amish, devrim, hhorak, jmlich83, jstanek, panovotn, pkajaba, pkubat, praiskup, tgl
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: postgresql-11.2-3.fc30 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-03-29 19:10:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pavel Raiskup 2019-01-22 12:06:04 UTC
As the most recent example, in Fedora 28 and RHEL 8 there have been
extensive changes in glibc collations to support ISO 14651:2016 [1, 2].

This might affect consistency of database indexes after `postgresql-setup
--upgrade` run (wrapped pg_upgrade run), after upgrade from previous
distribution version(s).  Upgrades within one Fedora release (e.g. from
module postgresql:10 to postgresql:11) are fine (glibc version intact).

To be precise, this problem is not only specific to F27->F28 transition,
something similar might happen in any distribution upgrade in the future
as collations naturally change over the time.

Possible mitigations:

- I was informed that glibc team works on C.UTF-8 unicode collation
  support that should be immune to this problem forever, as non-unicode
  C/POSIX collations already are.

- recent versions of PostgreSQL (version 10 and newer) got support for
  collations provided by libicu library.  It doesn't mean that libicu
  collations aren't expected to change over time, but there is at least
  mechanism for collation versioning - so users can better track changes.
  It requires PG server re-build with ./configure --with-icu, which I'll
  do soon

- issue REINDEX after major Fedora upgrade and pg_upgrade run, when
  the database is expected to be affected

Regarding the last point, I'm thinking about new warning in
postgresql-setup printed right after successful pg_upgrade run, saying
something like (wording by Carlos O'Donell, thanks):

  WARNING: If you've just upgraded your database from a previous major
  version of Fedora or RHEL, please run reindexdb against your databases.
  Core library collation data may have changed and this will invalidate
  database indexes.  Most recently in Fedora 28 and RHEL 8 there have been
  extensive changes in glibc collations to support ISO 14651:2016 (Unicode
  9.0.0 data) and your indexes may be affected:
  https://sourceware.org/ml/libc-announce/2018/msg00002.html

Does this sound good?  Anything else worth informing the user about,
regarding the glibc collation change?

[1] https://fedoraproject.org/wiki/Changes/Glibc_collation_update_and_sync_with_cldr
[2] https://sourceware.org/ml/libc-announce/2018/msg00002.html

Comment 1 Pavel Raiskup 2019-01-23 17:05:01 UTC
Horror story where a "late" reindex failed:
https://postgresql.verite.pro/blog/2018/08/27/glibc-upgrade.html#comment-4296929631

Comment 2 Fedora Update System 2019-03-05 14:50:09 UTC
postgresql-11.2-3.fc30 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-e0167a45ab

Comment 3 Fedora Update System 2019-03-06 22:20:45 UTC
postgresql-11.2-3.fc30 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-e0167a45ab

Comment 4 Fedora Update System 2019-03-06 22:53:43 UTC
postgresql-11.2-3.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-e0167a45ab

Comment 5 Fedora Update System 2019-03-29 19:10:07 UTC
postgresql-11.2-3.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.