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 1wqYck-002Hb4-1b for pgsql-hackers@arkaria.postgresql.org; Sun, 02 Aug 2026 16:01:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wqYbj-002v9Q-0r for pgsql-hackers@arkaria.postgresql.org; Sun, 02 Aug 2026 16:00:11 +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 1wqYbi-002v9G-2t for pgsql-hackers@lists.postgresql.org; Sun, 02 Aug 2026 16:00:10 +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 1wqYbg-00000001dnB-0zDE for pgsql-hackers@postgresql.org; Sun, 02 Aug 2026 16:00:10 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-49553515a8bso21501425e9.1 for ; Sun, 02 Aug 2026 09:00:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785686406; x=1786291206; darn=postgresql.org; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:content-type:from:to:cc :subject:date:message-id:reply-to:content-type; bh=tdycMiidI2EXe31bd+Ro4i4l3Xyl0siCzIzwE+slhIc=; b=MJ1M4HyNPZSMrxJARvYRBNnkTtdgAaiuYlLvuS2404Ydr/9a6X7flL0BVFedcCAn70 DXNM50X5D1vuhiGFSDJCKDD5egy0mOu03vkr32FB6167aNwVooWpbOE7EOpz0gHJcrhU amUkKh4bw5IbNySRZU+vKvGK2LpLEe897ShCnCMCRxlE5kqnaOf6LzPgJBBZzH8xzKRr C+MYzVtJardDexHsa5NAo3G57PgJ+uLS9aS58QVlYMTVUTPfuUJvaX5Q72WVigCnXLYc K1Oq0f2cMPr89pYQBnZmARGath7CSwhNgUlo8jnBvGDt/31SJTwY5+9FzqZLW9a8FIlo bFvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785686406; x=1786291206; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=tdycMiidI2EXe31bd+Ro4i4l3Xyl0siCzIzwE+slhIc=; b=LhqIHA1VU6MUOZclIqnziUL0aPKpxIUoawKE264zM62Bz6LzI8sqryjidhB5vpTJXo KuS/uG7mJwi90l3qAptmDy42Bav7ZiaGccs6dw0LZoPMBLSLj5ZDlKqgrM+2H+w6LNPv XYYnLqhpiAVk2sW/ptMbORXnnSriMYlG64RGQVoTp8qnswH1ugkiKSnPc0c1XkdbVyAc FSxOFHbF/sTuztaz0JaVjClNOoBfkdpD8c714juTYboXNemmmbK3H6zjuuxAk09f+4F6 NauopEn23J35P6RFfjBqV9a+6DptULk6g6ctTvTE40+bSdfRF3WJH6f4sn/wdV0w8EaP 1PPw== X-Forwarded-Encrypted: i=1; AHgh+RrE8IdzAyCwsnZLsgdI1dF+UwTly2KeSIVM7ETnwrSwUfoFHArdCV22+QfFU7QOqB9scgZc8E7pF5w32k+A@postgresql.org X-Gm-Message-State: AOJu0Yy26QZGd5YfcNqeMXwJYKaOiVZfqmCKb66iBh0e57klfLkAsKsb vyZtR6FZuyA8FBczZb6Xm+FXwJK8o6apRl01u5q5uHJHBDr+JgSDKuiK X-Gm-Gg: AR+sD10Fi6sh/Ertwq4nGZN19Woj5xdp317RnLXu3cEgZJS6dgJdWg22+R/Tt63QWDs MfySJs4Skejod8AckbsEjhi9NDFEkMY6X/WjJ/llpMZiGsshm0iUhoiCnO3iaPSKINsKH7CP1qW LISJy+QmPt86bRQDyjrb9v4gZAeI3G3VJLy9L6BawGQsdP0uym0Z5X/9Hock0y44rWEKqoe7gYV dSEyrDxS7gQm4g0U/qKqjxPJmp1QGvVirlX5MRVxEHaxCN8+IDV/YFfb9RYttZ4ilpvWV+gRd4X vMjhAwVbYAplW1lp+01lC8M3hVjvrY4ja281ld/rZ3JaWqu9TCdXPZyEU18Edyl9LoVDSE/c8R9 uT5jp0iIYUiNgJQ0T7R7oNaqBPzoRq/FPVvR02T8j9jdYTHDObyh646ZRqh/BziKM28KYSw+o5i BcYTenb2i3Q5wRZlIGpfLHG3CMVbX+DqXaI1/ENPXm4x8uVwGY7+4vNs66ZvjDVw8= X-Received: by 2002:a05:600c:1393:b0:493:bb0:3b43 with SMTP id 5b1f17b1804b1-4980c66c7cemr142263745e9.2.1785686402774; Sun, 02 Aug 2026 09:00:02 -0700 (PDT) Received: from [192.168.0.50] ([89.149.120.180]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49808199a5csm208487645e9.4.2026.08.02.09.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Aug 2026 09:00:02 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------AQMcljxZbrEc3KyObRPpLjI1" Message-ID: <294c42ea-2608-4bae-93de-6c1ba5f72107@gmail.com> Date: Sun, 2 Aug 2026 19:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: walsummarizer can get stuck when switching timelines To: Robert Haas , "Zhijie Hou (Fujitsu)" Cc: Amit Kapila , "pgsql-hackers@postgresql.org" , Andrey Borodin References: <820AC023-9025-43A4-ABDD-F6FB96C53C56@yandex-team.ru> Content-Language: en-US From: Alexander Lakhin In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------AQMcljxZbrEc3KyObRPpLjI1 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hello Robert, 31.07.2026 19:55, Robert Haas wrote: > It took me way longer than I was hoping to find the time to get this > committed and back-patched, but I have now done so. The test case > required some adjustments for v17 and v18. Buildfarm animal sidewinder managed to fail the new test 003_tli_switch.pl, [1]: ### Promoting node "node2" # Running: pg_ctl --pgdata /home/pgbf/buildroot/REL_19_STABLE/pgsql.build/src/bin/pg_walsummary/tmp_check/t_003_tli_switch_node2_data/pgdata --log /home/pgbf/buildroot/REL_19_STABLE/pgsql.build/src/bin/pg_walsummary/tmp_check/log/003_tli_switch_node2.log promote waiting for server to promote.... done server promoted ### Reloading node "node3" # Running: pg_ctl --pgdata /home/pgbf/buildroot/REL_19_STABLE/pgsql.build/src/bin/pg_walsummary/tmp_check/t_003_tli_switch_node3_data/pgdata reload server signaled [23:03:08.443](215.681s) # poll_query_until timed out executing this query: # SELECT EXISTS (SELECT * FROM pg_available_wal_summaries() WHERE tli = 2) # # expecting this output: # t # last actual query output: # f # with stderr: [23:03:08.444](0.001s) not ok 1 - WAL summarization on node3 advanced past timeline switch [23:03:08.445](0.001s) [23:03:08.445](0.000s) #   Failed test 'WAL summarization on node3 advanced past timeline switch' #   at t/003_tli_switch.pl line 113. 003_tli_switch_node3.log contains: 2026-08-01 22:59:41.862 CEST [25416:2] DEBUG:  switch point from TLI 1 to TLI 2 is at 0/0301DBE8 2026-08-01 22:59:41.864 CEST [25416:3] DEBUG:  summarized WAL on TLI 1 from 0/02000028 to 0/0301DBE8 2026-08-01 22:59:41.865 CEST [4231:1] [unknown] LOG:  connection received: host=[local] 2026-08-01 22:59:41.866 CEST [4231:2] [unknown] LOG:  connection authenticated: user="pgbf" method=trust (/home/pgbf/buildroot/REL_19_STABLE/pgsql.build/src/bin/pg_walsummary/tmp_check/t_003_tli_switch_node3_data/pgdata/pg_hba.conf:117) 2026-08-01 22:59:41.866 CEST [4231:3] [unknown] LOG:  connection authorized: user=pgbf database=postgres application_name=003_tli_switch.pl cp: /home/pgbf/buildroot/REL_19_STABLE/pgsql.build/src/bin/pg_walsummary/tmp_check/t_003_tli_switch_node2_data/archives/00000003.history: No such file or directory 2026-08-01 22:59:41.867 CEST [22705:14] LOG:  waiting for WAL to become available at 0/04000018 2026-08-01 22:59:41.867 CEST [4231:4] 003_tli_switch.pl LOG: statement: SELECT EXISTS (SELECT * FROM pg_available_wal_summaries() WHERE tli = 2) ... 2026-08-01 23:03:08.336 CEST [222:4] 003_tli_switch.pl LOG: statement: SELECT EXISTS (SELECT * FROM pg_available_wal_summaries() WHERE tli = 2) 2026-08-01 23:03:08.338 CEST [222:5] 003_tli_switch.pl LOG: disconnection: session time: 0:00:00.006 user=pgbf database=postgres host=[local] cp: /home/pgbf/buildroot/REL_19_STABLE/pgsql.build/src/bin/pg_walsummary/tmp_check/t_003_tli_switch_node2_data/archives/000000020000000000000004: No such file or directory cp: /home/pgbf/buildroot/REL_19_STABLE/pgsql.build/src/bin/pg_walsummary/tmp_check/t_003_tli_switch_node2_data/archives/00000003.history: No such file or directory 2026-08-01 23:03:08.407 CEST [22705:419] LOG:  waiting for WAL to become available at 0/04000018 003_tli_switch_node2.log: 2026-08-01 22:59:41.062 CEST [11464:4] 003_tli_switch.pl LOG: statement: SELECT pg_switch_wal(); 2026-08-01 22:59:41.129 CEST [18094:4] LOG:  database system is ready to accept connections 2026-08-01 22:59:41.204 CEST [14948:1] LOG:  checkpoint starting: force 2026-08-01 22:59:41.205 CEST [11464:5] 003_tli_switch.pl LOG: statement: CHECKPOINT; 2026-08-01 22:59:41.426 CEST [14948:2] LOG:  checkpoint complete: force: wrote 21 buffers (16.4%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.043 s, sync=0.001 s, total=0.302 s; sync files=0, longest=0.000 s, average=0.000 s; distance=32768 kB, estimate=32768 kB; lsn=0/04000088, redo lsn=0/04000028 2026-08-01 22:59:41.426 CEST [14948:3] LOG:  checkpoint starting: fast force wait 2026-08-01 22:59:41.434 CEST [14948:4] LOG:  checkpoint complete: fast force wait: wrote 0 buffers (0.0%), wrote 0 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.001 s, sync=0.001 s, total=0.009 s; sync files=0, longest=0.000 s, average=0.000 s; distance=0 kB, estimate=29491 kB; lsn=0/04000168, redo lsn=0/04000108 2026-08-01 22:59:41.471 CEST [11464:6] 003_tli_switch.pl LOG: disconnection: session time: 0:00:00.411 user=pgbf database=postgres host=[local] (both redo_lsn belong to segment 4) vs the previous successful run [2]: 003_tli_switch_node2.log 2026-08-01 00:55:39.071 CEST [965:4] 003_tli_switch.pl LOG: statement: SELECT pg_switch_wal(); 2026-08-01 00:55:39.241 CEST [965:5] 003_tli_switch.pl LOG: statement: CHECKPOINT; 2026-08-01 00:55:39.727 CEST [15172:2] LOG:  checkpoint complete: force: wrote 21 buffers (16.4%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.318 s, sync=0.001 s, total=0.813 s; sync files=0, longest=0.000 s, average=0.000 s; distance=16502 kB, estimate=16502 kB; lsn=0/04000060, redo lsn=0/0301DC20 2026-08-01 00:55:39.727 CEST [15172:3] LOG:  checkpoint starting: fast force wait 2026-08-01 00:55:39.747 CEST [15172:4] LOG:  checkpoint complete: fast force wait: wrote 0 buffers (0.0%), wrote 0 SLRU buffers; 0 WAL file(s) added, 0 removed, 1 recycled; write=0.001 s, sync=0.001 s, total=0.020 s; sync files=0, longest=0.000 s, average=0.000 s; distance=16265 kB, estimate=16479 kB; lsn=0/04000140, redo lsn=0/040000E0 (the first redo_lsn belongs to segment 3) So it looks like the test might fail when the checkpoint record slips into segment 4. I've reproduced the failure with: --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7448,2 +7448,3 @@ CreateCheckPoint(int flags)         INJECTION_POINT_LOAD("create-checkpoint-run"); +pg_usleep(1000000); PROVE_TESTS="t/003*" make -s check -C src/bin/pg_walsummary/ # +++ tap check in src/bin/pg_walsummary +++ t/003_tli_switch.pl .. # poll_query_until timed out executing this query: # SELECT EXISTS (SELECT * FROM pg_available_wal_summaries() WHERE tli = 2) # # expecting this output: # t # last actual query output: # f # with stderr: t/003_tli_switch.pl .. 1/? #   Failed test 'WAL summarization on node3 advanced past timeline switch' #   at t/003_tli_switch.pl line 113. Could you please have a look? [1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=sidewinder&dt=2026-08-01%2020%3A35%3A00 [2] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=sidewinder&dt=2026-07-31%2022%3A35%3A00 Best regards, Alexander --------------AQMcljxZbrEc3KyObRPpLjI1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
Hello Robert,

31.07.2026 19:55, Robert Haas wrote:
It took me way longer than I was hoping to find the time to get this
committed and back-patched, but I have now done so. The test case
required some adjustments for v17 and v18.

Buildfarm animal sidewinder managed to fail the new test 003_tli_switch.pl,
[1]:
### Promoting node "node2"
# Running: pg_ctl --pgdata /home/pgbf/buildroot/REL_19_STABLE/pgsql.build/src/bin/pg_walsummary/tmp_check/t_003_tli_switch_node2_data/pgdata --log /home/pgbf/buildroot/REL_19_STABLE/pgsql.build/src/bin/pg_walsummary/tmp_check/log/003_tli_switch_node2.log promote
waiting for server to promote.... done
server promoted
### Reloading node "node3"
# Running: pg_ctl --pgdata /home/pgbf/buildroot/REL_19_STABLE/pgsql.build/src/bin/pg_walsummary/tmp_check/t_003_tli_switch_node3_data/pgdata reload
server signaled
[23:03:08.443](215.681s) # poll_query_until timed out executing this query:
# SELECT EXISTS (SELECT * FROM pg_available_wal_summaries() WHERE tli = 2)
#
# expecting this output:
# t
# last actual query output:
# f
# with stderr:
[23:03:08.444](0.001s) not ok 1 - WAL summarization on node3 advanced past timeline switch
[23:03:08.445](0.001s)
[23:03:08.445](0.000s) #   Failed test 'WAL summarization on node3 advanced past timeline switch'
#   at t/003_tli_switch.pl line 113.

003_tli_switch_node3.log contains:
2026-08-01 22:59:41.862 CEST [25416:2] DEBUG:  switch point from TLI 1 to TLI 2 is at 0/0301DBE8
2026-08-01 22:59:41.864 CEST [25416:3] DEBUG:  summarized WAL on TLI 1 from 0/02000028 to 0/0301DBE8
2026-08-01 22:59:41.865 CEST [4231:1] [unknown] LOG:  connection received: host=[local]
2026-08-01 22:59:41.866 CEST [4231:2] [unknown] LOG:  connection authenticated: user="pgbf" method=trust (/home/pgbf/buildroot/REL_19_STABLE/pgsql.build/src/bin/pg_walsummary/tmp_check/t_003_tli_switch_node3_data/pgdata/pg_hba.conf:117)
2026-08-01 22:59:41.866 CEST [4231:3] [unknown] LOG:  connection authorized: user=pgbf database=postgres application_name=003_tli_switch.pl
cp: /home/pgbf/buildroot/REL_19_STABLE/pgsql.build/src/bin/pg_walsummary/tmp_check/t_003_tli_switch_node2_data/archives/00000003.history: No such file or directory
2026-08-01 22:59:41.867 CEST [22705:14] LOG:  waiting for WAL to become available at 0/04000018
2026-08-01 22:59:41.867 CEST [4231:4] 003_tli_switch.pl LOG:  statement: SELECT EXISTS (SELECT * FROM pg_available_wal_summaries() WHERE tli = 2)
...
2026-08-01 23:03:08.336 CEST [222:4] 003_tli_switch.pl LOG:  statement: SELECT EXISTS (SELECT * FROM pg_available_wal_summaries() WHERE tli = 2)
2026-08-01 23:03:08.338 CEST [222:5] 003_tli_switch.pl LOG:  disconnection: session time: 0:00:00.006 user=pgbf database=postgres host=[local]
cp: /home/pgbf/buildroot/REL_19_STABLE/pgsql.build/src/bin/pg_walsummary/tmp_check/t_003_tli_switch_node2_data/archives/000000020000000000000004: No such file or directory
cp: /home/pgbf/buildroot/REL_19_STABLE/pgsql.build/src/bin/pg_walsummary/tmp_check/t_003_tli_switch_node2_data/archives/00000003.history: No such file or directory
2026-08-01 23:03:08.407 CEST [22705:419] LOG:  waiting for WAL to become available at 0/04000018

003_tli_switch_node2.log:
2026-08-01 22:59:41.062 CEST [11464:4] 003_tli_switch.pl LOG:  statement: SELECT pg_switch_wal();
2026-08-01 22:59:41.129 CEST [18094:4] LOG:  database system is ready to accept connections
2026-08-01 22:59:41.204 CEST [14948:1] LOG:  checkpoint starting: force
2026-08-01 22:59:41.205 CEST [11464:5] 003_tli_switch.pl LOG:  statement: CHECKPOINT;
2026-08-01 22:59:41.426 CEST [14948:2] LOG:  checkpoint complete: force: wrote 21 buffers (16.4%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.043 s, sync=0.001 s, total=0.302 s; sync files=0, longest=0.000 s, average=0.000 s; distance=32768 kB, estimate=32768 kB; lsn=0/04000088, redo lsn=0/04000028
2026-08-01 22:59:41.426 CEST [14948:3] LOG:  checkpoint starting: fast force wait
2026-08-01 22:59:41.434 CEST [14948:4] LOG:  checkpoint complete: fast force wait: wrote 0 buffers (0.0%), wrote 0 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.001 s, sync=0.001 s, total=0.009 s; sync files=0, longest=0.000 s, average=0.000 s; distance=0 kB, estimate=29491 kB; lsn=0/04000168, redo lsn=0/04000108
2026-08-01 22:59:41.471 CEST [11464:6] 003_tli_switch.pl LOG:  disconnection: session time: 0:00:00.411 user=pgbf database=postgres host=[local]
(both redo_lsn belong to segment 4)

vs the previous successful run [2]:
003_tli_switch_node2.log
2026-08-01 00:55:39.071 CEST [965:4] 003_tli_switch.pl LOG:  statement: SELECT pg_switch_wal();
2026-08-01 00:55:39.241 CEST [965:5] 003_tli_switch.pl LOG:  statement: CHECKPOINT;
2026-08-01 00:55:39.727 CEST [15172:2] LOG:  checkpoint complete: force: wrote 21 buffers (16.4%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.318 s, sync=0.001 s, total=0.813 s; sync files=0, longest=0.000 s, average=0.000 s; distance=16502 kB, estimate=16502 kB; lsn=0/04000060, redo lsn=0/0301DC20
2026-08-01 00:55:39.727 CEST [15172:3] LOG:  checkpoint starting: fast force wait
2026-08-01 00:55:39.747 CEST [15172:4] LOG:  checkpoint complete: fast force wait: wrote 0 buffers (0.0%), wrote 0 SLRU buffers; 0 WAL file(s) added, 0 removed, 1 recycled; write=0.001 s, sync=0.001 s, total=0.020 s; sync files=0, longest=0.000 s, average=0.000 s; distance=16265 kB, estimate=16479 kB; lsn=0/04000140, redo lsn=0/040000E0
(the first redo_lsn belongs to segment 3)

So it looks like the test might fail when the checkpoint record slips into
segment 4. I've reproduced the failure with:
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7448,2 +7448,3 @@ CreateCheckPoint(int flags)
        INJECTION_POINT_LOAD("create-checkpoint-run");
+pg_usleep(1000000);

PROVE_TESTS="t/003*" make -s check -C src/bin/pg_walsummary/

# +++ tap check in src/bin/pg_walsummary +++
t/003_tli_switch.pl .. # poll_query_until timed out executing this query:
# SELECT EXISTS (SELECT * FROM pg_available_wal_summaries() WHERE tli = 2)
#
# expecting this output:
# t
# last actual query output:
# f
# with stderr:
t/003_tli_switch.pl .. 1/?
#   Failed test 'WAL summarization on node3 advanced past timeline switch'
#   at t/003_tli_switch.pl line 113.

Could you please have a look?
 
[1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=sidewinder&dt=2026-08-01%2020%3A35%3A00
[2] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=sidewinder&dt=2026-07-31%2022%3A35%3A00

Best regards,
Alexander
--------------AQMcljxZbrEc3KyObRPpLjI1--