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 1ngXeP-0007b3-Fx for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Apr 2022 20:07:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ngXeO-0005aB-1K for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Apr 2022 20:07:08 +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 1ngXeN-0005Zk-Og for pgsql-hackers@lists.postgresql.org; Mon, 18 Apr 2022 20:07:07 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ngXeJ-0006TC-0s for pgsql-hackers@lists.postgresql.org; Mon, 18 Apr 2022 20:07:07 +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 23IK6w5q2375735; Mon, 18 Apr 2022 16:06:58 -0400 From: Tom Lane To: Andres Freund cc: Robert Haas , 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) In-reply-to: <20220418143901.mdxs53vq3g4u2skp@alap3.anarazel.de> References: <1527714.1649957811@sss.pgh.pa.us> <1535399.1649963150@sss.pgh.pa.us> <1542208.1649967960@sss.pgh.pa.us> <1971135.1650134559@sss.pgh.pa.us> <20220417133112.phzg25rs66w5zipv@alap3.anarazel.de> <2131038.1650210718@sss.pgh.pa.us> <20220418143901.mdxs53vq3g4u2skp@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Mon, 18 Apr 2022 07:39:01 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2375733.1650312418.1@sss.pgh.pa.us> Date: Mon, 18 Apr 2022 16:06:58 -0400 Message-ID: <2375734.1650312418@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > On 2022-04-17 11:51:58 -0400, Tom Lane wrote: >> The fact that we have a snapshot at the instant of fetch doesn't prove >> that it existed continually since we fetched the toast reference, >> which seems to be the condition we actually need to assure. > Right. BTW, after thinking about this for a bit I am less concerned than I was about the system being full of bugs of this ilk. The executor per se should be fine because it does everything under a live snapshot. We had bugs with cases that shove executor output into long-lived tuplestores, but we've dealt with that scenario. Catalog updates performed on tuples fetched from a catalog scan seem safe enough too. Andres was worried about catalog updates performed using tuples fetched from catcache, but that's not a problem because we detoasted every value when it went into the catcache, cf 08e261cbc. (Mind you, 08e261cbc's solution is risky performancewise, because it means we have to re-toast every value during such catalog updates, instead of being able to carry the old values of unchanged columns forward. But it's not a correctness bug.) (Also, the whining I did in 08e261cbc's commit message is no longer relevant now that we read catalogs with MVCC snapshots.) There may be some corner cases that aren't described by any of these three blanket scenarios, but they've got to be pretty few and far between. regards, tom lane