Re: Wake up backends immediately when sync standbys decrease

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Shinya Kato <shinya11(dot)kato(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Wake up backends immediately when sync standbys decrease
Date: 2026-02-02 06:29:20
Message-ID: DD7A6232-D11C-4C47-8413-1BE8527C0B1B@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Jan 30, 2026, at 23:28, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>
> On Fri, Jan 30, 2026 at 4:49 PM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>>
>>
>>
>>> On Jan 30, 2026, at 14:59, Shinya Kato <shinya11(dot)kato(at)gmail(dot)com> wrote:
>>>
>>> Hi hackers,
>>>
>>> I have noticed an issue where backends waiting for synchronous
>>> replication are not woken up immediately when the number of required
>>> synchronous standbys is reduced in a multiple synchronous standby
>>> environment.
>
> Thanks for reporting this!
>
> This issue can occur not only when the number of sync standbys is reduced,
> but also when the configured standby names change. For example, if the config
> changes from "FIRST 2 (sby1, sby2)" to "FIRST 2 (sby1, sby3)",
> waiters on sby2 should be released immediately. But, currently, there can
> a delay before that happens. Right?
>
>
>> My main concern is code duplication. The same block is added in three places. While the existing reload handling is already duplicated there, adding more logic on top makes the situation a bit worse from a maintenance perspective.
>>
>> Would it make sense to factor the reload handling into a small helper, for example:
>
> +1
>
> Regards,
>
>
> --
> Fujii Masao

Hi Fujii-san,

While reviewing this patch, I noticed a small issue where MyReplicationSlot is dereferenced without checking whether it is NULL. I’ve posted a small follow-up patch to address this. Could you please take a look at [1] when you have a chance?

[1] https://postgr.es/m/6E7BD4F7-C22A-4B6C-A9BD-62877390DF86@gmail.com

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2026-02-02 06:41:34 Re: walsender: Assert MyReplicationSlot is set before use
Previous Message Chao Li 2026-02-02 06:25:01 walsender: Assert MyReplicationSlot is set before use