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 1jlxaw-0005pQ-Pt for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Jun 2020 16:40:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jlxav-00042L-HT for pgsql-bugs@arkaria.postgresql.org; Thu, 18 Jun 2020 16:40:53 +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 1jlxav-00040R-BF for pgsql-bugs@lists.postgresql.org; Thu, 18 Jun 2020 16:40:53 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlxat-0000vr-0T for pgsql-bugs@lists.postgresql.org; Thu, 18 Jun 2020 16:40:52 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1jlxaq-0005G6-8G; Thu, 18 Jun 2020 12:40:48 -0400 Date: Thu, 18 Jun 2020 12:40:48 -0400 From: Bruce Momjian To: Jeff Janes Cc: Tom Lane , Michael Paquier , ram.maurya@lavainternational.in, pgsql-bugs Subject: Re: BUG #16497: old and new pg_controldata WAL segment sizes are invalid or do not match Message-ID: <20200618164048.GJ7349@momjian.us> References: <16497-38bb1f1bcec44964@postgresql.org> <20200618080509.GH118592@paquier.xyz> <1549966.1592493410@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Jun 18, 2020 at 12:14:25PM -0400, Jeff Janes wrote: > On Thu, Jun 18, 2020 at 11:16 AM Tom Lane wrote: > > Jeff Janes writes: > > Since wal-segsize is changeable with pg_resetwal since v11, and > pg_upgrade > > is already calling pg_resetwal, shouldn't pg_upgrade ideally just deal > with > > this situation automatically by allowing the upgrade to also change this > > value, rather than forcing the user to make them match manually? > > The issue is that this is an initdb parameter, and pg_upgrade expects you > to have already initdb'd the destination cluster.  We could redefine that, > perhaps, but it'd be a large change in how one uses pg_upgrade and would > certainly break a lot of scripts. > > I'm aware that we could use pg_resetwal to deal with this one specific > initdb parameter, but I see no point in hacking around the problem for > just one parameter.  The general principle remains that you need to > initdb the target with the same settings you used for the source. > > > Since you mention it, now that -B is not necessary (inferred from where > pg_upgrade itself is found), I have certainly thought it would also be nice if > -D could point to a non-existent or empty directory, and have it do the initdb > for you.  It would be nice to have it figure out the correct settings of -E, > -U, --lc-collate, --lc-ctype and whatever else is needed to make --check pass, > rather than doing it all manually (and one at a time, since it stops at the > first error).  It doesn't seem like this, or the previously described change, > would break any scripts which currently work.  It might cause some currently > broken ones to work in ways that are unexpected, though. Yes, it would be nice, but there is also the requirement of adjusting postgresql.conf to match the old cluster. I am not sure we can get away without that step, but looking at how people automate pg_upgrade would help determine that. Basically, if pg_upgrade ran initdb, we would need to automate steps 5-8 here: https://www.postgresql.org/docs/12/pgupgrade.html -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee