| From: | Alexander Lakhin <exclusion(at)gmail(dot)com> |
|---|---|
| To: | Robert Haas <robertmhaas(at)gmail(dot)com>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru> |
| Cc: | "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: walsummarizer can get stuck when switching timelines |
| Date: | 2026-08-17 11:00:01 |
| Message-ID: | 417c58cc-284b-4280-8c6f-1c18e0b2a317@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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:
--- 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ilia Evdokimov | 2026-08-17 11:17:08 | Apply extended statistics to join clause during parameterized path costing |
| Previous Message | Yilin Zhang | 2026-08-17 10:47:20 | Re: basebackup: do not verify checksums on pages written before enabling checksums |