Re: Small fixes needed by high-availability tools - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Small fixes needed by high-availability tools
Date
Msg-id CAA4eK1+c8YYQ2BFpriuo5gKArq4=KQzw+FgEm8TZzRKJQmZnBQ@mail.gmail.com
Whole thread Raw
In response to Small fixes needed by high-availability tools  (Andrey Borodin <x4mmm@yandex-team.ru>)
List pgsql-hackers
On Fri, May 2, 2025 at 6:30 PM Andrey Borodin <x4mmm@yandex-team.ru> wrote:
>
> 3. Allow reading LSN written by walreciever, but not flushed yet
>
> Problem: if we have synchronous_standby_names = ANY(node1,node2), node2 might be ahead of node1 by flush LSN, but
beforeby written LSN. If we do a failover we choose node2 instead of node1 and loose data recently committed with
synchronous_commit=remote_write.
>

In which case, can we rely on written WAL that is not yet flushed?
Because say you decide based on written WAL and choose node-1 in above
case for failover, what if it restarts without flushing the written
WAL?

> Caveat: we already have a function pg_last_wal_receive_lsn(), which in fact returns flushed LSN, not written. I
proposeto add a new function which returns LSN actually written. Internals of this function are already implemented
(GetWalRcvWriteRecPtr()),but unused. 
>

It seems to me that this is less controversial than your other two
proposals. So, we can discuss this in a separate thread as well.

--
With Regards,
Amit Kapila.



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Adding skip scan (including MDAM style range skip scan) to nbtree
Next
From: Amit Kapila
Date:
Subject: Re: Add an option to skip loading missing publication to avoid logical replication failure