pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedFrom: Peter Geoghegan <pg@bowt.ie>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Export subxip[] for snapshots taken during recovery.
Date: Wed, 26 Aug 2026 19:38:33 +0000
Message-ID: <E1wzJSC-00000002EYy-2Dpc@gemulon.postgresql.org> (raw)
Export subxip[] for snapshots taken during recovery.
A snapshot taken during recovery stores all of its in-progress XIDs in
subxip, every running top-level XID included, leaving xip empty. Unlike
with other snapshots, its suboverflowed flag does not mean that subxip
is redundant. We nevertheless treated it that way during snapshot
export, so an importing session could see in-progress transactions as
aborted. This misbehavior could also lead to hint bits being
incorrectly set on the standby; affected tuples then wrongly appeared
visible or invisible to sessions that never imported the snapshot.
To fix, teach snapshot export to include the subxip[] array regardless
of the overflow flag when the snapshot is taken during recovery. This
is in line with how CopySnapshot() and SerializeSnapshot() already
handle the same issue.
Claude Code diagnosed this problem. The committed TAP test is a
simplified version of the one that it wrote to demonstrate this bug.
Oversight in commit 6c2003f8a, which enabled snapshot export and import
during recovery.
Author: Peter Geoghegan <pg@bowt.ie>
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Bug: #17846
Discussion: https://postgr.es/m/CAH2-WzmHVeYY%3Dpjz9x8DhhxVjXHX0pvoQ-MdiB1Tt6%3Do2GTiKg%40mail.gmail.com
Discussion: https://postgr.es/m/17846-1a0e5ce976f4c01a@postgresql.org
Backpatch-through: 14
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/79b101486c1d792600b79f90579b788385e85878
Modified Files
--------------
src/backend/utils/time/snapmgr.c | 58 ++++++++----
src/test/recovery/meson.build | 1 +
src/test/recovery/t/056_standby_snapshot_export.pl | 104 +++++++++++++++++++++
3 files changed, 147 insertions(+), 16 deletions(-)
view thread (7+ messages) latest in thread
Message-ID: <E1wzJSC-00000002EYy-2Dpc@gemulon.postgresql.org>
Permalink: ../E1wzJSC-00000002EYy-2Dpc@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1wzJSC-00000002EYy-2Dpc@gemulon.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: pg@bowt.ie, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Export subxip[] for snapshots taken during recovery.
In-Reply-To: <E1wzJSC-00000002EYy-2Dpc@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox