Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qFLjr-0001j9-Dk for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Jun 2023 21:33:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qFLjq-0007tj-4D for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Jun 2023 21:33:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qFLjp-0007tZ-Rb for pgsql-hackers@lists.postgresql.org; Fri, 30 Jun 2023 21:33:09 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qFLjn-001LQY-3q for pgsql-hackers@postgresql.org; Fri, 30 Jun 2023 21:33:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2023062407; h=In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-ID:Content-Description; bh=wJ1vRKI+V2IaO1EBBeqrYAfOj84ZPvxA+g1D+1gL68o=; b=LicgiL2bQW0CJPHK5hU6lJGnov s4Ny7vdUecCUNPs1ecOGfjDHkra8d58TfkRP+CwM/ef7Yv6Pzn3Fi6hdIugqToNZNuzrkdSlnsFos ItkKd9bHGn1KGXmMczpR4FNFP7bQBY8MiAE9Ef3gbbweyMlQpqHPnBr1B41j7DPdzLGyqkO4x5Ry1 KKoXs6mi5rIf55X6E2qamEoqJG9bZ+1blo3/x2EaxlQTKEcRd1QHpaMLFiNXCVTyNRUTGucPDw5uC /SL4GEmpI/hcweTptFCFpq8aDtYNFGZdhODFjrhtxB9oonMOxwKjM8DAEdLzAZVUKnXiRt5likLRL sqDyNHrQ==; Received: from bruce by momjian.us with local (Exim 4.94.2) (envelope-from ) id 1qFLjj-00244P-Qq; Fri, 30 Jun 2023 17:33:03 -0400 Date: Fri, 30 Jun 2023 17:33:03 -0400 From: Bruce Momjian To: Robert Haas Cc: Nikolay Samokhvalov , pgsql-hackers@postgresql.org, Stephen Frost Subject: Re: pg_upgrade instructions involving "rsync --size-only" might lead to standby corruption? Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jun 30, 2023 at 04:16:31PM -0400, Robert Haas wrote: > On Fri, Jun 30, 2023 at 1:41 PM Bruce Momjian wrote: > > I think --size-only was chosen only because it is the minimal comparison > > option. > > I think it's worse than that. I think that the procedure relies on > using the --size-only option to intentionally trick rsync into > thinking that files are identical when they're not. > > Say we have a file like base/23246/78901 on the primary. Unless > wal_log_hints=on, the standby version is very likely different, but > only in ways that don't matter to WAL replay. So the procedure aims to > trick rsync into hard-linking the version of that file that exists on > the standby in the old cluster into the new cluster on the standby, > instead of copying the slightly-different version from the master, > thus making the upgrade very fast. If rsync actually checksummed the > files, it would realize that they're different and copy the file from > the original primary, which the person who wrote this procedure does > not want. What is the problem with having different hint bits between the two servers? > That's kind of a crazy thing for us to be documenting. I think we > really ought to consider removing from this documentation. If somebody > wants to write a reliable tool for this to ship as part of PostgreSQL, > well and good. But this procedure has no real sanity checks and is > based on very fragile assumptions. That doesn't seem suitable for > end-user use. > > I'm not quite clear on how Nikolay got into trouble here. I don't > think I understand under exactly what conditions the procedure is > reliable and under what conditions it isn't. But there is no way in > heck I would ever advise anyone to use this procedure on a database > they actually care about. This is a great party trick or something to > show off in a lightning talk at PGCon, not something you ought to be > doing with valuable data that you actually care about. Well, it does get used, and if we remove it perhaps we can have it on our wiki and point to it from our docs. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you.