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 1osVOu-00021X-9E for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Nov 2022 20:40:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1osVOs-0004HO-2Q for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Nov 2022 20:40:50 +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 1osVOr-0004HD-Oy for pgsql-hackers@lists.postgresql.org; Tue, 08 Nov 2022 20:40:49 +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 1osVOp-00082s-GH for pgsql-hackers@lists.postgresql.org; Tue, 08 Nov 2022 20:40:48 +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 2A8KehCq3824195; Tue, 8 Nov 2022 15:40:43 -0500 From: Tom Lane To: Andres Freund cc: pgsql-hackers@lists.postgresql.org, Robert Haas Subject: Re: Non-emergency patch for bug #17679 In-reply-to: <20221108203117.2qalrihg3circg3o@awork3.anarazel.de> References: <3797575.1667924888@sss.pgh.pa.us> <20221108203117.2qalrihg3circg3o@awork3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Tue, 08 Nov 2022 12:31:17 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3824193.1667940043.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 08 Nov 2022 15:40:43 -0500 Message-ID: <3824194.1667940043@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > On 2022-11-08 11:28:08 -0500, Tom Lane wrote: >> Hence, the attached reverts everything 4ab5dae94 did to this function, >> and most of 0e758ae89 too, and instead makes IsBinaryUpgrade an >> additional reason to take the immediate-unlink path. > I wonder if it's worth aiming slightly higher. There's plenty duplicated= code > between the first segment handling and the loop body. Perhaps the if at = the > top just should decide whether to unlink the first segment or not, and w= e then > check that in the body of the loop for segno =3D=3D 0? I don't care for that. I think the point here is precisely that we want behavior A for the first segment and behavior B for the remaining ones, and so I'd prefer to keep the code that does A and the code that does B distinct. It was a misguided attempt to share that code that got us into trouble here in the first place. Moreover, any future changes to either behavior will be that much harder if we combine the implementations. regards, tom lane