pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Export subxip[] for snapshots taken during recovery.
7+ messages / 1 participants
[nested] [flat]

* pgsql: Export subxip[] for snapshots taken during recovery.
@ 2026-08-26 19:38 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 7+ messages in thread

From: Peter Geoghegan @ 2026-08-26 19:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Export subxip[] for snapshots taken during recovery.
@ 2026-08-26 19:38 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 7+ messages in thread

From: Peter Geoghegan @ 2026-08-26 19:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_19_STABLE

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

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(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Export subxip[] for snapshots taken during recovery.
@ 2026-08-26 19:38 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 7+ messages in thread

From: Peter Geoghegan @ 2026-08-26 19:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/74c9832ca61037eec25b8f214fc71883494900d8

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(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Export subxip[] for snapshots taken during recovery.
@ 2026-08-26 19:38 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 7+ messages in thread

From: Peter Geoghegan @ 2026-08-26 19:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2ae67ada74d9e8407e4286414dfddf5d157f4dc3

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(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Export subxip[] for snapshots taken during recovery.
@ 2026-08-26 19:38 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 7+ messages in thread

From: Peter Geoghegan @ 2026-08-26 19:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_16_STABLE

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

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(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Export subxip[] for snapshots taken during recovery.
@ 2026-08-26 19:38 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 7+ messages in thread

From: Peter Geoghegan @ 2026-08-26 19:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_15_STABLE

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

Modified Files
--------------
src/backend/utils/time/snapmgr.c                   |  58 ++++++++----
src/test/recovery/t/056_standby_snapshot_export.pl | 104 +++++++++++++++++++++
2 files changed, 146 insertions(+), 16 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Export subxip[] for snapshots taken during recovery.
@ 2026-08-26 19:38 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 7+ messages in thread

From: Peter Geoghegan @ 2026-08-26 19:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9a1fa1f36e48394bb205eaf66cc33c18a6fe1bff

Modified Files
--------------
src/backend/utils/time/snapmgr.c                   |  58 ++++++++----
src/test/recovery/t/056_standby_snapshot_export.pl | 104 +++++++++++++++++++++
2 files changed, 146 insertions(+), 16 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2026-08-26 19:38 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-08-26 19:38 pgsql: Export subxip[] for snapshots taken during recovery. Peter Geoghegan <pg@bowt.ie>
2026-08-26 19:38 pgsql: Export subxip[] for snapshots taken during recovery. Peter Geoghegan <pg@bowt.ie>
2026-08-26 19:38 pgsql: Export subxip[] for snapshots taken during recovery. Peter Geoghegan <pg@bowt.ie>
2026-08-26 19:38 pgsql: Export subxip[] for snapshots taken during recovery. Peter Geoghegan <pg@bowt.ie>
2026-08-26 19:38 pgsql: Export subxip[] for snapshots taken during recovery. Peter Geoghegan <pg@bowt.ie>
2026-08-26 19:38 pgsql: Export subxip[] for snapshots taken during recovery. Peter Geoghegan <pg@bowt.ie>
2026-08-26 19:38 pgsql: Export subxip[] for snapshots taken during recovery. Peter Geoghegan <pg@bowt.ie>

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