| From: | Peter Geoghegan <pg(at)bowt(dot)ie> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix snapshot import xmin ProcArrayLock bug. |
| Date: | 2026-08-20 23:48:11 |
| Message-ID: | E1wxCUU-00000001QWS-0O0A@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix snapshot import xmin ProcArrayLock bug.
ProcArrayInstallImportedXmin verifies that the source transaction (the
transaction whose snapshot we're importing) is still running, and then
installs the caller's imported xmin. These steps have to be atomic.
But it was just about possible for VACUUM to fail to observe the
imported xmin in either the source proc or the importing one. This
could result in VACUUM pruning away deleted tuples that were still
visible to the imported snapshot.
To fix, take ProcArrayLock in exclusive mode while importing an exported
snapshot's xmin within ProcArrayInstallImportedXmin. That guarantees
that a concurrent VACUUM's OldestXmin cannot advance past the xmin (one
proc or the other always advertises an xmin that holds it back).
Author: Chee Wooson <chee(dot)wooson(at)gmail(dot)com>
Reviewed-by: Peter Geoghegan <pg(at)bowt(dot)ie>
Discussion: https://postgr.es/m/20260730042128.714201-1-chee.wooson@gmail.com
Backpatch-through: 14
Branch
------
REL_16_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/7a392b0f6530236b71f15c936ba3f813c0720897
Modified Files
--------------
src/backend/storage/ipc/procarray.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David Rowley | 2026-08-21 00:26:19 | pgsql: Attempt to stabilize plan of self-join test in tidscan.sql |
| Previous Message | Michael Paquier | 2026-08-20 23:33:33 | pgsql: ecpg: Add missing NULL check in ecpg_store_input() following OOM |