pgsql: Prevent walsummarizer from getting stuck at a timeline switch.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Prevent walsummarizer from getting stuck at a timeline switch.
Date: 2026-07-31 15:57:54
Message-ID: E1wppcQ-000000017Bb-1Eer@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Prevent walsummarizer from getting stuck at a timeline switch.

As previously coded, walsummarizer only wants to read WAL from a file
where the TimeLineID in the filename exactly matches the TimeLineID being
summarized. But in some cases, when a timeline switch occurs, the WAL file
from the old timeline is not archived, because it's never completely
filled, so the only way to obtain the contents of that last partial
segment is to read from the first segment on the new timeline. Teach
WAL summarizer to do that, and add a test case to make sure that it
works.

Reported-by: Nick Ivanov <nick(dot)ivanov(at)enterprisedb(dot)com>
Reviewed-by: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Tested-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com>
Reviewed-by: Zhijie Hou <houzj(dot)fnst(at)fujitsu(dot)com>
Reviewed-by: Thom Brown <thom(at)linux(dot)com>
Discussion: http://postgr.es/m/CA+Tgmobr27GpKDZx3_ezW2+C5_g18i+jSK3sGF_cR-_ESv5N5A@mail.gmail.com
Backpatch-through: 17

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/dfb96277d7ba01d3bcb70a64b7835182ae419022

Modified Files
--------------
src/backend/postmaster/walsummarizer.c | 173 +++++++++++++++++++++++++++---
src/bin/pg_walsummary/meson.build | 1 +
src/bin/pg_walsummary/t/003_tli_switch.pl | 146 +++++++++++++++++++++++++
3 files changed, 306 insertions(+), 14 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Jacob Champion 2026-07-31 18:27:10 pgsql: libpq-oauth: Avoid overflow for very large intervals
Previous Message Nathan Bossart 2026-07-31 15:35:59 pgsql: Fix autovacuum's database sorting.