Re: Exit walsender before confirming remote flush in logical replication

Fujii Masao <masao.fujii@gmail.com>

From: Fujii Masao <masao.fujii@gmail.com>
To: Andrey Silitskiy <a.silitskiy@postgrespro.ru>
Cc: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>, "Takamichi Osumi (Fujitsu)" <osumi.takamichi@fujitsu.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>, "sawada.mshk@gmail.com" <sawada.mshk@gmail.com>, "michael@paquier.xyz" <michael@paquier.xyz>, "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>, Vitaly Davydov <v.davydov@postgrespro.ru>, Alexander Korotkov <aekorotkov@gmail.com>
Date: 2026-01-19T12:41:32Z
Lists: pgsql-hackers
On Sun, Jan 18, 2026 at 1:20 AM Andrey Silitskiy
<a.silitskiy@postgrespro.ru> wrote:
>
> On Jan 9, 2026 at 10:04 AM Fujii Masao
> <masao(dot)fujii(at)gmail(dot)com> wrote:
> > Why do we need to send a "done" message to the receiver here?
> > Since delivery isn't guaranteed in immediate mode, it seems of limited
> > value.
>
> It seems to me that it is better to send a message in cases where it is
> possible, so as not to raise errors on the subscriber during a clean shutdown.
> And when this is not possible, exit the process without waiting.
>
> > For the immediate mode, would it make sense to log that the walsender is
> > terminating in immediate mode and that WAL replication may be incomplete,
> > so users can more easily understand what happened?
>
> Added to the latest patch.

Thanks for updating the patch!

cfbot is reporting a test failure. Could you please look into it and
fix the issue?
https://cirrus-ci.com/github/postgresql-cfbot/postgresql/cf%2F6234

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 →
  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.