Subject: glibc updarte 2.31 to 2.38

From: Paul Foerster <[email-masked]>
Date: Thu, 19 Sep 2024 16:37:41 +0200

Hi,

we have SLES 15.5 which has glibc 2.31. Our admin told us that he's about to install the SLES 15.6 update which contains glibc 2.38.

I have built our PostgreSQL software from source on SLES 15.5, because we have some special requirements which the packages cannot fulfill. So I have questions:

1) Do I have to build it again on 15.6?

2) Does the glibc update have any impact? I recall having to have everything reindexed when the 2.28 update came due to major locale changes, but I didn't have to do it since then.

3) Where and how can I find out if it is necessary to reindex? And how can I find out what indexes would be affected.

I'd really appreciate your comments. Thanks very much in advance.

Paul

---

From: Tom Lane <[email-masked]>
Date: Thu, 19 Sep 2024 11:14:34 -0400

> 1) Do I have to build it again on 15.6?

No, I wouldn't expect that to be necessary.

> 2) Does the glibc update have any impact?

Maybe.  We don't really track glibc changes, so I can't say for sure,
but it might be advisable to reindex indexes on string columns.

			regards, tom lane

---

From: Joe Conway <[email-masked]>
Date: Thu, 19 Sep 2024 13:07:16 -0400

On 9/19/24 11:14, Tom Lane wrote:
>> we have SLES 15.5 which has glibc 2.31. Our admin told us that
>> he's about to install the SLES 15.6 update which contains glibc
>> 2.38.

> but it might be advisable to reindex indexes on string columns.

Every glibc major version change potentially impacts the sorting of some 
strings, which would require reindexing. Whether your actual data trips 
into any of these changes is another matter.

You could check by doing something equivalent to this on every 
collatable column with an index built on it, in every table:

8<-----------
WITH t(s) AS (SELECT <collatable_col> FROM <some_table> ORDER BY 1)
  SELECT md5(string_agg(t.s, NULL)) FROM t;
8<-----------

Check the before and after glibc upgrade result -- if it is the same, 
you are good to go. If not, rebuild the index before *any* DML is done 
to the table.

-- 
Joe Conway
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

---

From: "Peter J. Holzer" <[email-masked]>
Date: Thu, 19 Sep 2024 19:43:49 +0200

On 2024-09-19 16:37:41 +0200, Paul Foerster wrote:
> we have SLES 15.5 which has glibc 2.31. Our admin told us that he's
> about to install the SLES 15.6 update which contains glibc 2.38.
> 
> I have built our PostgreSQL software from source on SLES 15.5, because
> we have some special requirements which the packages cannot fulfill.
> So I have questions:
> 
> 2) Does the glibc update have any impact? I recall having to have
> everything reindexed when the 2.28 update came due to major locale
> changes, but I didn't have to do it since then.
> 
> 3) Where and how can I find out if it is necessary to reindex?

I wrote a small script[1] which prints all unicode code points and a few
selected[2] longer strings in order. If you run that before and after
the upgrade and the output doesn't change, you are probably be fine.
(It checks only the default collation, though: If you have indexes using
a different collation you would have to modify the script accordingly.)

If there are differences, closer inspection might show that the changes
don't affect you. But I would reindex all indexes on text (etc.) columns
just to be sure.

        hp

[1] https://git.hjp.at:3000/hjp/pgcollate
[2] The selection is highly subjective and totally unscientific.
    Additions are welcome.

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | [email-masked]         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

---

From: Paul Foerster <[email-masked]>
Date: Thu, 19 Sep 2024 19:56:20 +0200

Hi Tom,

> On 19 Sep 2024, at 17:14, Tom Lane <[email-masked]> wrote:
> 

I was hoping one of the pros would say that. 🤣

> but it might be advisable to reindex indexes on string columns.

Advisable is a word I undfortunately can't do much with. We have terabytes and terabytes of data in hundreds of databases each having potentially hundreds of columns that are candidates. Just reindexing and taking down applications during that time is not an option in a 24x7 high availability environment.

Cheer,
Paul

---

From: Joe Conway <[email-masked]>
Date: Thu, 19 Sep 2024 14:09:38 -0400

> Advisable is a word I undfortunately can't do much with. We have
> terabytes and terabytes of data in hundreds of databases each having
> potentially hundreds of columns that are candidates. Just reindexing
> and taking down applications during that time is not an option in a
> 24x7 high availability environment.

See my thread-adjacent email, but suffice to say that if there are 
collation differences that do affect your tables/data, and you allow any 
inserts or updates, you may wind up with corrupted data (e.g. duplicate 
data in your otherwise unique indexes/primary keys).

For more examples about that see 
https://joeconway.com/presentations/glibc-SCaLE21x-2024.pdf

An potential alternative for you (discussed at the end of that 
presentation) would be to create a new branch based on your original 
SLES 15.5 glibc RPM equivalent to this:

https://github.com/awslabs/compat-collation-for-glibc/tree/2.17-326.el7

The is likely a non trivial amount of work involved (the port from the 
AL2 rpm to the RHEL7 rpm took me the better part of a couple of days), 
but once done your collation is frozen to the specific version you had 
on 15.5.

---

From: Paul Foerster <[email-masked]>
Date: Thu, 19 Sep 2024 20:12:13 +0200

Hi Peter,

> On 19 Sep 2024, at 19:43, Peter J. Holzer <[email-masked]> wrote:
> 

I'm not a Python specialist but I take it that the script need psycopg2, which we probably don't have. So I'd have to build some sort of venv around that like I had to do to get Patroni working on our systems.

Well, we'll see.

Thanks for this script.

Cheers,
Paul