postgresql/src
Fujii Masao b5a8018116 pg_recvlogical: send final feedback on SIGINT/SIGTERM shutdown
Previously, when pg_recvlogical exited due to SIGINT or SIGTERM,
it could terminate without sending final feedback for the last decoded
changes it had already written locally. So, if pg_recvlogical was
restarted afterwards, the server-side logical replication slot could
still point behind those changes, causing them to be sent again.

Make pg_recvlogical send final feedback once more during SIGINT/SIGTERM
shutdown, before sending CopyDone. This gives the server one more chance
to advance the slot far enough to avoid resending already-written data,
so users are less likely to see duplicate decoded output after stopping
and restarting pg_recvlogical.

This remains a best-effort improvement rather than a guarantee. Depending
on when the signal arrives, pg_recvlogical can already have written
decoded output that the server cannot yet safely treat as confirmed, so a
later restart can still receive duplicate data.

Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwE83z9O=X7ADMsSa3e1EuP3_GgqHjFt5SmPDNxZo_wgJA@mail.gmail.com
2026-07-08 12:16:34 +09:00
..
backend Tighten nullingrels checks for outer joins 2026-07-08 12:02:21 +09:00
bin pg_recvlogical: send final feedback on SIGINT/SIGTERM shutdown 2026-07-08 12:16:34 +09:00
common unicode_case.c: change API to signal UTF8 decoding error. 2026-07-07 15:34:05 -07:00
fe_utils Add comment to describe the various frontend cancel methods 2026-07-06 19:11:04 +03:00
include Tighten nullingrels checks for outer joins 2026-07-08 12:02:21 +09:00
interfaces libpq: Drain all pending bytes from SSL/GSS during pqReadData() 2026-07-07 18:45:37 +03:00
makefiles Add CONCURRENTLY option to REPACK 2026-04-06 21:55:08 +02:00
pl Make PLy_elog() use pg_integer_constant_p(). 2026-07-06 13:48:42 -04:00
port Use C11 alignas instead of pg_attribute_aligned 2026-07-01 08:36:43 +02:00
template Switch the semaphore API on Solaris to unnamed POSIX. 2026-03-14 14:10:32 -04:00
test Fix unintentional behavior change from 5a38104b36. 2026-07-07 18:04:33 -07:00
timezone Fix macro-redefinition warning introduced by aeb07c55f. 2026-07-01 13:44:45 -04:00
tools Fix qual pushdown past grouping with mismatched equivalence 2026-07-06 16:13:14 +09:00
tutorial Pre-beta mechanical code beautification, step 1: run pgindent. 2026-05-13 10:34:17 -04:00
.gitignore
DEVELOPERS
Makefile Add CONCURRENTLY option to REPACK 2026-04-06 21:55:08 +02:00
Makefile.global.in Update Unicode data to CLDR 48.2 2026-04-13 11:13:36 +02:00
Makefile.shlib Restore AIX support. 2026-02-23 13:34:22 -05:00
meson.build Update copyright for 2026 2026-01-01 13:24:10 -05:00
nls-global.mk Fix update-po for the PGXS case 2025-10-16 20:21:05 +02:00