Re: Exit walsender before confirming remote flush in logical replication

Alexander Korotkov <aekorotkov@gmail.com>

From: Alexander Korotkov <aekorotkov@gmail.com>
To: Fujii Masao <masao.fujii@gmail.com>
Cc: Andrey Silitskiy <a.silitskiy@postgrespro.ru>, Greg Sabino Mullane <htamfids@gmail.com>, Japin Li <japinli@hotmail.com>, Ronan Dunklau <ronan@dunklau.fr>, Vitaly Davydov <v.davydov@postgrespro.ru>, "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>
Date: 2026-03-29T12:34:06Z
Lists: pgsql-hackers

Attachments

Hi, Fujii!

On Wed, Mar 25, 2026 at 2:39 PM Fujii Masao <masao.fujii@gmail.com> wrote:
> In my tests, the shutdown in step #6 got stuck.
>
> Any thoughts on whether this indicates a problem in the patch or
> something off in my setup?

I tried your test case, but I didn't stuck for me while using v5 patch
from Andrey [1].

One possible idea why hand may happen for is is that
WalSndWaitForWal() has missing WalSndCheckShutdownTimeout() call.  See
the patch attached.  Could I ask you, to retry with this patch applied
on top of v5 patch by Andrey [1].  And also, if possible, turn your
test into a perl tap test inside 038_walsnd_shutdown_timeout.pl.

Thank you.

Links
1. https://www.postgresql.org/message-id/aed6b990-e7d8-40d1-96a4-64ccbfbda876%40postgrespro.ru

------
Regards,
Alexander Korotkov
Supabase

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.