Re: HOT chain validation in verify_heapam()

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Aleksander Alekseev <aleksander@timescale.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Himanshu Upadhyaya <upadhyaya.himanshu@gmail.com>, Mark Dilger <mark.dilger@enterprisedb.com>
Date: 2023-03-23T23:20:29Z
Lists: pgsql-hackers
On Thu, Mar 23, 2023 at 4:36 PM Andres Freund <andres@anarazel.de> wrote:
> Could it be that the tests didn't exercise the path before?

Hmm, perhaps.

> > Nonetheless, here's a patch. I notice that there's a similar problem
> > in another place, too. get_xid_status() is called a total of five
> > times and it looks like only three of them got it right. I suppose
> > that if this is correct we should back-patch it.
>
> Yea, I think you're right.

OK.

> > +                     report_corruption(ctx,
> > +                                                       pstrdup("xmin is invalid"));
>
> Not a correctnes issue: Nearly all callers to report_corruption() do a
> psprintf(), the remaining a pstrdup(), as here. Seems like it'd be cleaner to
> just make report_corruption() accept a format string?

Meh.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



Commits

  1. amcheck: Generalize one of the recently-added update chain checks.

  2. amcheck: Tighten up validation of redirect line pointers.

  3. amcheck: Fix verify_heapam for tuples where xmin or xmax is 0.

  4. amcheck: Fix a few bugs in new update chain validation.

  5. Fix new test case to work on (some?) big-endian architectures.

  6. Don't test HEAP_XMAX_INVALID when freezing xmax.