Re: Exit walsender before confirming remote flush in logical replication

Andrey Silitskiy <a.silitskiy@postgrespro.ru>

From: Andrey Silitskiy <a.silitskiy@postgrespro.ru>
To: Michael Paquier <michael@paquier.xyz>
Cc: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>, Vitaly Davydov <v.davydov@postgrespro.ru>, "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>, "Takamichi Osumi (Fujitsu)" <osumi.takamichi@fujitsu.com>, "sawada.mshk@gmail.com" <sawada.mshk@gmail.com>, "peter.eisentraut@enterprisedb.com" <peter.eisentraut@enterprisedb.com>, "dilipbalaut@gmail.com" <dilipbalaut@gmail.com>, "andres@anarazel.de" <andres@anarazel.de>, "amit.kapila16@gmail.com" <amit.kapila16@gmail.com>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>, Peter Smith <smithpb2250@gmail.com>, Greg Sabino Mullane <htamfids@gmail.com>, Alexander Korotkov <aekorotkov@gmail.com>, Fujii Masao <masao.fujii@gmail.com>
Date: 2026-02-04T14:03:58Z
Lists: pgsql-hackers
On Mon, Feb 2, 2026 at 4:56 PM Michael Paquier
<michael(at)paquier(dot)xyz> wrote:
 > Couldn't that be potentially dangerous, particularly if
 > wal_sender_shutdown_mode is set to immediate, meaning that it applies
 > to all the WAL senders?  The WAL receiver side could be on a backend
 > with an older backend version than the WAL sender where this new GUC
 > exists.

So far, I can't provide a scenario where the old-version receiving side is
having problems due to the behavior of immediate wal_sender_shutdown_mode.
Maybe someone else can.

Even if walsender immediate shutdown mode is set on the sender, it flushes
a done message to the receiver, as it is being done now. In the case 
when this
is not possible, it terminates in a similar way as it is currently doing
in WalSndShutdown(), the old receiver also seems to be able to handle this
case.

Regards,
Andrey Silitskiy



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Avoid blocking indefinitely while finishing walsender shutdown

  2. Add wal_sender_shutdown_timeout GUC to limit shutdown wait for replication

  3. pg_upgrade: Add --copy option

  4. Prevent possibility of panics during shutdown checkpoint.

  5. Support clean switchover.