Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sKGrB-009Cft-FT for pgsql-general@arkaria.postgresql.org; Thu, 20 Jun 2024 12:25:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sKGr7-006KZa-VB for pgsql-general@arkaria.postgresql.org; Thu, 20 Jun 2024 12:25:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sKGr7-006KZ4-G8 for pgsql-general@lists.postgresql.org; Thu, 20 Jun 2024 12:25:34 +0000 Received: from mail-oa1-x2f.google.com ([2001:4860:4864:20::2f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sKGr5-002FXD-LE for pgsql-general@postgresql.org; Thu, 20 Jun 2024 12:25:33 +0000 Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-25cb15eed97so380457fac.2 for ; Thu, 20 Jun 2024 05:25:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718886331; x=1719491131; darn=postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=n40XziI9eQiTM/Unz5XyiBObUO3uR4B+rSR2i9n5uYw=; b=c27yUdE95p4weruBLCHD0/SPewXBB4lUEUYkOuPhFin4QKinmTC1032gswbMBvypkA 7oh42JXEzjtYwNnLglmJn0MtvF/ft4DjLBEYAAs7iEt4LWvoeesVMPQh+TSGN2gOMvNz yPEymGesWke2JVnw6IUMlGm5icYgSf/dfmWHK4kiUVvkZqNPV2GkZlOGVTOYxCIc7bNA D+dmWSR6r2JmsFAE48m3yxh8MYb7JWQ8IyH5lr6OVOw/zGDICz9NODPU3oqp0LQVUod8 wmG6LXmoqR2TT6uw1VTRfA6i0Zl8HHO4SAqrjqB5nvvvovTj9XHn04gKP5p3SNQPVyJ+ iFJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718886331; x=1719491131; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=n40XziI9eQiTM/Unz5XyiBObUO3uR4B+rSR2i9n5uYw=; b=AEobeXaxHIonWkZ0vkrsIIWYpSr+78cW3xGKpXTCm+BWYbOG+bKiDPthbcw7O5pMbQ OIrgpGuqRs9acPf+6mWL07ITwUALsALbogkr0WWHtGLqfrCicOoXkidYrsw6nS5GGdCC EIq41dal6y213IIebrmWAWtCDmuE4lajbBeqSpuh//22cX+OQs0acdNiQXU95HInsQ9j 7bf/3M2jwCwtkf57nhffWJRMBfRaOSkGiYFNNIstulZ4hnOgIxFdBfMUwy4MXsUobiWB r7U9/a4jD+x6X6UFlXfGohOFb9UCl9bxcgE2yvwQlApEUjiF2Pij00/dlDBIs5U4gaZG vTUA== X-Gm-Message-State: AOJu0YyhXakn9T/j82ezqb4WDAusdtbllxjDngifgtchlRooGz4UAWKb wYsPzm7gacTCgFNzhsJdUY/DSLeZmvKjf41+9tso9DVNqbUgYOIwAUKcxbZLh9V/NcQrrHQ1mLP HB4jkWXwa/UskWvQJiRJeNwje3uPQ3B9q X-Google-Smtp-Source: AGHT+IFPtWuYal0XUz+SEobg4tOQwLzAm2aD+YW96F6MGBwu4Hf5u2Wj5kaRkptD4dEA6mMAW6rQjYYiw/DM5d6VtFQ= X-Received: by 2002:a05:6871:1cc:b0:255:d15:5acf with SMTP id 586e51a60fabf-25c94d05a09mr6195366fac.36.1718886330740; Thu, 20 Jun 2024 05:25:30 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ron Johnson Date: Thu, 20 Jun 2024 08:25:19 -0400 Message-ID: Subject: Re: Help. The database was created using collation version 2.17, but the operating system provides version 2.34. To: pgsql-general Content-Type: multipart/alternative; boundary="000000000000273a44061b5169c7" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000273a44061b5169c7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jun 20, 2024 at 3:23=E2=80=AFAM Dmitry O Litvintsev wrote: > Hello, > > I am in the process of migrating DB to Alma9 host. The databse > is rather large - few TBs. > > I have run pg_basebackup on Alma9 host and established replication from > production to it. The idea is to quickly switch from master to this new > host during downtime. > > Establishing replication went fine. Source postgresql version is 15.6, > destination is 15.7 > > When I psql into replica I get: > > WARNING: database "xxx" has a collation version mismatch > DETAIL: The database was created using collation version 2.17, but the > operating system provides version 2.34. > HINT: Rebuild all objects in this database that use the default collatio= n > and run ALTER DATABASE xxx REFRESH COLLATION VERSION, or build PostgreSQL > with the right library version. > > Looking up the issue the solution seems to be > > REINDEX database xxx > ALTER DATABASE xxx REFRESH COLLATION VERSION > > But this defeats the whole idea of having short downtime because REINDEX > will take forever. > > What is this "or build PostgreSQL with the right library version"? > Is this about 15.7 vs 15.6 or is it about different glibc version between > RH7 and Alma9? > > Is there a better way to handle it? I cannot afford long downtime. You "only" need to REINDEX indices with TEXT (including CHAR and VARCHAR) columns. That may be most of your indices, or very few. I use this view and query to find such indices: create or replace view dba.all_indices_types as select tbcl.relnamespace::regnamespace::text||'.'||tbcl.relname as table_name , ndcl.relname as index_name , array_agg(ty.typname order by att.attnum) as index_types from pg_class ndcl inner join pg_index nd on (ndcl.oid =3D nd.indexrelid and ndcl.relkind =3D 'i') inner join pg_class tbcl on (nd.indrelid =3D tbcl.oid and tbcl.relkind =3D 'r') inner join pg_attribute att on att.attrelid =3D nd.indexrelid inner join pg_type ty on att.atttypid =3D ty.oid where tbcl.relnamespace::regnamespace::text !=3D 'pg_catalog' group by tbcl.relnamespace::regnamespace::text||'.'||tbcl.relname , ndcl.relname order by 1, 2; select * from dba.all_indices_types where index_types && '{"text","varchar","char"}'; --000000000000273a44061b5169c7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Jun 20, 2024 at 3:23=E2=80=AFAM D= mitry O Litvintsev <litvinse@fnal.g= ov> wrote:
Hello,

I am in the process of migrating DB to Alma9 host. The databse
is rather large - few TBs.

I have run pg_basebackup on Alma9 host and established replication from pro= duction to it. The idea is to quickly switch from master to this new host d= uring downtime.

Establishing replication went fine. Source postgresql version is 15.6, dest= ination is 15.7

When I psql into replica I get:

WARNING:=C2=A0 database "xxx" has a collation version mismatch DETAIL:=C2=A0 The database was created using collation version 2.17, but th= e operating system provides version 2.34.
HINT:=C2=A0 Rebuild all objects in this database that use the default colla= tion and run ALTER DATABASE xxx REFRESH COLLATION VERSION, or build Postgre= SQL with the right library version.

Looking up the issue the solution seems to be

=C2=A0 REINDEX database xxx
=C2=A0 ALTER DATABASE xxx REFRESH COLLATION VERSION

But this defeats the whole idea of having short downtime because REINDEX wi= ll take forever.

What is this "or build PostgreSQL with the right library version"= ?
Is this about 15.7 vs 15.6 or is it about different glibc version between R= H7 and Alma9?

Is there a better way to handle it? I cannot afford long downtime.

You "only" need to REINDEX indices with T= EXT (including CHAR and VARCHAR) columns. That may be most of your indices,= or very few.

I use this view and query to find su= ch indices:

create or rep= lace view dba.all_indices_types as
=C2=A0 =C2=A0 select tbcl.relnamespac= e::regnamespace::text||'.'||tbcl.relname as table_name
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 , ndcl.relname as index_name
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 , array_agg(ty.typname order by att.attn= um) as index_types
=C2=A0 =C2=A0 from pg_class ndcl
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 inner join pg_index nd
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 on (ndcl.oid =3D nd.indexrelid and ndcl.relkind =3D 'i')
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 inner join pg_class tbcl
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 on (nd.indrelid =3D tbcl.oid and tbcl.relkind =3D '= ;r')
=C2=A0 =C2=A0 =C2=A0 =C2=A0 inner join pg_attribute att
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 on att.attrelid =3D nd.indexrelid=C2=A0 =C2=A0 =C2=A0 =C2=A0 inner join pg_type ty
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 on att.atttypid =3D ty.oid
=C2=A0 =C2=A0 where tbcl= .relnamespace::regnamespace::text !=3D 'pg_catalog'
=C2=A0 =C2= =A0 group by tbcl.relnamespace::regnamespace::text||'.'||tbcl.relna= me
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 , ndcl.relname
=C2=A0 = =C2=A0 order by 1, 2;

sel= ect *=C2=A0
from dba.all_indices_= types=C2=A0
where index_types &am= p;& '{"text","varchar","char"}';<= br>


--000000000000273a44061b5169c7--