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 1sIzKm-001jDS-In for pgsql-bugs@arkaria.postgresql.org; Sun, 16 Jun 2024 23:30:52 +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 1sIzKk-00AzTk-97 for pgsql-bugs@arkaria.postgresql.org; Sun, 16 Jun 2024 23:30:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sIzKk-00AzTc-10 for pgsql-bugs@lists.postgresql.org; Sun, 16 Jun 2024 23:30:50 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sIzKi-0022A6-SK for pgsql-bugs@lists.postgresql.org; Sun, 16 Jun 2024 23:30:50 +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 45GNUkse3050564; Sun, 16 Jun 2024 19:30:46 -0400 From: Tom Lane To: Michael Paquier cc: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18499: Reindexing spgist index concurrently triggers Assert("TransactionIdIsValid(state->myXid)") In-reply-to: References: <18499-8a519c280f956480@postgresql.org> <428421.1717887173@sss.pgh.pa.us> <3030961.1718570047@sss.pgh.pa.us> <3045795.1718578372@sss.pgh.pa.us> Comments: In-reply-to Michael Paquier message dated "Mon, 17 Jun 2024 08:24:10 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3050562.1718580646.1@sss.pgh.pa.us> Date: Sun, 16 Jun 2024 19:30:46 -0400 Message-ID: <3050563.1718580646@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Michael Paquier writes: > On Sun, Jun 16, 2024 at 06:52:52PM -0400, Tom Lane wrote: >> ... 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? > I am not sure to understand the redirection part for spgist, but > except if I am missing something, we already rely on ii_Concurrent for > other index AMs like BRIN paths to check if we are dealing with a > concurrent build path or not. index_concurrently_build() is used > by both CIC and REINDEX CONCURRENTLY, where the flag is set after a > BuildIndexInfo(). Right. I was thinking that CIC wouldn't reach spginsert(), rather spgbuild(), but it does feel a bit rickety. A separate flag would be better. On the whole I'm inclined to stick with the patch as I have it. Maybe somebody would like to investigate this idea as an improvement for v18 or later. regards, tom lane