Re: Improve search for missing parent downlinks in amcheck - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Improve search for missing parent downlinks in amcheck
Date
Msg-id CAH2-WznEpP4ivXhaRJVT9HeZP4WMEXfJmtTh5txayMaxa9TD_A@mail.gmail.com
Whole thread Raw
In response to Re: Improve search for missing parent downlinks in amcheck  (Peter Geoghegan <pg@bowt.ie>)
List pgsql-hackers
On Thu, Jan 23, 2020 at 5:40 PM Peter Geoghegan <pg@bowt.ie> wrote:
> I suppose the alternative is to get the high key of the parent's left
> sibling, rather than going to the parent's parent (i.e. our
> grandparent). That would probably be the best way to get a separator
> key to compare against the high key in the leftmost cousin page of a
> subtree, if in fact we wanted to *fully* solve the "cousin problem".

I think I've confused myself here. The
"!offset_is_negative_infinity(topaque, pivotkey_offset)" part of the
bt_downlink_connectivity_check() high key check test that I mentioned
now *also* seem unnecessary. Any high key in a page that isn't marked
"half-dead" or marked "deleted" or marked "has incomplete split" can
be targeted by the check. Once the page meets that criteria, there
must be a pivot tuple in the parent page that contains an
identical-to-highkey separator key (this could be the parent's own
high key).

The only thing that you need to do is be careful about rightmost
parent pages of a non-rightmost page -- stuff like that. But, I think
that that's only needed because an amcheck segfault isn't a very nice
way to detect corruption.

The existing comment about negative infinity items within
bt_downlink_check() that I mentioned in my main e-mail (the "Note:"
part) don't quite apply here. You're not verifying a pivot tuple that
has a downlink (which might be negative infinity) against the lower
levels -- you're doing *the opposite*. That is, you're verifying a
high key using the parent. Which seems like the right way to do it --
you can test for the incomplete split flag and so on by doing it
bottom up (not top down). This must have been why I was confused.

Phew!
-- 
Peter Geoghegan



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Improve search for missing parent downlinks in amcheck
Next
From: Arthur Zakirov
Date:
Subject: Re: Add pg_file_sync() to adminpack