Re: Strange decreasing value of pg_last_wal_receive_lsn()

From: godjan • <g0dj4n(at)gmail(dot)com>
To: Sergei Kornilov <sk(at)zsrv(dot)org>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Strange decreasing value of pg_last_wal_receive_lsn()
Date: 2020-05-08 10:02:26
Message-ID: C1BDB628-A26D-4D14-A481-341A239089B7@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I got it, thank you.
Can you recommend what to use to determine which quorum standby should be promoted in such case?
We planned to use pg_last_wal_receive_lsn() to determine which has fresh data but if it returns the beginning of the segment on both replicas we can’t determine which standby confirmed that write transaction to disk.

> On 8 May 2020, at 14:50, Sergei Kornilov <sk(at)zsrv(dot)org> wrote:
>
> Hello
>
> Yes, this is expected. Walreceiver always start streaming from beginning of the wal segment.
> ./src/backend/replication/walreceiverfuncs.c in RequestXLogStreaming:
>
> * We always start at the beginning of the segment. That prevents a broken
> * segment (i.e., with no records in the first half of a segment) from
> * being created by XLOG streaming, which might cause trouble later on if
> * the segment is e.g archived.
>
> regards, Sergei

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matt Daw 2020-05-08 11:58:39 Re: Improving estimates for TPC-H Q2
Previous Message Sergei Kornilov 2020-05-08 09:50:32 Re: Strange decreasing value of pg_last_wal_receive_lsn()