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

From Jeff Davis
Subject Re: pgsql: Add contrib/pg_walinspect.
Date
Msg-id 8855927ae2fe471f5a9d2e371ac5fb1834357181.camel@j-davis.com
Whole thread Raw
In response to Re: pgsql: Add contrib/pg_walinspect.  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
List pgsql-hackers
On Wed, 2022-04-27 at 13:47 +0530, Bharath Rupireddy wrote:
> I found an easy way to reproduce this consistently (I think on any
> server):
> 
> I basically generated huge WAL record (I used a fun extension that I
> wrote - https://github.com/BRupireddy/pg_synthesize_wal, but one can
> use pg_logical_emit_message as well)

Thank you Bharath for creating the extension and the simple test case.

Thomas's patch solves the issue for me as well.

Tom, the debug patch you posted[0] seems to be setting the error
message if it's not already set. Thomas's patch uses the lack of a
message as a signal that we've reached the end of WAL. That explains
why you are still seeing the problem.

Obviously, that's a sign that Thomas's patch is not the cleanest
solution. But other approaches would be more invasive. I guess the
question is whether that's a good enough solution for now, and
hopefully we could improve the API later; or whether we need to come up
with something better.

When reviewing, I considered the inability to read old WAL and the
inability to read flushed-in-the-middle-of-a-record WAL as similar
kinds of errors that the user would need to deal with. But they are
different: the former can be avoided by creating a slot; the latter
can't be easily avoided, only retried.

Depending on the intended use cases, forcing the user to retry might be
reasonable, in which case we could consider this a test problem rather
than a real problem, and we might be able to do something simpler to
just stabilize the test.

Regards,
    Jeff Davis

[0] https://postgr.es/m/295868.1651024073@sss.pgh.pa.us





pgsql-hackers by date:

Previous
From: Mark Dilger
Date:
Subject: Re: Unstable tests for recovery conflict handling
Next
From: Mark Dilger
Date:
Subject: Re: Unstable tests for recovery conflict handling