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 1rO3QD-000rPI-G5 for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jan 2024 22:21:10 +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 1rO3QC-00FbL5-HF for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jan 2024 22:21:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rO3QC-00FbKw-7i for pgsql-hackers@lists.postgresql.org; Thu, 11 Jan 2024 22:21:08 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rO3Q9-0015JJ-JC for pgsql-hackers@lists.postgresql.org; Thu, 11 Jan 2024 22:21: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 40BML3No329633; Thu, 11 Jan 2024 17:21:03 -0500 From: Tom Lane To: Xiaoran Wang cc: pgsql-hackers@lists.postgresql.org Subject: Re: Recovering from detoast-related catcache invalidations In-reply-to: References: Comments: In-reply-to Xiaoran Wang message dated "Fri, 12 Jan 2024 01:52:21 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <329631.1705011663.1@sss.pgh.pa.us> Date: Thu, 11 Jan 2024 17:21:03 -0500 Message-ID: <329632.1705011663@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Xiaoran Wang writes: >>> The detection of "get an invalidation" could be refined: what I did >>> here is to check for any advance of SharedInvalidMessageCounter, >>> which clearly will have a significant number of false positives. > I have reviewed your patch, and it looks good. But instead of checking for > any advance of SharedInvalidMessageCounter ( if the invalidate message is > not related to the current tuple, it is a little expensive) I have another > idea: we can recheck the visibility of the tuple with CatalogSnapshot(the > CatalogSnapthot must be refreshed if there is any SharedInvalidMessages) if > it is not visible, we re-fetch the tuple, otherwise, we can continue to use > it as it is not outdated. Maybe, but that undocumented hack in SetHintBits seems completely unacceptable. Isn't there a cleaner way to make this check? Also, I'm pretty dubious that GetNonHistoricCatalogSnapshot rather than GetCatalogSnapshot is the right thing, because the catcaches use the latter. regards, tom lane