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 1nf2nx-0003PW-2v for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Apr 2022 16:58:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nf2nv-0000Ki-CV for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Apr 2022 16:58:47 +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 1nf2nv-0000Il-2Y for pgsql-hackers@lists.postgresql.org; Thu, 14 Apr 2022 16:58:47 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nf2no-0005ml-2M for pgsql-hackers@lists.postgresql.org; Thu, 14 Apr 2022 16:58:46 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id F1F765C02F8; Thu, 14 Apr 2022 12:58:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 14 Apr 2022 12:58:38 -0400 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=fm1; t=1649955518; x=1650041918; bh=NtIgI4iwiT ZIj/q6FHPNRjD7uFB7BgWbVG/QtXlO84k=; b=daoJrdQkjTimviVAhmIaB/7m8c Ek6iD/KkLDJWZ5McE4uD2Hu+fHkOQo2F8djVvkl8zTv12X7XcMQglra4RUouk6aa nvC+di72Ck+E6plGBg8KdRiPovoKAiZgQRNhE6JGUt/5wQ3aAWIkRmdYk+Y9ZsUL frze8ojdltD3PU8EKWopSU17eI3hSOhm2WgNS102tdc8Y8q19nvfTKNoy9tE5L5K WSQHtwIeKA+WajYaR7Tg12B6DZMv+Izoed70jRnEKXZ4WqpPeT+R10kSBEx25mc1 FSbwMQhePq2uEvqbl5wrQWvzgmRNKi1CbwMk7XZvmTxmA9QgeU4XK6UTQQOw== 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=fm1; t=1649955518; x= 1650041918; bh=NtIgI4iwiTZIj/q6FHPNRjD7uFB7BgWbVG/QtXlO84k=; b=D kmpQ8T2EDW8DFrmXwRRyFpqxBUtgX9YaDSUCc1HIMYZD2EiPcbq0xN63Gru9nx/9 cgdFzvFqskzWfVAYevuKOpy0vW3JyAvJ6V46vHZvOm6kjth4L0kyTk4Pnm+/Mex8 mNy3xRp+XvNNk+URFQ7Of+vdhGEmA/UQ6ZZUegOAUsRs5AQcPycLl84GFQSBiRVW sgnT6XmA4kNdIsWyhubMFrL9+wGXX/oC84gwKT73IxleeIKUV4cAB4XknVMGe9zi 5qInilfb3orD0J1+T1GWdu3SjJfeiY5n3wSYv5UHcEukHHPlGkzqY5fywY9S9iXQ GzSRNxlsob+UbTL14cw7A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudelfedguddtkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepteehheeigfdulefhvedvvddtjeehheekleetkeevgeegudeileeiudeu gfeftdejnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgurhgvshesrghnrghr rgiivghlrdguvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 14 Apr 2022 12:58:38 -0400 (EDT) Date: Thu, 14 Apr 2022 09:58:37 -0700 From: Andres Freund To: Robert Haas Cc: Tom Lane , Justin Pryzby , Kyotaro Horiguchi , Erik Rijkers , Matthias van de Meent , PostgreSQL Hackers Subject: Re: TRAP: FailedAssertion("HaveRegisteredOrActiveSnapshot()", File: "toast_internals.c", Line: 670, PID: 19403) Message-ID: <20220414165837.bg22dkdzq4krff56@alap3.anarazel.de> References: <20220330.114613.1177577626285014184.horikyota.ntt@gmail.com> <20220330.175824.936439875658680065.horikyota.ntt@gmail.com> <20220413202819.GR26620@telsasoft.com> <20220414003802.e37dgzkgbi5t7ha4@alap3.anarazel.de> <1471620.1649947373@sss.pgh.pa.us> <1484483.1649951206@sss.pgh.pa.us> <20220414165425.pxn22hdlwdrcouh6@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220414165425.pxn22hdlwdrcouh6@alap3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2022-04-14 09:54:25 -0700, Andres Freund wrote: > On 2022-04-14 12:16:45 -0400, Robert Haas wrote: > > I got curious and looked at the underlying problem here and I am > > wondering whether HaveRegisteredOrActiveSnapshot() is just buggy. It > > seems to me that the code is always going to return true if there are > > any active snapshots, and the rest of the function is intended to test > > whether there is a registered snapshot other than the catalog > > snapshot. But I don't think that's what this code does: > > > > if (pairingheap_is_empty(&RegisteredSnapshots) || > > !pairingheap_is_singular(&RegisteredSnapshots)) > > return false; > > > > return CatalogSnapshot == NULL; > > Certainly looks off... > > > > I find that 'make check-world' passes with this change, which is > > disturbing, because it also passes without this change. That means we > > don't have any tests that reach HaveRegisteredOrActiveSnapshot() with > > more than one registered snapshot. > > Part of that is because right now the assertion is placed "too deep" - > it should be much higher up, so it's reached even if there's not > actually a toast datum. But there's of other bugs preventing that :(. A > lot of bugs have been hidden by the existence of CatalogSnapshot (which > of course isn't something one actually can rely on). > > > > Also, unless we have plans to use HaveRegisteredOrActiveSnapshot() in > > more places, > > I think we should, but there's the other bugs that need to be fixed > first :(. Namely that we have plenty places doing catalog accesses > without an active or registered snapshot :(. Ah, we actually were debating some of these issues more recently, in: https://www.postgresql.org/message-id/20220311030721.olixpzcquqkw2qyt%40alap3.anarazel.de https://www.postgresql.org/message-id/20220311021047.hgtqkrl6n52srvdu%40alap3.anarazel.de It looks like the same bug, and that the patch in this thread fixes them. And that we need to backpatch the fix, right? Greetings, Andres Freund