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 1lVeJC-0004mK-8i for pgsql-hackers@arkaria.postgresql.org; Sun, 11 Apr 2021 17:55:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lVeJA-0002Mj-Nj for pgsql-hackers@arkaria.postgresql.org; Sun, 11 Apr 2021 17:55:40 +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 1lVeJ9-0002Mc-UX for pgsql-hackers@lists.postgresql.org; Sun, 11 Apr 2021 17:55:39 +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 1lVeJ3-0001In-K1 for pgsql-hackers@lists.postgresql.org; Sun, 11 Apr 2021 17:55:38 +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 13BHtUHa2691725; Sun, 11 Apr 2021 13:55:30 -0400 From: Tom Lane To: Peter Geoghegan cc: Andres Freund , PostgreSQL Hackers Subject: Re: PANIC: wrong buffer passed to visibilitymap_clear In-reply-to: <2691106.1618162892@sss.pgh.pa.us> References: <2247102.1618008027@sss.pgh.pa.us> <20210409232739.sazp5p4xnnagrusa@alap3.anarazel.de> <20210409233203.3khg3s5iw34g4xrc@alap3.anarazel.de> <2644575.1618117467@sss.pgh.pa.us> <2679216.1618156670@sss.pgh.pa.us> <2689873.1618161194@sss.pgh.pa.us> <2691106.1618162892@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sun, 11 Apr 2021 13:41:32 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2691723.1618163729.1@sss.pgh.pa.us> Date: Sun, 11 Apr 2021 13:55:30 -0400 Message-ID: <2691724.1618163730@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > I'm now inclined to think that we should toss every single line of that > code, take RelationGetBufferForTuple out of the equation, and have just > *one* place that rechecks for PageAllVisible having just become set. > It's a rare enough case that optimizing it is completely not worth the > code complexity and risk (er, reality) of hard-to-locate bugs. Alternatively, we could do what you suggested and redefine things so that one is only allowed to set the all-visible bit while holding superexclusive lock; which again would allow an enormous simplification in heap_update and cohorts. Either way, it's hard to argue that heap_update hasn't crossed the complexity threshold where it's impossible to maintain safely. We need to simplify it. regards, tom lane