pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Lakhin <exclusion@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
To: Andrey Borodin <x4mmm@yandex-team.ru>
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: Mon, 17 Aug 2026 14:00:01 +0300
Message-ID: <417c58cc-284b-4280-8c6f-1c18e0b2a317@gmail.com> (raw)
In-Reply-To: <CA+TgmoYHsXbGeL5hUFq-0hz=3pE3reOxdfr2matWswHDintcqA@mail.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>

Hello Robert and Andrey,

10.08.2026 21:20, Robert Haas wrote:
> Thanks to both of you for the analysis, and apologies for the slow
> response. Here's a patch. I think the tricky part is justifying the
> change, which I at least find counterintuitive (else I would have done
> it right to begin with!). The attached patch attempts to explain via a
> lengthy comment.

Thank you for paying attention to that test defect!

Meanwhile, other buildfarm animal, morepork, was lucky enough to reveal
one more issue, thanks to its timings: [1], [2].
[01:07:53.816](18.983s) ok 1 - WAL summarization on node3 advanced past timeline switch
[01:07:53.830](0.014s) not ok 2 - no summaries from before LSN 0/0301DC20
[01:07:53.831](0.000s)
[01:07:53.831](0.000s) #   Failed test 'no summaries from before LSN 0/0301DC20'
#   at t/003_tli_switch.pl line 121.
[01:07:53.831](0.000s) #          got: '0/0301DBE8|0/0301DC20'
#     expected: ''
[01:07:53.843](0.012s) not ok 3 - at least one summary from LSN 0/0301DC20 or later
[01:07:53.843](0.000s)
[01:07:53.843](0.000s) #   Failed test 'at least one summary from LSN 0/0301DC20 or later'
#   at t/003_tli_switch.pl line 130.

003_tli_switch_node1.log
2026-08-15 01:07:37.126 CEST [68231:1] LOG:  starting PostgreSQL 19beta3 on x86_64-unknown-openbsd6.9, compiled by 
OpenBSD clang version 10.0.1 , 64-bit
...
2026-08-15 01:07:51.657 CEST [9984:4] 003_tli_switch.pl LOG: statement: SELECT pg_switch_wal();
2026-08-15 01:07:51.658 CEST [9984:5] 003_tli_switch.pl LOG: statement: CREATE TABLE dummy ();
..
2026-08-15 01:07:52.200 CEST [4172:4] 003_tli_switch.pl LOG: statement: SELECT pg_current_wal_flush_lsn()
...
2026-08-15 01:07:52.226 CEST [72425:4] 003_tli_switch.pl LOG: statement: SELECT pg_current_wal_insert_lsn()

That is, ~15 seconds passed from the server start to the pg_current_wal_insert_lsn()
call. So I guess, the test failed due to bgwriter's LogStandbySnapshot. I
could reproduce such a failure locally with:
inline patch 1: src/backend/postmaster/bgwriter.c (+2/-2 lines) download inline-1.patch--- a/src/backend/postmaster/bgwriter.c +++ b/src/backend/postmaster/bgwriter.c @@ -70,3 +70,3 @@ int            BgWriterDelay = 200;   */ -#define LOG_SNAPSHOT_INTERVAL_MS 15000 +#define LOG_SNAPSHOT_INTERVAL_MS 1 @@ -308,3 +308,3 @@ BackgroundWriterMain(const void *startup_data, size_t startup_data_len)                         WL_LATCH_SET | WL_TIMEOUT | WL_EXIT_ON_PM_DEATH, -                       BgWriterDelay /* ms */ , WAIT_EVENT_BGWRITER_MAIN); +                       1 /* ms */ , WAIT_EVENT_BGWRITER_MAIN);
make -s check -C src/bin/pg_walsummary # +++ tap check in src/bin/pg_walsummary +++ t/001_basic.pl ....... ok t/002_blocks.pl ...... ok t/003_tli_switch.pl .. 1/? #   Failed test 'no summaries from before LSN 0/0401DD28' #   at t/003_tli_switch.pl line 121. #          got: '0/0401DCF0|0/0401DD28' #     expected: '' #   Failed test 'at least one summary from LSN 0/0401DD28 or later' #   at t/003_tli_switch.pl line 130. # Looks like you failed 2 tests of 3. t/003_tli_switch.pl .. Dubious, test returned 2 (wstat 512, 0x200) Failed 2/3 subtests Test Summary Report ------------------- t/003_tli_switch.pl (Wstat: 512 (exited 2) Tests: 3 Failed: 2)   Failed tests:  2-3   Non-zero exit status: 2 Files=3, Tests=22,  3 wallclock secs ( 0.01 usr  0.00 sys +  0.21 cusr  0.38 csys =  0.60 CPU) Result: FAIL (Basic check-world passes with this change for me.) Could you please look at this anomaly too? [1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=morepork&dt=2026-08-12%2018%3A51%3A34 [2] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=morepork&dt=2026-08-14%2022%3A32%3A27 Best regards, Alexander

view thread (31+ messages)  latest in thread

Message-ID: <417c58cc-284b-4280-8c6f-1c18e0b2a317@gmail.com>
Permalink:  ../417c58cc-284b-4280-8c6f-1c18e0b2a317@gmail.com/
Also on:    postgresql.org/message-id/417c58cc-284b-4280-8c6f-1c18e0b2a317@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, robertmhaas@gmail.com, x4mmm@yandex-team.ru, houzj.fnst@fujitsu.com, amit.kapila16@gmail.com
  Subject: Re: walsummarizer can get stuck when switching timelines
  In-Reply-To: <417c58cc-284b-4280-8c6f-1c18e0b2a317@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>

* 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