public inbox for [email protected]  
help / color / mirror / Atom feed
From: Mark Dilger <[email protected]>
To: Robert Haas <[email protected]>
Cc: Himanshu Upadhyaya <[email protected]>
Cc: Aleksander Alekseev <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Cc: Andres Freund <[email protected]>
Subject: Re: HOT chain validation in verify_heapam()
Date: Tue, 7 Mar 2023 10:29:47 -0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+TgmoYsHKB4kx7LSQUTHeBY5i2bBmMt3xLyYgjPbLzPZRdqiQ@mail.gmail.com>
References: <CA+Tgmoas7DOU9umrrvhZO1VMUc74eQsyKkeVEKeZZD4ODBLH8w@mail.gmail.com>
	<CAPF61jBjb+VafRhsmRg2gN1mX89+iPyPrfa6ZdUVtoX7T35TOg@mail.gmail.com>
	<CAJ7c6TNd8xPKGF-kja40PVGDrfg1WEVomi_mctxNFGWx=vFz6g@mail.gmail.com>
	<CAPF61jD6zewYmYY88hq5XYzW1bAuRBYChnRYGuCQ7cAZ9C3vPA@mail.gmail.com>
	<CAJ7c6TNFGab8HGzngcgPh=eiWP+VgD-TKEwT7SWC5Hnqu8KmRg@mail.gmail.com>
	<CAPF61jCJrHfSniWNrPXoyZT8Pe9gVfuPNt3c6_dURBZjUKED7A@mail.gmail.com>
	<CA+TgmoYD-mx2=2KhW8815p1rU=2Ftndn2O4UEk87JbPN7qrwtQ@mail.gmail.com>
	<CAPF61jDNh3-pGpKuAJ5FN73A8oDoN8iOi3vGU_DY4RP9txdcqQ@mail.gmail.com>
	<[email protected]>
	<CAPF61jCfHvhoaiYhmD3DHP_LGnzVo5qbAYefb3BVHnShFTG32A@mail.gmail.com>
	<[email protected]>
	<CAPF61jB67rwtNdaBbTURtHkbqwn1gQTZVWx7KUe6sqT83Fg1Wg@mail.gmail.com>
	<CAJ7c6TO8GN4qG-M6xk-T-njUO4-=iufykoznCqgRv9RUe0Eg9g@mail.gmail.com>
	<CA+TgmoYuOHg8ijjYZk7VtvxyYr0Sp0ZeJRguoDOsFhhWnxuHdA@mail.gmail.com>
	<CAPF61jCNEZCmM51YRL+N2MiYSnE+Sj11DPjELkeO57awU8PNaw@mail.gmail.com>
	<CAPF61jArDKa3QHhunH=wR__qAghy5gOAJoFyvXuTSwhcj5gG9A@mail.gmail.com>
	<CA+TgmoYNqimmA0ziZVQhwcUSx2+bWOuvtg0LwR8=3_tSg7abyg@mail.gmail.com>
	<CAPF61jDKLeQe2v5xg8S8BZvu3f+YBoXKx26brq3_aqkCEHEkYg@mail.gmail.com>
	<CA+TgmoY8WUSjwpM8OxwK7meDq0mHpkbXrr+iver1WpZXu_43jA@mail.gmail.com>
	<CAPF61jBgonN=1Tmk6WXmBNnrNCPXS_kdSzZ4H4hQTu1JK9VMHA@mail.gmail.com>
	<CA+TgmoYRMJX6UE9zjeRKUYgnTrtLOayOcg3im2pGQYCgwDpNog@mail.gmail.com>
	<CA+TgmoYsHKB4kx7LSQUTHeBY5i2bBmMt3xLyYgjPbLzPZRdqiQ@mail.gmail.com>



> On Mar 7, 2023, at 10:16 AM, Robert Haas <[email protected]> wrote:
> 
> On Mon, Mar 6, 2023 at 12:36 PM Robert Haas <[email protected]> wrote:
>> So it seems that we still don't have a patch where the
>> value of a variable called lp_valid corresponds to whether or not the
>> L.P. is valid.
> 
> Here's a worked-over version of this patch. Changes:
> 
> - I got rid of the code that sets lp_valid in funny places and instead
> arranged to have check_tuple_visibility() pass up the information on
> the XID status. That's important, because we can't casually apply
> operations like TransactionIdIsCommitted() to XIDs that, for all we
> know, might not even be in the range covered by CLOG. In such cases,
> we should not perform any HOT chain validation because we can't do it
> sensibly; the new code accomplishes this, and also reduces the number
> of CLOG lookups as compared with your version.
> 
> - I moved most of the HOT chain checks from the loop over the
> predecessor[] array to the loop over the successor[] array. It didn't
> seem to have any value to put them in the third loop; it forces us to
> expend extra code to distinguish between redirects and tuples,
> information that we already had in the second loop. The only check
> that seems to make sense to do in that last loop is the one for a HOT
> chain that starts with a HOT tuple, which can't be done any earlier.
> 
> - I realized that your patch had a guard against setting the
> predecessor[] when it was set already only for tuples, not for
> redirects. That means if a redirect pointed into the middle of a HOT
> chain we might not report corruption appropriately. I fixed this and
> reworded the associated messages a bit.
> 
> - Assorted cosmetic and comment changes.
> 
> I think this is easier to follow and more nearly correct, but what do
> you (and others) think?

Thanks, Robert.  Quickly skimming over this patch, it looks like something reviewable.  Your changes to t/004_verify_heapam.pl appear to be consistent with how that test was intended to function.

Note that I have not tried any of this yet.

—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company









view thread (29+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: HOT chain validation in verify_heapam()
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox