Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hal1V-0003nT-QR for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Jun 2019 17:57:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hal1U-0006au-C8 for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Jun 2019 17:57:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hal1U-0006an-3W for pgsql-hackers@lists.postgresql.org; Tue, 11 Jun 2019 17:57:28 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hal1R-00087n-SA for pgsql-hackers@lists.postgresql.org; Tue, 11 Jun 2019 17:57:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x5BHvGPw018287; Tue, 11 Jun 2019 13:57:16 -0400 From: Tom Lane To: Robert Haas cc: Amit Langote , Andres Freund , Alvaro Herrera , PostgreSQL Hackers , amul sul Subject: Re: hyrax vs. RelationBuildPartitionDesc In-reply-to: References: <10788.1552501588@sss.pgh.pa.us> <3969.1552581380@sss.pgh.pa.us> <6122.1552673884@sss.pgh.pa.us> <10797.1552679128@sss.pgh.pa.us> <20190501155912.dgp6sg4vwueewd5l@alap3.anarazel.de> <20190517195929.uey6hadbgazplm3h@alap3.anarazel.de> <7897.1558125372@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Fri, 07 Jun 2019 08:51:56 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <18285.1560275836.1@sss.pgh.pa.us> Date: Tue, 11 Jun 2019 13:57:16 -0400 Message-ID: <18286.1560275836@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > On Thu, Jun 6, 2019 at 2:48 AM Amit Langote wrote: >> Attached is a patch that applies on top of Robert's pdoldcxt-v1.patch, >> which seems to fix this issue for me. > Yeah, that looks right. I think my patch was full of fuzzy thinking > and inadequate testing; thanks for checking it over and coming up with > the right solution. > Anyone else want to look/comment? I think the existing code is horribly ugly and this is even worse. It adds cycles to RelationDecrementReferenceCount which is a hotspot that has no business dealing with this; the invariants are unclear; and there's no strong reason to think there aren't still cases where we accumulate lots of copies of old partition descriptors during a sequence of operations. Basically you're just doubling down on a wrong design. As I said upthread, my current inclination is to do nothing in this area for v12 and then try to replace the whole thing with proper reference counting in v13. I think the cases where we have a major leak are corner-case-ish enough that we can leave it as-is for one release. regards, tom lane