pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Lakhin <exclusion@gmail.com>
To: Andrey Borodin <x4mmm@yandex-team.ru>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Zhijie Hou (Fujitsu) <houzj.fnst@fujitsu.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: walsummarizer can get stuck when switching timelines
Date: Fri, 21 Aug 2026 19:00:00 +0300
Message-ID: <d660f27d-535d-4d7f-9394-b52198051d47@gmail.com> (raw)
In-Reply-To: <55A6AB0E-D4A8-43CD-B79B-2CD5D5828C45@yandex-team.ru>
References: <CA+Tgmobr27GpKDZx3_ezW2+C5_g18i+jSK3sGF_cR-_ESv5N5A@mail.gmail.com>
	<CAA4eK1+qKQq5ffzOxHgRy9eJO85O7BFCtXYJ1LvDnvMyKExFJw@mail.gmail.com>
	<820AC023-9025-43A4-ABDD-F6FB96C53C56@yandex-team.ru>
	<CAA4eK1JFpJaV9f9kOpBCi4d4h53RFeMcoZb0cjvKkSLsxXhdLw@mail.gmail.com>
	<CEC18F49-3FE2-4CD4-942B-7B239F86F79A@yandex-team.ru>
	<CA+TgmoZ3o__hmheSynhrY1kHhQdSUM4+UFD_tZ6EDbGAtVENmw@mail.gmail.com>
	<TY4PR01MB17718EBC89F1123AB76E999CE94C72@TY4PR01MB17718.jpnprd01.prod.outlook.com>
	<CA+TgmobiOWKwec1koA6js27srZ=CuXy9OKuQ3BHgDM_GGtGfFw@mail.gmail.com>
	<CA+TgmoZtLS2OBRRp=yebS-17OOfE-QYbRzc8VZFs94Y2nYYRnw@mail.gmail.com>
	<294c42ea-2608-4bae-93de-6c1ba5f72107@gmail.com>
	<ABE387F1-27B4-41E0-9608-D5F6B0C290FE@yandex-team.ru>
	<CA+TgmoYHsXbGeL5hUFq-0hz=3pE3reOxdfr2matWswHDintcqA@mail.gmail.com>
	<417c58cc-284b-4280-8c6f-1c18e0b2a317@gmail.com>
	<55A6AB0E-D4A8-43CD-B79B-2CD5D5828C45@yandex-team.ru>

Hi Andrey,

20.08.2026 21:43, Andrey Borodin wrote:
> I think you are right. The test records node1_final_lsn after waiting
> for node2 to catch up. Any WAL generated on node1 between those two
> operations can therefore move node1_final_lsn past the point from which
> node2 is later promoted.
>
> Perhaps we should instead obtain the LSN together with the operation
> whose WAL we want node2 to replay, and only then wait for catchup:
>
> my $node1_final_lsn = $node1->safe_psql('postgres', <<EOM);
> CREATE TABLE dummy ();
> SELECT pg_current_wal_insert_lsn();
> EOM
> $node1->wait_for_replay_catchup($node2);
>
> This way node1_final_lsn identifies the position immediately after the
> test's own pre-promotion WAL, and wait_for_replay_catchup() guarantees
> that node2 has replayed at least that far. Any WAL generated on node1
> afterwards can no longer move the reference point past node2's fork
> point.
>
> WDYT?
>

I wonder if $node1_final_lsn should be pg_current_wal_flush_lsn instead of
pg_current_wal_insert_lsn. I've tried flush_lsn and it seems to fix the
issue, but I'm not sure if it's correct test-wise.

Best regards,
Alexander






view thread (31+ messages)  latest in thread

Message-ID: <d660f27d-535d-4d7f-9394-b52198051d47@gmail.com>
Permalink:  ../d660f27d-535d-4d7f-9394-b52198051d47@gmail.com/
Also on:    postgresql.org/message-id/d660f27d-535d-4d7f-9394-b52198051d47@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: exclusion@gmail.com, x4mmm@yandex-team.ru, robertmhaas@gmail.com, houzj.fnst@fujitsu.com, amit.kapila16@gmail.com
  Subject: Re: walsummarizer can get stuck when switching timelines
  In-Reply-To: <d660f27d-535d-4d7f-9394-b52198051d47@gmail.com>
  References: <CA+Tgmobr27GpKDZx3_ezW2+C5_g18i+jSK3sGF_cR-_ESv5N5A@mail.gmail.com> <CAA4eK1+qKQq5ffzOxHgRy9eJO85O7BFCtXYJ1LvDnvMyKExFJw@mail.gmail.com> <820AC023-9025-43A4-ABDD-F6FB96C53C56@yandex-team.ru> <CAA4eK1JFpJaV9f9kOpBCi4d4h53RFeMcoZb0cjvKkSLsxXhdLw@mail.gmail.com> <CEC18F49-3FE2-4CD4-942B-7B239F86F79A@yandex-team.ru> <CA+TgmoZ3o__hmheSynhrY1kHhQdSUM4+UFD_tZ6EDbGAtVENmw@mail.gmail.com> <TY4PR01MB17718EBC89F1123AB76E999CE94C72@TY4PR01MB17718.jpnprd01.prod.outlook.com> <CA+TgmobiOWKwec1koA6js27srZ=CuXy9OKuQ3BHgDM_GGtGfFw@mail.gmail.com> <CA+TgmoZtLS2OBRRp=yebS-17OOfE-QYbRzc8VZFs94Y2nYYRnw@mail.gmail.com> <294c42ea-2608-4bae-93de-6c1ba5f72107@gmail.com> <ABE387F1-27B4-41E0-9608-D5F6B0C290FE@yandex-team.ru> <CA+TgmoYHsXbGeL5hUFq-0hz=3pE3reOxdfr2matWswHDintcqA@mail.gmail.com> <417c58cc-284b-4280-8c6f-1c18e0b2a317@gmail.com> <55A6AB0E-D4A8-43CD-B79B-2CD5D5828C45@yandex-team.ru> <d660f27d-535d-4d7f-9394-b52198051d47@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox