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 1o9WoZ-00062P-Ax for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Jul 2022 19:05:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o9WoY-0003WH-42 for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Jul 2022 19:05:26 +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 1o9WoX-0003SY-Qn for pgsql-hackers@lists.postgresql.org; Thu, 07 Jul 2022 19:05:25 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o9WoU-0007YY-2t for pgsql-hackers@postgresql.org; Thu, 07 Jul 2022 19:05:24 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 267J5Jpi3033000; Thu, 7 Jul 2022 15:05:19 -0400 From: Tom Lane To: Justin Pryzby cc: Robert Haas , Bruce Momjian , pgsql-hackers@postgresql.org, Shruthi Gowda Subject: Re: pg15b2: large objects lost on upgrade In-reply-to: <20220707184410.GB13040@telsasoft.com> References: <20220702154917.GM13040@telsasoft.com> <20220705165605.GR13040@telsasoft.com> <20220706115600.GU13040@telsasoft.com> <20220707171019.GA13040@telsasoft.com> <20220707184410.GB13040@telsasoft.com> Comments: In-reply-to Justin Pryzby message dated "Thu, 07 Jul 2022 13:44:10 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3032998.1657220719.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 07 Jul 2022 15:05:19 -0400 Message-ID: <3032999.1657220719@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Justin Pryzby writes: > On Thu, Jul 07, 2022 at 02:38:44PM -0400, Robert Haas wrote: >> On Thu, Jul 7, 2022 at 2:24 PM Bruce Momjian wrote: >>> Uh, that initdb-created pg_largeobject file should not have any data i= n >>> it ever, as far as I know at that point in pg_upgrade. How would valu= es >>> have gotten in there? Via pg_dump? >> I was thinking if the user had done it manually before running pg_upgra= de. > We're referring to the new cluster which should have been initdb'd more = or less > immediately before running pg_upgrade [0]. > It'd be weird to me if someone were to initdb a new cluster, then create= some > large objects, and then maybe delete them, and then run pg_upgrade. AFAIK you're voiding the warranty if you make any changes at all in the destination cluster before pg_upgrade'ing. As an example, if you created a table there you'd be risking an OID and/or relfilenode collision with something due to be imported from the source cluster. > Actually, I think check_new_cluster_is_empty() ought to prohibit doing w= ork > between initdb and pg_upgrade by checking that no objects have *ever* be= en > created in the new cluster, by checking that NextOid =3D=3D 16384. It would be good to have some such check; I'm not sure that that one in particular is the best option. > But I have a > separate thread about "pg-upgrade allows itself to be re-run", and this = has > more to do with that than about whether to check that the file is empty = before > removing it. Yeah, that's another foot-gun in the same area. regards, tom lane