Re: Exit walsender before confirming remote flush in logical replication
Vitaly Davydov <v.davydov@postgrespro.ru>
From: Vitaly Davydov <v.davydov@postgrespro.ru>
To: Fujii Masao <masao.fujii@gmail.com>,
Andrey Silitskiy <a.silitskiy@postgrespro.ru>
Cc: Greg Sabino Mullane <htamfids@gmail.com>, Japin Li <japinli@hotmail.com>,
Ronan Dunklau <ronan@dunklau.fr>,
"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>,
Alexander Korotkov <aekorotkov@gmail.com>
Date: 2026-03-25T15:16:13Z
Lists: pgsql-hackers
Hi Fujii-san, Thank you for the testing. On 3/25/26 15:39, Fujii Masao wrote: > I tested wal_sender_shutdown_timeout under several configurations and > encountered a case where the primary shutdown got stuck, even with the patch > and wal_sender_shutdown_timeout = 1. I'm not sure yet whether this is a bug in > the patch or an issue with my test setup, but anyway I'd like to share > the reproduction steps for reference. It seems that the problem lies in the logic of calculating sleep time in WalSndComputeSleeptime function. If the parameter wal_sender_timeout is set to one hour and the function WalSndWait executes with an argument sleeptime = 1h, then the variable shutdown_request_timestamp will only be updated after one hour at next call of WalSndCheckShutdownTimeout immediately following the waiting period completion. May be to use the minimal timeout in WalSndComputeSleeptimes or to use the timeouts mechanism (timeout.c), but WalSndWait should wake up on latch then. With best regards, Vitaly
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Avoid blocking indefinitely while finishing walsender shutdown
- c0b24b32b0d3 19 (unreleased) landed
-
Add wal_sender_shutdown_timeout GUC to limit shutdown wait for replication
- a8f45dee9176 19 (unreleased) landed
-
pg_upgrade: Add --copy option
- 746915c68669 16.0 cited
-
Prevent possibility of panics during shutdown checkpoint.
- c6c333436491 10.0 cited
-
Support clean switchover.
- 985bd7d49726 9.4.0 cited