Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sIyk7-001fby-2p for pgsql-bugs@arkaria.postgresql.org; Sun, 16 Jun 2024 22:52:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sIyk4-00Ab5Z-Hc for pgsql-bugs@arkaria.postgresql.org; Sun, 16 Jun 2024 22:52:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sIyk4-00Ab5R-9J for pgsql-bugs@lists.postgresql.org; Sun, 16 Jun 2024 22:52:57 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sIyk2-001eiM-Hg for pgsql-bugs@lists.postgresql.org; Sun, 16 Jun 2024 22:52:55 +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 45GMqqLd3045796; Sun, 16 Jun 2024 18:52:52 -0400 From: Tom Lane To: exclusion@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18499: Reindexing spgist index concurrently triggers Assert("TransactionIdIsValid(state->myXid)") In-reply-to: <3030961.1718570047@sss.pgh.pa.us> References: <18499-8a519c280f956480@postgresql.org> <428421.1717887173@sss.pgh.pa.us> <3030961.1718570047@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sun, 16 Jun 2024 16:34:07 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3045794.1718578372.1@sss.pgh.pa.us> Date: Sun, 16 Jun 2024 18:52:52 -0400 Message-ID: <3045795.1718578372@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > So I conclude that we basically just need to remove the failing > assertion in spgFormDeadTuple and instead add a guard for invalid > xid in vacuumRedirectAndPlaceholder. BTW, a different line of attack could be to not generate redirects at all during REINDEX CONCURRENTLY: on the basis of this argument, we don't need them. So that would look roughly similar to the tests that skip making redirects when isBuild is true, and it'd allow keeping the assertion in spgFormDeadTuple, and it'd save some usually-trifling amount of work in the next VACUUM. However, I'm not sure there's a nice way for spginsert() to know whether it's being invoked in REINDEX CONCURRENTLY or a normal INSERT/UPDATE query. Can we trust indexInfo->ii_Concurrent for that? regards, tom lane