Re: Strange decreasing value of pg_last_wal_receive_lsn()

Поиск
Список
Период
Сортировка
Искать
От
Jehan-Guillaume de Rorthais
Тема
Re: Strange decreasing value of pg_last_wal_receive_lsn()
Дата
в 14:52:12
Msg-id
20200513165212.3be8841a@firost
Ответ на
Список
Дерево обсуждения
Strange decreasing value of pg_last_wal_receive_lsn() godjan • <g0dj4n@gmail.com>
Re: Strange decreasing value of pg_last_wal_receive_lsn() Sergei Kornilov <sk@zsrv.org>
Re: Strange decreasing value of pg_last_wal_receive_lsn() godjan • <g0dj4n@gmail.com>
Re: Strange decreasing value of pg_last_wal_receive_lsn() Michael Paquier <michael@paquier.xyz>
Re: Strange decreasing value of pg_last_wal_receive_lsn() godjan • <g0dj4n@gmail.com>
Re: Strange decreasing value of pg_last_wal_receive_lsn() Michael Paquier <michael@paquier.xyz>
Re: Strange decreasing value of pg_last_wal_receive_lsn() Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
Re: Strange decreasing value of pg_last_wal_receive_lsn() Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
Re: Strange decreasing value of pg_last_wal_receive_lsn() godjan • <g0dj4n@gmail.com>
Re: Strange decreasing value of pg_last_wal_receive_lsn() Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
Re: Strange decreasing value of pg_last_wal_receive_lsn() godjan • <g0dj4n@gmail.com>
Re: Strange decreasing value of pg_last_wal_receive_lsn() Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
Re: Strange decreasing value of pg_last_wal_receive_lsn() godjan • <g0dj4n@gmail.com>

(too bad the history has been removed to keep context)

On Fri, 8 May 2020 15:02:26 +0500
godjan •  wrote:

> 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.

Wait, pg_last_wal_receive_lsn() only decrease because you killed your standby.

pg_last_wal_receive_lsn() returns the value of walrcv->flushedUpto. The later
is set to the beginning of the segment requested only during the first
walreceiver startup or a timeline fork:

	/*
	 * If this is the first startup of walreceiver (on this timeline),
	 * initialize flushedUpto and latestChunkStart to the starting point.
	 */
	if (walrcv->receiveStart == 0 || walrcv->receivedTLI != tli)
	{
		walrcv->flushedUpto = recptr;
		walrcv->receivedTLI = tli;
		walrcv->latestChunkStart = recptr;
	}
	walrcv->receiveStart = recptr;
	walrcv->receiveStartTLI = tli;

After a primary loss, as far as the standby are up and running, it is fine
to use pg_last_wal_receive_lsn().

Why do you kill -9 your standby? Whay am I missing? Could you explain the
usecase you are working on to justify this?

Regards,


В списке pgsql-hackers по дате отправления
От: Fujii Masao
Дата:
Сообщение: Re: SLRU statistics
От: Tomas Vondra
Дата:
Сообщение: Re: SLRU statistics
FAQ