| From: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
|---|---|
| To: | Alexander Korotkov <aekorotkov(at)gmail(dot)com> |
| Cc: | Andrey Silitskiy <a(dot)silitskiy(at)postgrespro(dot)ru>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, "Takamichi Osumi (Fujitsu)" <osumi(dot)takamichi(at)fujitsu(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "sawada(dot)mshk(at)gmail(dot)com" <sawada(dot)mshk(at)gmail(dot)com>, "michael(at)paquier(dot)xyz" <michael(at)paquier(dot)xyz>, "peter(dot)eisentraut(at)enterprisedb(dot)com" <peter(dot)eisentraut(at)enterprisedb(dot)com>, "dilipbalaut(at)gmail(dot)com" <dilipbalaut(at)gmail(dot)com>, "andres(at)anarazel(dot)de" <andres(at)anarazel(dot)de>, "amit(dot)kapila16(at)gmail(dot)com" <amit(dot)kapila16(at)gmail(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Greg Sabino Mullane <htamfids(at)gmail(dot)com>, Vitaly Davydov <v(dot)davydov(at)postgrespro(dot)ru> |
| Subject: | Re: Exit walsender before confirming remote flush in logical replication |
| Date: | 2026-01-09 07:47:23 |
| Message-ID: | CAHGQGwFv-SFkRGbZ1H6+rP22AiPy1d9+0949tqk62B8LKpe1+w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Sat, Jan 3, 2026 at 9:32 AM Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
>
> Hi, Andrey!
>
> On Thu, Nov 27, 2025 at 12:19 PM Andrey Silitskiy
> <a(dot)silitskiy(at)postgrespro(dot)ru> wrote:
> > On Nov 23, 2025 at 11:46 PM Fujii Masao
> > <masao(dot)fujii(at)gmail(dot)com> wrote:
> > > The difference is that PGC_USERSET also allows per–replication-user
> > > overrides when needed, which gives users more flexibility without
> > > losing the ability to set a server-wide setting, I think.
> > > ...
> > > I think there are valid use cases for applying this setting to
> > > physical replication as well.
> > Thanks for the comments. I agree, this parameter also seems usable
> > for physical replication, if you use it with caution. In this case,
> > it really becomes useful to be able to configure a parameter for
> > each connection. I have added these changes to my patch.
> >
> > Also, earlier I did not mention another difference between my patch
> > and those discussed earlier. Previously, even in immediate mode,
> > WalSndCaughtUp flag was checked before calling WalSndDone,
> > and this made it impossible to shut down even in immediate mode
> > with WalSndCaughtUp = false when the server has full output buffers.
> > This does not happen in the current patch implementation. I added
> > an additional test case for this situation.
>
> Thank you for reviving this thread. I think it is reasonable to move
> control over the walsender shutdown behavior to the primary server. I
> see an analogy with synchronous_commit and synchronous_standby_names.
> Primary decides which standbys wait and which way to wait for them.
> Similarly, the primary should decide who to wait on the shutdown.
>
> I would like to make a couple of suggestions for the patch.
> 1) I think it's useful to tune particular standbys/subscribers to
> specify the walsender shutdown mode. It was possible in the patch by
> Hayato Kuroda, and it would be a pity to lose. I suggest implementing
> the walsender shutdown mode as a replication slot option.
Even with the proposed patch, this can already be done by setting
wal_sender_shutdown_mode in primary_conninfo for physical
replication, or in the CONNECTION clause of CREATE SUBSCRIPTION for
logical replication. For example:
CREATE SUBSCRIPTION ... CONNECTION 'options=''-c
wal_sender_shutdown_mode=immediate''' ...
This allows wal_sender_shutdown_mode in postgresql.conf on the
primary or publisher to act as the default, while different values can
be specified per replication connection via primary_conninfo or the
CONNECTION clause. Thought?
Regards,
--
Fujii Masao
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bertrand Drouvot | 2026-01-09 07:53:08 | Re: Add parallel columns for seq scan and index scan on pg_stat_all_tables and _indexes |
| Previous Message | Steven Niu | 2026-01-09 07:36:59 | Re: Pasword expiration warning |