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 1nHmox-00050X-Bg for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Feb 2022 13:15:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nHmow-0006Mh-6M for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Feb 2022 13:15:42 +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 1nHb5S-0001Kn-04; Wed, 09 Feb 2022 00:43:58 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nHb5M-0006fx-T0; Wed, 09 Feb 2022 00:43:57 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 9DBF45C0181; Tue, 8 Feb 2022 19:43:49 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 08 Feb 2022 19:43:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; bh=MrKnHkzkCHLzg4Kh/hbvzAUUIknYqNzdmqNgDD 4Kr0M=; b=x5H3UO8788Rcogq/5Ylb8E1/EuWR3tz8YDPOrn3eM+C9AUjgnD7lUk uvLCeJdo/Fas2DTgHbEchYfTqN0LIC/9i4iiDfcRh332rSj2yoM44ZmeK4jl4qoC YNhKyeD2kn+SCr/ybS9AX7lGJbbTF1uDtZxfRryASLVa4ICHx3WtSxJpHSLtBp7t lREjSliAE7lhyCioP7QFIPc4oEyAoWLZ8BeZy+khuV3k5UezVwgTkJ8Kw+50a7du xKkZRfn6XGsyeHPwvfFR4Lsqmg07VbaE53/7bR5/NfehN9c34VnqArdoYpeb3Qn8 EoY+zMsIMssX4fqp8IYBQ1euPc7nJOqA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=MrKnHkzkCHLzg4Kh/ hbvzAUUIknYqNzdmqNgDD4Kr0M=; b=WutpEh65teUh62nXYnlN/6cNDk0WQULwY NkKj8ormnK7ZHP+EW2gGnQvuOSiF8hwXdTDhodGuRW+WC1BuAEAK49713OQjgyCK TvFFlxLBrsH/sVp923lGQsIJtDhnbRCUpGbfFQBXTEQo0HQxAy6IE/PdY0OiJxbs eywxoECvlBzhdYEC0aVS4k4ThgDFNsOZcyhk2KrfYgczQ+aaCcUHO4QrNaOH4Gvp V6/IGID1UaQYcCq3LMmrYBMu/VkkRrIjlUMJF/7KDQmio36mn+LxD2ih4u0L4rxc 5DdjqVbHEgmNmrHFRMmrVdduI+WMO95jC7XZpRUIHxEUw/I5Iv9tg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrheekgddvfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughrvghs ucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrfgrth htvghrnhepffdvvdevleelgffhheeitdevhfefgfeivdevieeltdffkeefgffguedtkeei heejnecuffhomhgrihhnpehpohhsthhgrhdrvghsnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomheprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 8 Feb 2022 19:43:49 -0500 (EST) Date: Tue, 8 Feb 2022 16:43:47 -0800 From: Andres Freund To: Tomas Vondra , pgsql-hackers@postgresql.org, pgsql-release@postgresql.org Cc: Noah Misch , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Avoid race in RelationBuildDesc() affecting CREATE INDEX CONCURR Message-ID: <20220209004347.mnwaoiv5x7dntuvi@alap3.anarazel.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2022-02-08 22:13:01 +0100, Tomas Vondra wrote: > On 10/24/21 03:40, Noah Misch wrote: > > Avoid race in RelationBuildDesc() affecting CREATE INDEX CONCURRENTLY. > > > > CIC and REINDEX CONCURRENTLY assume backends see their catalog changes > > no later than each backend's next transaction start. That failed to > > hold when a backend absorbed a relevant invalidation in the middle of > > running RelationBuildDesc() on the CIC index. Queries that use the > > resulting index can silently fail to find rows. Fix this for future > > index builds by making RelationBuildDesc() loop until it finishes > > without accepting a relevant invalidation. It may be necessary to > > reindex to recover from past occurrences; REINDEX CONCURRENTLY suffices. > > Back-patch to 9.6 (all supported versions). > > > > Noah Misch and Andrey Borodin, reviewed (in earlier versions) by Andres > > Freund. > > > > Discussion: https://postgr.es/m/20210730022548.GA1940096@gust.leadboat.com > > > > Unfortunately, this seems to have broken CLOBBER_CACHE_ALWAYS builds. Since > this commit, initdb never completes due to infinite retrying over and over > (on the first RelationBuildDesc call). Ugh. Do we need to do something about WRT the next set of minor releases? Is there a a chance of this occuring in "real" workloads? Greetings, Andres Freund