walsummarizer can get stuck when switching timelines

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: walsummarizer can get stuck when switching timelines
Date: 2026-07-13 20:39:16
Message-ID: CA+Tgmobr27GpKDZx3_ezW2+C5_g18i+jSK3sGF_cR-_ESv5N5A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

My colleague, Nick Ivanov, reported to me that it's possible for WAL
summarizer to get stuck when a timeline switch occurs. As far as I can
tell, for this to happen, all of the following things need to be true:

1. There must be a standby that is summarizing WAL.
2. That standby must see a timeline change due to some other server
(not itself) being promoted.
3. That standby must be retrieving WAL via archiving, not streaming.
4. The WAL file that contains the switchpoint must be archived on the
new timeline, but not the original one.

The reason this case is a problem is that the WAL summarizer is coded
to only read WAL from a file where the TLI in the filename matches the
TLI of the WAL sought. But in this scenario, the partial segment at
the end of the old timeline is only available from the beginning of
the first file archived on the new timeline, so WAL summarization
cannot progress to, or beyond, the TLI switch.

Here is a patch, with a test case.

--
Robert Haas
EDB: http://www.enterprisedb.com

Attachment Content-Type Size
v1-0001-Prevent-walsummarizer-from-getting-stuck-at-a-tim.patch application/octet-stream 16.5 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Burd 2026-07-13 21:06:49 Re: Tepid: selective index updates for heap relations
Previous Message Tristan Partin 2026-07-13 20:38:17 Re: Grab bag of smaller OpenSSL fixups