Re: pg_recvlogical: Prevent flushed data from being re-sent after restarting replication
Fujii Masao <masao.fujii@gmail.com>
From: Fujii Masao <masao.fujii@gmail.com>
To: Mircea Cadariu <cadariu.mircea@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-01-07T03:36:32Z
Lists: pgsql-hackers
Attachments
- v4-0004-pg_recvlogical-remove-unnecessary-OutputFsync-ret.patch (application/octet-stream) patch v4-0004
- v4-0003-Add-test-for-pg_recvlogical-reconnection-behavior.patch (application/octet-stream) patch v4-0003
- v4-0001-pg_recvlogical-Prevent-flushed-data-from-being-re.patch (application/octet-stream) patch v4-0001
- v4-0002-Add-a-new-helper-function-wait_for_file-to-Utils..patch (application/octet-stream) patch v4-0002
On Mon, Dec 29, 2025 at 9:45 PM Mircea Cadariu <cadariu.mircea@gmail.com> wrote: > > Hi, > > Thanks for the patch updates. > > On 26/12/2025 10:28, Fujii Masao wrote: > > Maybe it's better to use slurp_file(). We already have wait_for_log() to > wait for a message in the cluster's log file, but there's no helper function > to wait for specific content to appear in an arbitrary file. > > To support waiting for output in pg_recvlogical's output file, > I added a new helper that uses slurp_file() (see the attached 0002 patch). > I also updated the 0003 patch (the pg_recvlogical reconnection test) to > use this helper instead of pg_read_file(). Thoughts? > > Agreed, nice addition. > > I applied the v3-000* patch set and it builds successfully and passes the tests on my laptop. > > However the CI seems not completely happy yet, with previous 2 runs not green for Windows. Could it be there's an issue with executing the test on Windows? Thanks for the report! The TAP test failed on Windows because it attempted to terminate pg_recvlogical using a TERM signal, which isn't available there. As a result, the test waited indefinitely for pg_recvlogical to exit and finally timed out. To address this, I updated the 0003 patch so that the test passes --endpos to pg_recvlogical on Windows only. This allows pg_recvlogical to terminate without signals, by generating WAL until the current position reaches the specified end position. OTOH, on non-Windows platforms, the test continues to use signals to terminate pg_recvlogical. 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. Updated patches are attached. Regards, -- Fujii Masao
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
pg_recvlogical: remove unnecessary OutputFsync() return value checks.
- b98cc4a14e53 19 (unreleased) landed
-
Add test for pg_recvlogical reconnection behavior.
- d89b1d817513 19 (unreleased) landed
-
Add a new helper function wait_for_file() to Utils.pm.
- 0b10969db610 19 (unreleased) landed
-
pg_recvlogical: Prevent flushed data from being re-sent.
- 41cbdab0ab6d 19 (unreleased) landed