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 1rfZGZ-000vxz-Fm for pgsql-bugs@arkaria.postgresql.org; Thu, 29 Feb 2024 05:47:35 +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 1rfZFY-000FsY-A7 for pgsql-bugs@arkaria.postgresql.org; Thu, 29 Feb 2024 05:46:32 +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 1rfZFY-000FsP-1q for pgsql-bugs@lists.postgresql.org; Thu, 29 Feb 2024 05:46:32 +0000 Received: from wfout2-smtp.messagingengine.com ([64.147.123.145]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rfZFR-001ylq-I7 for pgsql-bugs@lists.postgresql.org; Thu, 29 Feb 2024 05:46:31 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfout.west.internal (Postfix) with ESMTP id 38BC51C00080; Thu, 29 Feb 2024 00:46:22 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 29 Feb 2024 00:46:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1709185581; x=1709271981; bh=n8gF3Sg4ux u9ZL9kBm+Yqohm8bQQTxzAbnxy67rg/hk=; b=AXVjxcAz72iWUCM+X0s/h4w0Tv o4X/m3x6v6sUzNDicPQpDskjzcNsZLpxMXF6xuW1gZWJVM/YOd4KPFN4Q9XjelOy FgWDhUYdPN6RAPXoGurOTppEeIOieHNL0A2ScdNudRyS0vTsnpgCvXdxSbAeg1On z3/1qMqIUumjJHFC71zqaLr3HkcxZ9vH5/wlRYbBAaYXFmapyJ+HgmtUpR7IcGHK ZBqY1Dsvb0jZWR+SJqMooR/XaLpRjOW00o+dsFytZkn0s7QQq2D/bc9VG1hRm7PL kiW+19YBwy3JCjVAt2/bZ0G9R/q+tC3oc2I8DEMEcjAnS1ld2mKbDznSmgqg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1709185581; x=1709271981; bh=n8gF3Sg4uxu9ZL9kBm+Yqohm8bQQ TxzAbnxy67rg/hk=; b=gMCuqCbTPYsW7Hh+DTpe9IBb93za9IbXDs8dYi93828m Ur3l4WLRkn2ijfjIqoCIpg4ZcRWGL66KUrdBefNKwRq+J5ebmbGZbFmQbNygxgYj OI7JYOqYXH8E7HVB71637nbdVuvtP/ArSgVRjetsNaiG+mZk5YN/yAZ9hnkrCeQS mFimPr9RFCT1I+4vEm6iwuwjOOXCAlh4aVZwSUQH/E3Rj+Ij5qST+KqZFpdsHpTu C4KWUlv90FVog2Mlg50OrQXXohFWHBlTqgKqqdWrQpunlmfgqJZKRz9yTHSwgO+t Oj3hrSZIjWJQDlHrHrDlHVVKfPmgfEy3o1Qhaf6kew== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrgeekgdekgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdejtddmnecujfgurhepfffhvf evuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhu ihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucggtffrrghtthgvrh hnpeetleeifedufffhhfdtteelgeeggeffhfekueevteeigfduudevudetgfegiedvjeen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthh grvghlsehprghquhhivghrrdighiii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 29 Feb 2024 00:46:20 -0500 (EST) Date: Thu, 29 Feb 2024 14:46:07 +0900 From: Michael Paquier To: Alexander Lakhin Cc: Tom Lane , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18363: Assert !ReindexIsProcessingIndex falsified with expression index over select from table Message-ID: References: <18363-e3598a5a572d0699@postgresql.org> <1541688.1708893428@sss.pgh.pa.us> <1660000.1708902298@sss.pgh.pa.us> <6ac7f5aa-2d19-bde9-057a-3cb1e175bde6@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="vzemheTQX2dZSVfl" Content-Disposition: inline In-Reply-To: <6ac7f5aa-2d19-bde9-057a-3cb1e175bde6@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --vzemheTQX2dZSVfl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 26, 2024 at 09:00:01AM +0300, Alexander Lakhin wrote: > It looks like currentlyReindexedIndex =3D=3D 0 in this case, so > ReindexIsProcessingIndex() doesn't guard against get_relation_info() -> > _bt_getrootheight() -> _bt_getbuf() -> ReadBuffer() -> ... -> mdread(). Fun. The concurrent case is actually able to work because it looks like the basic definition of the relation exists with its relfilenode. I was looking at that, and it seems to me that the point is not that the index is being reindexed; the point is that we want to prevent access to the index itself while it being built. And that's something that can happen for a reindex as much as a new index. It would be possible to paint an equivalent of SetReindexProcessing() in index_create() for index_build() where a trace of the index OID getting built is kept around, and it would be possible to trigger the same error as when doing a reindex. Hence, if we were to do that, the current ReindexIs*() routines maintaining the list of the indexes=20 being built across transaction states are a bit misnamed, and the error messages would be partially incorrect. I am not sure if this is worth bothering beyond HEAD, or worth bothering at all, but seeing 940489b467 it looks like we do bother even for stable branches. -- Michael --vzemheTQX2dZSVfl Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmXgGh8ACgkQnvQgOdby QH3rLA//exZaWN6ypD48wSPNsGt2hSnSXeExSDs9SOuWztTHV0DW+LVUlYMf8737 ITsvj/I58mJCE+LUslBTMwQKwhG6oDhXanV/TH2fCP9AH0IeEUngHOcFMBj/Xq2v uYMPBe9SZbXpfbKu4LQK9ad77HmZ1FfZuIvAJuByozayvUUbBhUqLdnlkcEsS9U8 cYGXr1Dlmn/CvkFk6tSq0C0WJfBsk64LJPkXtCa6J9Y8hQx/ceCmNx3KdxX5jyM+ 4MDYxTLOMTVF55Fm9JmYm45ZJ42k7ip9Nj7COgh7QN+1oeo1ppwMQ212E50BGTf2 xpbi79Z6ISs1gJ+7oJ7QMVmXJCvoHnz2OGiTWxiQ931XEJ9OoB5DgqLuDqK6+skp LIY4jZ1uieBMpIE2emVbHh9UQKIBs7q6yr8NVRi2hS81TNLxI7WQkBf5DE7Kz1xJ ThU47Lg0Sm6VS9iifH63p+A6WBkBc1tBi6t2JMZ/YIugEf0SOqpXF+eyEk7IvjfG sfDnkrGdRtXzglfahC+lsWvuoXPQA033UNTeVv0/eDB1a1YauDUXYG2uHQQyqIoB Rm5U1/XjNTmpsG1XvOPGEmQIDGrH2EzmTVvemoefNTtEyqKhT6sfr/Aze2lcSnDO VasWR1RzylCqB4N7jnTr5jB8rthYy/LpRwnvKVhl5voxDD8atWQ= =PUGv -----END PGP SIGNATURE----- --vzemheTQX2dZSVfl--