Re: Exit walsender before confirming remote flush in logical replication

Andrey Silitskiy <a.silitskiy@postgrespro.ru>

From: Andrey Silitskiy <a.silitskiy@postgrespro.ru>
To: Fujii Masao <masao.fujii@gmail.com>
Cc: Alexander Korotkov <aekorotkov@gmail.com>, 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-04-03T09:37:36Z
Lists: pgsql-hackers

Attachments

On Apr 3, 2026 Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
 > I've updated the patch based on my earlier comments and made some
 > cosmetic improvements.

Thanks for comments! I also just made the same changes after your review.
Attaching an updated patch with fixes after your review, some of last
cosmetic changes and two excluded test cases.

There are currently 5 test cases: two for 0ms(empty and full buffers), two
for 10ms  (empty and full buffers), and one for the standby case. I think
it is ok to exclude two cases with 0ms to speed up the launch of tests.

 > This sentence doesn't seem necessary, as similar GUCs don't mention this

I decided to leave in the documentation a mention of the possibility of
setting a parameter per replication connection. I think some users are not
aware of this possibility and this short sentence might give them the idea.

 > It would also be better to move "replication may be incomplete" to 
errdetail(),
 > and clarify it, for example, "Walsender is terminated before all WAL 
data was
 > replicated to the receiver".

In some cases, replication may be fully completed even when exiting with
WalSndDoneImmediate, so I edited the message.

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.