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 1lKXgF-0000k7-Ju for pgsql-admin@arkaria.postgresql.org; Fri, 12 Mar 2021 02:37:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lKXgE-0005dQ-H6 for pgsql-admin@arkaria.postgresql.org; Fri, 12 Mar 2021 02:37:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lKXgE-0005dI-9m for pgsql-admin@lists.postgresql.org; Fri, 12 Mar 2021 02:37:34 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lKXgB-0006nS-IM for pgsql-admin@postgresql.org; Fri, 12 Mar 2021 02:37:33 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1lKXg8-0004qg-Fn; Thu, 11 Mar 2021 21:37:28 -0500 Date: Thu, 11 Mar 2021 21:37:28 -0500 From: Bruce Momjian To: Stephen Frost Cc: tsuraan , pgsql-admin@postgresql.org Subject: Re: Streaming replication upgrade sanity check Message-ID: <20210312023728.GB2999@momjian.us> References: <20210312005016.GV20766@tamriel.snowman.net> <20210312005557.GA2999@momjian.us> <20210312010124.GW20766@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210312010124.GW20766@tamriel.snowman.net> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Mar 11, 2021 at 08:01:24PM -0500, Stephen Frost wrote: > > He/she wants to run the standby, I guess in read-only mode, while > > pg_upgrade is running, which is why I didn't even bother to mention > > that. I think if downtime is the critical for this person, he/she > > should be using logical replication for the upgrade. pg_upgrade really > > wants full control of the primary/standbys during its operation, and if > > you can't do that, pg_upgrade is not the right tool to use. > > What I typically do in that case is just spin up more replicas and let > those handle the read load while the upgrade happens, and then throw > them away after the upgrade of the primary plus the other standbys is > done. I do agree that logical replication could be an alternative but > that takes a lot longer and puts a number of constraints on what you can > do while it's going on (DDL changes and such have to be done carefully, > etc). Agreed. He/she could use some replicas to take read-only traffic while the upgrade happens, and use others to do a quick rsync upgrade using the intructions in the pg_upgrade docs. I agree logical replication is a lot more complex. > > > unlogged tables before the pg_upgrade, et al, otherwise you'll end up > > > rsync'ing those over. Also make sure you haven't got any stray or > > > forgotten temp files or other things. Again, done properly, the rsync > > > to upgrade the standbys should only be copying the catalog tables > > > themselves and it should be quite fast. > > > > Yes, good points. > > Yeah.. Would really be nice if we had a custom written tool which knew > how to detect unlogged tables and not try to copy them over and such. > Might be able to make something that's faster and less error-prone than > the rsync approach since we know a lot more about the PG data dir than > rsync does. True. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee