Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wvv4c-001cjR-1A for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Aug 2026 11:00:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wvv4Z-009iqZ-2n for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Aug 2026 11:00:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wvv4Z-009iqQ-1T for pgsql-hackers@lists.postgresql.org; Mon, 17 Aug 2026 11:00:08 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wvv4V-00000001CdA-2c6w for pgsql-hackers@postgresql.org; Mon, 17 Aug 2026 11:00:07 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-49800c6a846so38038665e9.3 for ; Mon, 17 Aug 2026 04:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786964403; x=1787569203; darn=postgresql.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=isPHRo3QN01Uee6FJfD7ay8XW72LggRFquv3irpcVFU=; b=rGh5bYTkXEl9pxW1iAW8j16seHAYuKxgsC0XLfVTNQXvTQ+xz0wSdwFWXc04cdGBot JxyZncBb1K0sUEb8wwebAo2VTLpHGcu5cLlHfQ0nf1Z0z2zhBqTxv5fZXM0d6xICvRnM TpT8aoDXF7/ial4L16ViXltKv/OHyAbuMkdseIEzHaHcKPwngSUAxtcQwBhujsCWca6w kr4fb3hPN4hxR0YvmdIJBo+f9qbqgNtBxmFnwzT//6Wl1ghyHL/oFfO4XoUmZni4myxe 3WXWtUCehgqW6kWM0KP1cwgISGubNOImH1ZnbkjDI14BlJIuemVIq59UyEL3mkjUxkR9 /yQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786964403; x=1787569203; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=isPHRo3QN01Uee6FJfD7ay8XW72LggRFquv3irpcVFU=; b=nlN8TUoocd76LjTdBrUWTINVRxWPaoGmuF1fI9m+HR/HF1YutTc2+/VvHd0495MH4+ m/IEtEAEzMisDEj/YPvR1bKITQIV9Yimd8RW/zm3RbIftSG+9Ksa6vrAOCzlYV2/fL5o kA3s4pBryED3VA3WQp61QveWmeSR3YtyGLyPEYg4AwZRO8TD3rkYwmi2UIJnkN3A80f8 T9BP8ogmo/CAc3GCRokjYQaKEA248VRY9f89UWFHe1sfnWX03dgqCLmaS0S2dJzWTpKy QgB44QbpXyye5i8qXzGWusBk/N+aFRD48Ae5TuKsSS/SX+HaILGstCPwIDxaY3jUUz4j 6h0A== X-Forwarded-Encrypted: i=1; AHgh+RqE2HJy7KIjMG0oHor61MOv7eUZuX7Pt4L72Y/MZcbqi945a/A5gGB98dPwqsxgL/H2OcFpGmKig0Np9/R7@postgresql.org X-Gm-Message-State: AOJu0YyxSgGqS457bnhBnkgWL3kWTTlFIQppRw+kOim+4fJquWBHI+Yd MLTO5w2oscbdjO6o+VjTgdH0OKoLKJ/+v16W3nvkz/riMF7vwfGjClO5 X-Gm-Gg: AR+sD11tGqdQ/P1OSlQN4rbYEUG9qC6IFNjKyjR2wne8ue4fBH30hiSxmXg0KoykkkR hpaduUIfGG8qdB5Uz/J8D02rDmM9aGwlO7b+kNKvwwAyHt0I6TrTqrYS/3n7rL/vQqQj3GuAgZ4 nh7U1BzweJ6pfJB5TjNDWQreSTmoAy8QPo6xDpWbICZWnJQL0OD9wZskhhD8w+V2CSvt4m6vgNM jIEpoeh7IcoBct9DKiDzUar8ssqBkq2Ex4vP9f38UbWRLvgX9Pm/ceCzmDs6C9A82BFS1x9RLJb +1hJhFwM85D/i/EiUq7DT5FB5g6Mc+NEZg8mRx7ociJ0CgBdSpLm2YLfbGxgswW2GHCVOiPa3Vj /6E9R7Smg7sULfp7wOmFQEmhfwYTM1iK3Wh9nAn8kapIOoxKPVwQN49hqnghrfV+qCQXR99EOBp rFAYri94M44fxVPV+czsQkB1WfnDkfGemrxh1WBYkT9I7bqrTkUR3TkVLrgvdEM9VsAH2Y9bHVt w== X-Received: by 2002:a05:600c:17d1:b0:495:7a04:b006 with SMTP id 5b1f17b1804b1-49987948adamr239346255e9.8.1786964402818; Mon, 17 Aug 2026 04:00:02 -0700 (PDT) Received: from [192.168.0.50] ([89.149.120.180]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-482a5a7c5e7sm3119986f8f.24.2026.08.17.04.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Aug 2026 04:00:02 -0700 (PDT) Message-ID: <417c58cc-284b-4280-8c6f-1c18e0b2a317@gmail.com> Date: Mon, 17 Aug 2026 14:00:01 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: walsummarizer can get stuck when switching timelines To: Robert Haas , Andrey Borodin Cc: "Zhijie Hou (Fujitsu)" , Amit Kapila , "pgsql-hackers@postgresql.org" References: <820AC023-9025-43A4-ABDD-F6FB96C53C56@yandex-team.ru> <294c42ea-2608-4bae-93de-6c1ba5f72107@gmail.com> Content-Language: en-US From: Alexander Lakhin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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