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 1tM6Wk-001mK0-7E for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Dec 2024 14:20:22 +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 1tM6Wf-007GxV-SO for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Dec 2024 14:20:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tM6Wf-007GxN-FM for pgsql-hackers@lists.postgresql.org; Fri, 13 Dec 2024 14:20:18 +0000 Received: from lahtoruutu.iki.fi ([185.185.170.37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tM6Wd-002dO5-5R for pgsql-hackers@lists.postgresql.org; Fri, 13 Dec 2024 14:20:17 +0000 Received: from [192.168.1.110] (dsl-hkibng22-50ddb7-241.dhcp.inet.fi [80.221.183.241]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4Y8s1Q643zz49Q4M; Fri, 13 Dec 2024 16:20:10 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1734099611; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5q9Bbeckt6333zFLkEDu7iUhmFTCYtUOm23JRsmJlB8=; b=RJj3ELHB6xhUolPWFttIbmpRuN6pEiy9FInYkGCfDrvdNDaE2FPqj+qn1Wb/aCdD7hmmM5 TB+x4wOzB1GWRCrLdYC2dJoeIFEaN+Oy9qEmpuC5bOznfa8CaHMEM1IYSfGVybbm/TZW7+ rzaAs3mCJRGTBySkCxMHU3M5899LJcxT6ZOMw2oC9gmTp8xN3esTY87jqDDSHEgUY4+ckq kjxPSXvxSThZIf7Gm3kHihdVm0IOEqe2x+eksH5O2S0EA+SrF8JlLKU/+B5iBBOeMOF1NM MqeUY5S7PQp118d3JzvqXXKFeqn/QVtj6kIMkEpqk0B316foeU7LbcnO+P+nqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1734099611; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5q9Bbeckt6333zFLkEDu7iUhmFTCYtUOm23JRsmJlB8=; b=brl3rmdfYyijh5lKcxBCIY7prHkXeJSYIXMWgvOpOxncuZdQ7yOqjDxIij2tz450S7vPtR /A9SzPB2JhBVZvOhNAYHqm8ZgUYWunebpVIraDz6LK5PAgn+4W0rQDfMDqSNZiDOwGgsN+ WQc465tnZ183/c00AK+N3zBAzg5slnObTIEx5+7i0uxt04v8Ky5yL/F2hg1guwyhULQYI9 CZKT8OCXHO/gH/mZMidKqpCiM7kI0snyyhclGWi9PTMrj44hLCLfl/wi4jbVk/A1VzXIfS bVaNAbPBR5ibV5dgDvInLcZuVig4Ta0m7P+3WG2VJOHCKWT9UMlp8o6rX1SJfA== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1734099611; a=rsa-sha256; cv=none; b=QFpF6hETjm3mEOZKGAKH4Rwgb3gGgOdIvoGFeYBN+2lCJRbmuRPt6i+0RQqV6/mBZ32EPh q+p2s8Vi95Oq/TpvVuhiO9BoxOpA9fd5c6FEpMvC4nuAhWiXPCo+4sFRTphLy1OnjvX0yh nPU9grVuGp2NqEjfWVqTosaE53mpFkddPkYG9IikSm3VrdC7LAs6WYHrjs3jgwtwt8nckX Y/SErn8D++ueEMtU4Tz3YJNnm8STdplCWuVn4UbQSpRY+4rMeTlWCQ/IQII3BJ/b28Mz18 OZICoVKuW78livZ18Gs6LIpVeqU882pXZmyzQQC0QR/LfnJWnPc2Ftp7WZBWdA== Message-ID: Date: Fri, 13 Dec 2024 16:20:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Recovering from detoast-related catcache invalidations To: Noah Misch , Tom Lane Cc: Xiaoran Wang , pgsql-hackers@lists.postgresql.org, Andres Freund References: <329632.1705011663@sss.pgh.pa.us> <754826.1705090452@sss.pgh.pa.us> <793469.1705092433@sss.pgh.pa.us> <20240114201411.d0@rfd.leadboat.com> <20240924212036.0a.nmisch@google.com> Content-Language: en-US From: Heikki Linnakangas In-Reply-To: <20240924212036.0a.nmisch@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 25/09/2024 00:20, Noah Misch wrote: > On Sun, Jan 14, 2024 at 12:14:11PM -0800, Noah Misch wrote: >> On Fri, Jan 12, 2024 at 03:47:13PM -0500, Tom Lane wrote: >>> Oh! After nosing around a bit more I remembered systable_recheck_tuple, >>> which is meant for exactly this purpose. So v4 attached. >> >> systable_recheck_tuple() is blind to heap_inplace_update(), so it's not a >> general proxy for invalidation messages. The commit for $SUBJECT (ad98fb1) >> doesn't create any new malfunctions, but I expect the systable_recheck_tuple() >> part will change again before the heap_inplace_update() story is over >> (https://postgr.es/m/flat/CAMp+ueZQz3yDk7qg42hk6-9gxniYbp-=bG2mgqecErqR5gGGOA@mail.gmail.com). > > Commit f9f47f0 (2024-06-27) addressed inplace updates here. I started to wonder if there's still an issue with catcache list entries. The code to build a CatCList looks like this: SearchCatCacheList() systable_beginscan() while (HeapTupleIsValid(ntp = systable_getnext(scandesc))) { ct = CatalogCacheCreateEntry(ntp) if (ct == NULL) { /* 'ntp' was concurrently invalidated, start all over */ } } systable_endscan(); /* create CatCList entry */ CatalogCacheCreateEntry() can accept catcache invalidations when it opens the toast table, and it now has recheck logic to detect the case that the tuple it's processing (ntp) is invalidated. However, isn't it also possible that it accepts an invalidation message for a tuple that we had processed in an earlier iteration of the loop? Or that a new catalog tuple was inserted that should be part of the list we're building? -- Heikki Linnakangas Neon (https://neon.tech)