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 1sr7sI-00FY8l-Mn for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Sep 2024 03:30:34 +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 1sr7sH-002qlm-7W for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Sep 2024 03:30:33 +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 1sr7sG-002qle-Uc for pgsql-hackers@lists.postgresql.org; Thu, 19 Sep 2024 03:30:32 +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 1sr7sE-001uKn-5x for pgsql-hackers@lists.postgresql.org; Thu, 19 Sep 2024 03:30:31 +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 48J3UOaB1912094; Wed, 18 Sep 2024 23:30:24 -0400 From: Tom Lane To: Justin Pryzby cc: Robert Haas , =?utf-8?B?0JDQvdC00YDQtdC5INCg0LDRh9C40YbQutC40Lk=?= , pgsql-hackers@lists.postgresql.org Subject: Re: BUG #18545: \dt breaks transaction, calling error when executed in SET SESSION AUTHORIZATION In-reply-to: References: <18545-feba138862f19aaa@postgresql.org> <72802.1721415837@sss.pgh.pa.us> <1722241488.182053205@f169.i.mail.ru> <3593204.1722466756@sss.pgh.pa.us> <3618203.1722473994@sss.pgh.pa.us> <916377.1722809337@sss.pgh.pa.us> <1807627.1722970465@sss.pgh.pa.us> Comments: In-reply-to Justin Pryzby message dated "Tue, 17 Sep 2024 18:47:11 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1912092.1726716624.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 18 Sep 2024 23:30:24 -0400 Message-ID: <1912093.1726716624@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Justin Pryzby writes: > This commit seems to trigger elog(), not reproducible in the > parent commit. > 6e086fa2e77 Allow parallel workers to cope with a newly-created session = user ID. > postgres=3D# SET min_parallel_table_scan_size=3D0; CLUSTER pg_attribute = USING pg_attribute_relid_attnum_index; > ERROR: pg_attribute catalog is missing 26 attribute(s) for relation OID= 70321 I've been poking at this all day, and I still have little idea what's going on. I've added a bunch of throwaway instrumentation, and have managed to convince myself that the problem is that parallel heap scan is broken. The scans done to rebuild pg_attribute's indexes seem to sometimes miss heap pages or visit pages twice (in different workers). I have no idea why this is, and even less idea how 6e086fa2e is provoking it. As you say, the behavior isn't entirely reproducible, but I couldn't make it happen at all after reverting 6e086fa2e's changes in transam/parallel.c, so apparently there is some connection. Another possibly useful data point is that for me it reproduces fairly well (more than one time in two) on x86_64 Linux, but I could not make it happen on macOS ARM64. If it's a race condition, which smells plausible, that's perhaps not hugely surprising. regards, tom lane