Re: pg_recvlogical: Prevent flushed data from being re-sent after restarting replication

Mircea Cadariu <cadariu.mircea@gmail.com>

From: Mircea Cadariu <cadariu.mircea@gmail.com>
To: Fujii Masao <masao.fujii@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-01-09T15:53:55Z
Lists: pgsql-hackers
Hi Fujii,

On 07/01/2026 03:36, Fujii Masao wrote:
> This approach may be somewhat unstable. If there's a more robust
> way to terminate pg_recvlogical on Windows, I'd be happy to switch
> to it, but I couldn't come up with a better option.

Thanks for the updated patch set!

I applied them and it builds correctly and the test passes on my laptop.

About termination on Windows, I've noticed the following in file 
006_logical_decoding.pl:

> # some Windows Perls at least don't like IPC::Run's start/kill_kill regime.
> skip "Test fails on Windows perl", 2 if $Config{osname} eq 'MSWin32';
It seems that previously, in a similar situation the decision was to 
skip it on Windows.

If we adopt the same approach for this test it should be fine, the 
production code in the patch is not Windows-specific.

Alternatively if we keep the approach in v4, we can consider 
updating 006_logical_decoding.pl as well so they're consistent.

What do you think?

-- 
Thanks,
Mircea Cadariu

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. pg_recvlogical: remove unnecessary OutputFsync() return value checks.

  2. Add test for pg_recvlogical reconnection behavior.

  3. Add a new helper function wait_for_file() to Utils.pm.

  4. pg_recvlogical: Prevent flushed data from being re-sent.