Re: pg_rewind and hint bits leads to visibility corruption

From: Sebastian Webber <sebastian(at)swebber(dot)me>
To: Tom Pang <tom(at)planetscale(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: pg_rewind and hint bits leads to visibility corruption
Date: 2026-10-28 20:57:20
Message-ID: CACV2tSziPHevWK3scZK6wV_33_JhWNefSveC3cR33p+x-bpnVg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Tom,

On Wed, Oct 28, 2026 at 11:47 AM Tom Pang <tom(at)planetscale(dot)com> wrote:
> I've reproduced this against main, as well as 18.6.

Your test reproduces it on every supported branch too: 19rc1, 18, 17,
16, 15 and 14. On each one, tests 3 and 4 fail the same way as on
master. S2 still has HEAP_XMIN_INVALID after the rewind and returns 0
rows for id = 999999, while S1 returns 1.

On 14 to 18 the test needed two changes:

- The last wait_for_replay_catchup($node_s2) times out. The TAP
framework sets PGAPPNAME to the script name, and
--write-recovery-conf keeps it in primary_conninfo. So S2 streams as
"012_standby_hint_bits.pl", and the query on pg_stat_replication
never finds "node_s2". On master and 19 the helper uses WAIT FOR LSN
on the standby instead (7e8aeb9e483), so the name does not matter.
I replaced the wait with a poll on pg_last_wal_replay_lsn() on S2.
With that change master still fails the same way.
- 14 and 15 have no wait_for_replay_catchup, so I used
wait_for_catchup($node, 'replay'). I also dropped the meson.build
hunk, since those trees were built with autoconf.

I can send the adjusted test if it helps.

Builds: REL_19_RC1 (0b8bff042a), REL_18_STABLE (e4807a0f3f),
REL_17_STABLE (b3852eec68), REL_16_STABLE (17c5a0659f), REL_15_STABLE
(cb51daa27d), REL_14_STABLE (9a56e080f1) with autoconf, and master
(4848fd6752) with meson. Debian trixie, the Debian packages' build
dependencies and configure options (without LLVM), plus assertions.
I tested the branch heads, not released minor versions.

I used Claude Opus 5.5 (reasoning medium) to run the builds and tests
and to read the results, and Codex gpt-6.1-sol (reasoning high) to
review the test changes against the source.

Regards,
Sebastian

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message David Geier 2026-10-28 19:19:59 Re: crash in ltree_compare_distance() in 14.24