Re: Allow reading LSN written by walreciever, but not flushed yet

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: Rahila Syed <rahilasyed90(at)gmail(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allow reading LSN written by walreciever, but not flushed yet
Date: 2025-10-06 09:00:47
Message-ID: F480CB4D-BF88-44CD-9FFD-E0C82D00FFCE@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 6 Oct 2025, at 11:16, Rahila Syed <rahilasyed90(at)gmail(dot)com> wrote:
>
> Can you please explain the scenarios in which the record pointer of the WAL record written
> by the receiver can move backwards.
> For example, in physical replication, the WAL records are sent after a Flush on the primary in ascending
> order of XLogRecPtr. They are also received in that order and written as they arrive by the receiver.
> Are you referring to crash scenarios where unflushed WAL may be discarded and receiver has
> to move backwards and start from the last flushed record on the standby?

I see at least two scenarios:

1. We observe writtenUpto, then system is rebooted and we observe lesser writtenUpto.
2. We observe writtenUpto on one timeline, standby is kill-9-ed and another primary sends timeline change between flushed and previously observed write ptr

If at some point primary will be sending unflushed WAL, this list will grow with possible gray areas on Primary.

Best regards, Andrey Borodin.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Banck 2025-10-06 09:02:39 Re: Should we update the random_page_cost default value?
Previous Message Bertrand Drouvot 2025-10-06 08:57:32 Re: Add stats_reset to pg_stat_all_tables|indexes and related views