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-23T17:34:31Z
Lists: pgsql-hackers
On Thu, Mar 23, 2023 at 1:26 PM Andres Freund <andres@anarazel.de> wrote:
> E.g. continuing after:
>
> rditem = PageGetItemId(ctx.page, rdoffnum);
> if (!ItemIdIsUsed(rditem))
> report_corruption(&ctx,
> psprintf("line pointer redirection to unused item at offset %u",
> (unsigned) rdoffnum));
>
> means we'll look into the tuple in the "update chain validation" loop for
> unused items.
Ah, yes, that's a goof for sure.
> > - * Redirects are created by updates, so successor should be
> > - * the result of an update.
> > + * Redirects are created by HOT updates, so successor should
> > + * be the result of an HOT update.
> > + *
> > + * XXX: HeapTupleHeaderIsHeapOnly() should always imply
> > + * HEAP_UPDATED. This should be checked even when the tuple
> > + * isn't a target of a redirect.
> >
> > Hmm, OK. So the question is where to put this check. Maybe inside
> > check_tuple_header(), making it independent of the update chain
> > validation stuff?
>
> Yes, check_tuple_header sounds sensible to me.
OK, let me spend some more time on this and I'll post a patch (or
patches) in a bit.
--
Robert Haas
EDB: http://www.enterprisedb.com
Commits
-
amcheck: Generalize one of the recently-added update chain checks.
- c87aff065c33 16.0 landed
-
amcheck: Tighten up validation of redirect line pointers.
- 80d5e3a61551 16.0 landed
-
amcheck: Fix verify_heapam for tuples where xmin or xmax is 0.
- 8fd5aa76c367 14.8 landed
- 701ec5557968 15.3 landed
- e88754a1965c 16.0 landed
-
amcheck: Fix a few bugs in new update chain validation.
- 949e2e7c4f68 16.0 landed
-
Fix new test case to work on (some?) big-endian architectures.
- c75a623304bc 16.0 landed
-
Don't test HEAP_XMAX_INVALID when freezing xmax.
- 02d647bbf057 16.0 landed