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 1oGp1i-0003zA-Bz for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Jul 2022 21:57:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oGp0j-0004Rt-8w for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Jul 2022 21:56:09 +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 1oGp0i-0004Rk-W9 for pgsql-hackers@lists.postgresql.org; Wed, 27 Jul 2022 21:56:08 +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 1oGp0c-0006U2-Nv for pgsql-hackers@lists.postgresql.org; Wed, 27 Jul 2022 21:56:08 +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 26RLtu563107110; Wed, 27 Jul 2022 17:55:56 -0400 From: Tom Lane To: Robert Haas cc: Daniel Shelepanov , PostgreSQL Hackers , Andres Freund Subject: Re: collect_corrupt_items_vacuum.patch In-reply-to: References: <1649062270.289865713@f403.i.mail.ru> Comments: In-reply-to Robert Haas message dated "Wed, 27 Jul 2022 17:50:46 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3107108.1658958956.1@sss.pgh.pa.us> Date: Wed, 27 Jul 2022 17:55:56 -0400 Message-ID: <3107109.1658958956@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas writes: > In reality, the oldest all-visible XID cannot move backward, but > ComputeXidHorizons() lets it move backward, because it's intended for > use by a caller who wants to mark pages all-visible, and it's only > concerned with making sure that the value is old enough to be safe. Right. > And that's a problem for the way that pg_visibility is (mis-)using it. > To say that another way, ComputeXidHorizons() is perfectly fine with > returning a value that is older than the true answer, as long as it > never returns a value that is newer than the new answer. pg_visibility > wants the opposite. Here, a value that is newer than the true value > can't do worse than hide corruption, which is sort of OK, but a value > that's older than the true value can report corruption where none > exists, which is very bad. Maybe we need a different function for pg_visibility to call? If we want ComputeXidHorizons to serve both these purposes, then it has to always deliver exactly the right answer, which seems like a definition that will be hard and expensive to achieve. regards, tom lane