Re: pgsql: Add contrib/pg_walinspect. - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: pgsql: Add contrib/pg_walinspect.
Date
Msg-id CALj2ACVDYTeiWF8pKv9iz1kbTajunS96pWwLtyaRq_rxwAHrKg@mail.gmail.com
Whole thread Raw
In response to Re: pgsql: Add contrib/pg_walinspect.  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pgsql: Add contrib/pg_walinspect.  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
List pgsql-hackers
On Wed, Apr 27, 2022 at 8:45 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> I wrote:
> > Thomas Munro <thomas.munro@gmail.com> writes:
> >> BTW If you had your local change from debug.patch (upthread), that'd
> >> defeat the patch.  I mean this:
>
> >> +        if(!*errormsg)
> >> +          *errormsg = "decode_queue_head is null";
>
> > Oh!  Okay, I'll retry without that.
>
> I've now done several runs with your patch and not seen the test failure.
> However, I think we ought to rethink this API a bit rather than just
> apply the patch as-is.  Even if it were documented, relying on
> errormsg = NULL to mean something doesn't seem like a great plan.

Sorry for being late in the game, occupied with other stuff.

How about using private_data of XLogReaderState for
read_local_xlog_page_no_wait, something like this?

typedef struct ReadLocalXLogPageNoWaitPrivate
{
    bool end_of_wal;
} ReadLocalXLogPageNoWaitPrivate;

In read_local_xlog_page_no_wait:

            /* If asked, let's not wait for future WAL. */
            if (!wait_for_wal)
           {
                private_data->end_of_wal = true;
                break;
           }

    /*
     * Opaque data for callbacks to use.  Not used by XLogReader.
     */
    void       *private_data;

Regards,
Bharath Rupireddy.



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: Possible corruption by CreateRestartPoint at promotion
Next
From: "Rui Zhao"
Date:
Subject: Re:Possible corruption by CreateRestartPoint at promotion