Re: Small fixes needed by high-availability tools

Amit Kapila <amit.kapila16@gmail.com>

From: Amit Kapila <amit.kapila16@gmail.com>
To: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Cc: Ants Aasma <ants.aasma@cybertec.at>, Andrey Borodin <x4mmm@yandex-team.ru>, Matthias van de Meent <boekewurm+postgres@gmail.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-05-14T09:33:33Z
Lists: pgsql-hackers
On Wed, May 14, 2025 at 2:15 AM Mihail Nikalayeu
<mihailnikalayeu@gmail.com> wrote:
>
> > One idea to solve this problem could be that whenever we cancel
> > sync_rep_wait, we set some system-wide flag that indicates that any
> > new transaction must ensure that all the current data is replicated to
> > the synchronous standby. Once we ensure that we have waited for
> > pending transactions to replicate, we can toggle back that system-wide
> > flag. Now, if the system restarts for any reason during such a wait,
> > we can use your idea to disallow new connections until the standby
> > quorum is established.
>
> It might not necessarily be a flag—it could be some LSN value instead.
> Also, it's not just about a "new transaction," but about any new
> snapshot that could see data not yet replicated to the synchronous
> standby.
>

Sounds reasonable to me. Let us see what others think about it.

-- 
With Regards,
Amit Kapila.