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 1mlf39-0003Nz-00 for pgsql-bugs@arkaria.postgresql.org; Fri, 12 Nov 2021 22:29:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mlf37-0007Kl-95 for pgsql-bugs@arkaria.postgresql.org; Fri, 12 Nov 2021 22:29:33 +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 1mlf35-0007Kc-IL for pgsql-bugs@lists.postgresql.org; Fri, 12 Nov 2021 22:29:33 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mlf31-0007L9-8D for pgsql-bugs@lists.postgresql.org; Fri, 12 Nov 2021 22:29:31 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 741C53200C46; Fri, 12 Nov 2021 17:29:22 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 12 Nov 2021 17:29:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=GZBBZkOqCYI/n6NtiRIc7j4MFlD 1G2E7o0bhzUsZ8Ls=; b=OWu3DiHdchA0lg97fMEWn4eUskOpjg+kwDDWHauLLTE iZ4ig3VDAiLpS5wY4Nbj5h97Ld1VEsFmrrqSAdCfY/ZmYQ3YR+X/CAnAVQdUqLHT JWoebUKqq5cfBMCAZIeUT2D99Mmv1FAB77l5PadxuSYPW5FWDl6f1fD5a7rD4P5c xkQIGfya2J3hR7e1rr2IM9zwQ7sAJlcGtOc0kReeohhhAaMaC98WOpn85fI16knX 7cpH1Ch+SeBTT71umS/xlK8c0X8cIpzq3UJDNPsQJOU2hAFrjGA1k/hSUVOO14jc 36+aeK8KrTh9al9jXPtdTTE+Eo+gzjGpUvvjtwo4ycA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=GZBBZk OqCYI/n6NtiRIc7j4MFlD1G2E7o0bhzUsZ8Ls=; b=BHCRNGEA9IURDw8t2Eomez FYPWQgA0XRYJ38L1QDV7h2gIokCnQs2pXYYSFXAF7dYOOtMUrvw9FBIQNad3j6sD sVsugtZlMg5B/zcsV9YUIJWHBmHz+n9OiPEEcV+Mj4WY+m7g90ho//noJDC8uyMa ixkOYPboe0sHh6t0F3VZISxM/Hkli5WYMzkJ0G3TiUCY26z9WO9K0BwwpUSlXrDb puhTldjua0M3xmXDA7PBNtmxp71pcfyPquHCMOf7KqC2QzvaQ/xHxXEGDFadxUMf TIxpk6ZN5zZs+p0MzXfiWI0GtbSREpJdMFglViUFQtzUuGdCv6Gr/r6xKWQtsOsA == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrvdefgdduheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrg htthgvrhhnpedukefhkeelueegveetheelffffjeegleeuudelfeefuedtleffueejfffh ueffudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grnhgurhgvshesrghnrghrrgiivghlrdguvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 12 Nov 2021 17:29:21 -0500 (EST) Date: Fri, 12 Nov 2021 14:29:19 -0800 From: Andres Freund To: Peter Geoghegan Cc: Dmitry Dolgov <9erthalion6@gmail.com>, Alexander Lakhin , Matthias van de Meent , PostgreSQL mailing lists Subject: Re: BUG #17255: Server crashes in index_delete_sort_cmp() due to race condition with vacuum Message-ID: <20211112222919.e7fkfpbpcoje6hsj@alap3.anarazel.de> References: <20211109150216.fgfybn35mwnkeef3@localhost> <20211111030821.2xxl75qfkynaga4j@alap3.anarazel.de> 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 2021-11-12 13:11:54 -0800, Peter Geoghegan wrote: > It also addresses the separate issue of DEAD vs RECENTLY_DEAD > disconnected tuples -- that was the other unresolved question. This > revision takes a harder line on the state of disconnected heap-only > tuples. Andres said that he doesn't know for sure that disconnected > heap-only tuples cannot be DELETE/INSERT_IN_PROGRESS -- "I'm not > actually sure the Assert is unreachable. I can imagine cases where > we'd see e.g. DELETE/INSERT_IN_PROGRESS due to a concurrent > subtransaction abort or such". But I don't see how that's possible. In > fact, I don't even see how it's possible for these items to be > RECENTLY_DEAD -- I think that they must always be DEAD (or we're in > big trouble anyway). > > These are not just any heap-only tuples. They're heap-only tuples that > cannot possibly be accessed from a HOT chain. And so it's just > physically impossible for them to be returned by index scans -- this > is a certainty. How could they not be DEAD, in every possible sense? > How could they not come from an aborted transaction, specifically? With subtransactions abort is a bit more complicated than with plain transactions. I'm not at all sure a problematic scenario exists, but I wouldn't want to rely on it. Especially if suboverflowed comes into play there can be scenarios where one backend uses TransactionIdDidAbort() + SubTransGetTopmostTransaction() for in-progress determination while another just relies on the procarray. Those aren't updated atomically with respect to each other. Also, heap_update()'s wait = true path uses a bit different logic again to wait for other backends than what HeapTupleSatisfiesVacuum() ends up with. > Naturally, I also went through the exercise of trying to find a > counterexample, where pruning doesn't see a disconnected tuple as DEAD > in its HTSV. I could not get the assertion to fail with Alexander's > test case, nor with make check-world. I don't think that provides a meaningful coverage. Alexander's test has a quite limited set operations (which e.g. doesn't include an subxacts), and our own tests around subtransactions, and particularly concurrent subtransaction heavy work, is quite, uh, minimal. Greetings, Andres Freund