Re: Strengthen pg_waldump's --save-fullpage tests

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Strengthen pg_waldump's --save-fullpage tests
Date: 2023-01-10 04:10:29
Message-ID: CALj2ACWL9eBFbxmAww0-_VofLyBzNsiHJyjpLX4yuFipgX+WFA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 10, 2023 at 6:52 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Mon, Jan 09, 2023 at 08:30:00AM +0530, Bharath Rupireddy wrote:
> > A recent commit [1] added --save-fullpage option to pg_waldump to
> > extract full page images (FPI) from WAL records and save them into
> > files (one file per FPI) under a specified directory. While it added
> > tests to check the LSN from the FPI file name and the FPI file
> > contents, it missed to further check the FPI contents like the tuples
> > on the page. I'm attaching a patch that basically reads the FPI file
> > (saved by pg_waldump) contents and raw page from the table file (using
> > pageinspect extension) and compares the tuples from both of them. This
> > test ensures that the pg_waldump outputs the correct FPI. This idea is
> > also discussed elsewhere [2].
> >
> > Thoughts?
>
> I am not sure that it is necessary to expand this set of tests to have
> dependencies on heap and pageinspect (if we do so, what of index AMs)
> and spend more cycles on that, while we already have something in
> place to cross-check ReadRecPtr with what's stored in the page header
> written on top of the block size.

While checking for a page LSN is enough here, there's no harm in
verifying the whole FPI fetched from WAL record with that of the raw
page data. Also, this test illustrates how one can make use of the
fetched FPI - like reading the contents using pg_read_binary_file()
(of course on can also use COPY command to load the FPI data to
postgres) and using pageinspect functions to make sense of the raw
data.

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-01-10 04:24:48 Re: [Proposal] Add foreign-server health checks infrastructure
Previous Message Peter Geoghegan 2023-01-10 03:59:42 Re: Show various offset arrays for heap WAL records