Re: t/035_standby_logical_decoding.pl might fail on attempt to read wrong timeline

Xuneng Zhou <xunengzhou@gmail.com>

From: Xuneng Zhou <xunengzhou@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>, Alexander Lakhin <exclusion@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2026-06-12T06:28:23Z
Lists: pgsql-hackers
On Fri, Jun 12, 2026 at 10:44 AM Michael Paquier <michael@paquier.xyz> wrote:
>
> On Fri, Jun 12, 2026 at 08:57:05AM +0800, Xuneng Zhou wrote:
> > On Thu, Jun 11, 2026 at 9:15 AM Michael Paquier <michael@paquier.xyz> wrote:
> >> read_local_xlog_page_guts() does not only impact SQL-callable logirep
> >> functions, even it is the spot that should be hit most of the time
> >> (again, the RecoveryInProgress() vs promotion window is super narrow).
> >> At quick glance, things are:
> >> - walinspect.
> >> - Slot advance.
> >> - Slot creation (?), but it feels even narrower.
> >
> > Yeah, it is used for two-phase commit as well. The usage of it is
> > broader than I observed before. Repack worker also make use of it.
>
> Repack workers cannot work on standbys, and for 2PC files we have the
> guarantee of a file on disk if the WAL is gone, so they should be
> basically irrelevant here.  That's why I did not mention them.  :)

Thanks for the clarification.

> Everything's now done.  I was pondering about v14 and v15 for a bit
> for the second patch regarding pg_walinspect (or slot operations), but
> I could not get excited about these branches.  pg_walinspect is less
> used, and slots have much more uses on standbys since v16~, so
> expanding that further down feels meh.

Making sense to me. This looks like a hard-to-hit issue on HEAD. The
likelihood of encountering it and the severity of damage caused by it
in those branches are expected to be even smaller.

-- 
Regards,
Xuneng Zhou
HighGo Software Co., Ltd.



Commits

  1. Fix second race with timeline selection during promotion

  2. Remove TAP test for timeline lookup race with logical decoding on standbys

  3. Fix race with timeline selection in logical decoding during promotion

  4. Backport GetWALInsertionTimeLineIfSet()

  5. TAP test for logical decoding on standby