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 1sKE9I-008x9k-TH for pgsql-general@arkaria.postgresql.org; Thu, 20 Jun 2024 09:32:08 +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 1sKE9G-003OOB-LQ for pgsql-general@arkaria.postgresql.org; Thu, 20 Jun 2024 09:32:07 +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 1sKE9G-003OO2-9H for pgsql-general@lists.postgresql.org; Thu, 20 Jun 2024 09:32:07 +0000 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sKE9E-002DwD-1J for pgsql-general@lists.postgresql.org; Thu, 20 Jun 2024 09:32:05 +0000 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2ebe3bac6c6so7555111fa.1 for ; Thu, 20 Jun 2024 02:32:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salesforce.com; s=google; t=1718875921; x=1719480721; darn=lists.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=wqut45MbhFqOuiewzdvPkTt4MGzV6IBVQ1e4QPXrHOI=; b=PLj2Otjeb2f0h+vdSobGZ562qfWavbt7nxCqhjsMfgZOAqkmm2jbrgTOFR1r8vJ/ZT U8QPlRL9EXyZu8B+DSCo6Scha4hnOa9kh6Ovce4exoQvVzDgkVxEu3Bzw3NkFwpO26ON VMQCbeNrjA462W7n9BSeh/aD2V91r0Cb3ztv4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718875921; x=1719480721; 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=wqut45MbhFqOuiewzdvPkTt4MGzV6IBVQ1e4QPXrHOI=; b=R0q7kwvmHjVBXAIIiaDmfR94CNfVG7BUA73NRMTwqmY8KPNNWwPbrF/ALWNTMRDTzR x9QOgUn/tAgNTDeOzKJST72vlUYSTpp/pHQDtHk2UogIS5QVs5rDY/HzQ1Y5CX9youeO UFLnfjO1wPYUhLejscHtoGzVdJj8pZt7+cm0vvXC9l4vvEf765Y93Q+pcyac4axDrRrG B9ShgDffLDa79a38gLT9kPL8U0SNgQlhAsga+zJLE19myBCuGYx6P8T+56e2kibCqeAd 2g5wQ/z5OFwaGYGvvUAobS4B8oTaCrI5igmv8UYWhfMteeuGAcLk1lHUCJBzCoeCnFfg pfsA== X-Gm-Message-State: AOJu0Ywkznhf7Dx2vfpDGCOU5LbYk2Hh+wipWW4wZEw7WfiXKu33WePQ n8etJacSRICzFigM4OD/3F2ecwNCZgnk8dhAJOTkKyyb/D01pp5ZMuCfHaqedWPhKmAnESb9xLj uCHrQHT8qQGUWw1KdinucZowNyJdFyG0ssu1TqfP6dYkf02nIRvJ4vZgO X-Google-Smtp-Source: AGHT+IEltS90jF+06lVHviASdrixHtTr0KC88F/d0VKJi0uKaNYhajT7pF0633uz+VRrMydnZt2YM5TMW5pibvuyQHs= X-Received: by 2002:a2e:3219:0:b0:2ec:140c:8956 with SMTP id 38308e7fff4ca-2ec3cee1333mr35477311fa.42.1718875920781; Thu, 20 Jun 2024 02:32:00 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Kenneth Barber Date: Thu, 20 Jun 2024 19:31:49 +1000 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@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > 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 What replication did you use? If it's streaming, you will have this problem. If you can use logical replication and something like: https://github.com/dimitri/pgcopydb It will allow you to use the logical replication trick to lower downtime. It involves copying the database using a parallel transfer (and some pg_dump/pg_restore wrapping for the structural stuff), and using logical replication to keep the target up to date. It will allow you to keep writing to your source DB while it moves, but at the cost of disabling DDL while it's happening. Look at the pgcopydb clone --follow documentation for more info. I'm sure there are other options people can recommend also. I would test it thoroughly beforehand to make sure it's a fit. > 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 collation 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 Here we've taken two approaches when we just "copied the disks over" so to speak: * Backport the collation library (tricky, I can explain this deeper, but it's tricky) * Reindex after migration (slow but less tricky) We had this problem going from xenial to focal, and we had to pin to something compatible with the xenial libc. > 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. > This came up rather unexpectedly and I am now in a tight situation having to find solution fast. I do not recall having similar issue when going from RH6 to RH7. Unfortunately you've hit a bad problem that a few of us have probably already been through. At least you don't have thousands of these things :-). ken.