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 1nG0JA-0005p6-UO for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Feb 2022 15:15:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nG0J9-0006xO-3c for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Feb 2022 15:15:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nG0J8-0006xF-Rs for pgsql-bugs@lists.postgresql.org; Fri, 04 Feb 2022 15:15:30 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nG0J6-000648-5E for pgsql-bugs@lists.postgresql.org; Fri, 04 Feb 2022 15:15:30 +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 214FFLnQ391182; Fri, 4 Feb 2022 10:15:21 -0500 From: Tom Lane To: Andres Freund cc: Peter Geoghegan , Dmitry Dolgov <9erthalion6@gmail.com>, Alexander Lakhin , Matthias van de Meent , PostgreSQL mailing lists Subject: Re: BUG #17255: Server crashes in index_delete_sort_cmp() due to race condition with vacuum In-reply-to: <20220204041935.gf4uwbdxddq6rffh@alap3.anarazel.de> References: <20211122175914.ayk6gg6nvdwuhrzb@alap3.anarazel.de> <20211122223436.ov3qa27pakxay6z7@alap3.anarazel.de> <20211211045710.ljtuu4gfloh754rs@alap3.anarazel.de> <20220112192508.vibr6o64h7sy7mbw@alap3.anarazel.de> <20220114021549.m6ugihzjmsunv3jd@alap3.anarazel.de> <294529.1643921668@sss.pgh.pa.us> <20220204041935.gf4uwbdxddq6rffh@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Thu, 03 Feb 2022 20:19:35 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <391180.1643987721.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Feb 2022 10:15:21 -0500 Message-ID: <391181.1643987721@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-02-03 15:54:28 -0500, Tom Lane wrote: >> I'm writing release notes and wondering what I can tell users about >> how to detect or recover from this bug. Is a REINDEX sufficient, >> or is the presence of the bogus redirect item going to cause >> persistent problems? > Good questions. > It's hard to answer whether there's any danger after a REINDEX. Afaics t= he > build scan would just pick the "lower offset" version of the root > pointer. Which should be fine. > It's possible there could be trouble down the line, e.g. heap pruning do= ing > something weird once starting in a corrupted state, that then leads REIN= DEX to > do something bogus. The simple cases look OK, because a second visit/act= ion by > heap_prune_chain for one tid from two different root pointers would see > ->marked[offnum] as true. It gets more complicated once multiple interme= diary > row versions are involved, because the intermediary row versions won't b= e in > ->marked if an entire chain is pruned. But afaict that should still end = up > looking like a hot chain ending in an aborted tuple or such. OK, I'll just recommend REINDEX. > Except that it's not trivial to get right, I could see it being worthwhi= le to > add verification of hot chains to amcheck, and backpatch that to 14. I'd have thought that'd be a fundamental component of a heap check module, so +1 for adding it. Dunno about the back-patch part though. It seems like a new feature. regards, tom lane