Re: pg_recvlogical: Prevent flushed data from being re-sent after restarting replication - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: pg_recvlogical: Prevent flushed data from being re-sent after restarting replication
Date
Msg-id CAHGQGwEdy3urfwkLwjbzJNW82Uv4djOUg1-6tbqQd9ucUwg38g@mail.gmail.com
Whole thread Raw
In response to Re: pg_recvlogical: Prevent flushed data from being re-sent after restarting replication  (Mircea Cadariu <cadariu.mircea@gmail.com>)
List pgsql-hackers
On Wed, Nov 26, 2025 at 10:25 PM Mircea Cadariu
<cadariu.mircea@gmail.com> wrote:
>
> Hi,
>
> On 25/11/2025 17:16, Fujii Masao wrote:
> > Thanks for writing the test case and turning it into a patch. I agree that
> > we should add a regression test to ensure the reported issue doesn't recur.
> Thanks for your feedback, updated patch is attached. Again, I checked
> that it fails in master, but passes with your patch.

Thanks for updating the patch and testing!

I've made a few minor adjustments to the test patch.
The updated version is attached.

Changes include:
- Tweaked and added some comments in the test.
- Ran pgperltidy to clean up the formatting of 030_pg_recvlogical.pl.
- Reused the existing table test_table instead of creating a new table t.
    (While considering a better name for t, I noticed test_table was
already available)
- Used the "option => value" style in IPC::Run::start() for
consistency with other tests.
- Simplified the SQL used to wait for INSERT to appear in
pg_recvlogical's output file.
- Switched from open() to slurp_file(), since other tests use
slurp_file() for reading files.

Thought?


> > Additionally, when the --no-loop option is used, I found that
> > pg_recvlogical
> > could previously exit without flushing written data, risking data loss.
> > The attached patch fixes this issue by also ensuring that all data is
> > flushed
> > to disk before exiting with --no-loop.
>
> Should we think of some kind of test also for this part?

I'm not sure if it's really worth adding such test...

Regards,

--
Fujii Masao

Attachment

pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Simplify code building the LR conflict messages
Next
From: Tom Lane
Date:
Subject: Re: Simplify code building the LR conflict messages