pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix bug in following update chain when locking a heap tuple
6+ messages / 1 participants
[nested] [flat]

* pgsql: Fix bug in following update chain when locking a heap tuple
@ 2025-12-23 12:07  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 6+ messages in thread

From: Heikki Linnakangas @ 2025-12-23 12:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix bug in following update chain when locking a heap tuple

After waiting for a concurrent updater to finish, heap_lock_tuple()
followed the update chain to lock all tuple versions. However, when
stepping from the initial tuple to the next one, it failed to check
that the next tuple's XMIN matches the initial tuple's XMAX. That's an
important check whenever following an update chain, and the recursive
part that follows the chain did it, but the initial step missed it.
Without the check, if the updating transaction aborts, the updated
tuple is vacuumed away and replaced by an unrelated tuple, the
unrelated tuple might get incorrectly locked.

Author: Jasper Smit <jasper.smit@servicenow.com>
Discussion: https://www.postgresql.org/message-id/CAOG+RQ74x0q=kgBBQ=mezuvOeZBfSxM1qu_o0V28bwDz3dHxLw@mail.gmail...
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7efef18ffc14af2399bce34d40850b410dd1fe8d

Modified Files
--------------
src/backend/access/heap/heapam.c | 46 +++++++++++++++++++++++++++-------------
1 file changed, 31 insertions(+), 15 deletions(-)



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

* pgsql: Fix bug in following update chain when locking a heap tuple
@ 2025-12-23 12:07  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 6+ messages in thread

From: Heikki Linnakangas @ 2025-12-23 12:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix bug in following update chain when locking a heap tuple

After waiting for a concurrent updater to finish, heap_lock_tuple()
followed the update chain to lock all tuple versions. However, when
stepping from the initial tuple to the next one, it failed to check
that the next tuple's XMIN matches the initial tuple's XMAX. That's an
important check whenever following an update chain, and the recursive
part that follows the chain did it, but the initial step missed it.
Without the check, if the updating transaction aborts, the updated
tuple is vacuumed away and replaced by an unrelated tuple, the
unrelated tuple might get incorrectly locked.

Author: Jasper Smit <jasper.smit@servicenow.com>
Discussion: https://www.postgresql.org/message-id/CAOG+RQ74x0q=kgBBQ=mezuvOeZBfSxM1qu_o0V28bwDz3dHxLw@mail.gmail...
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5d5487cd256f1865f6364a7e787eb5fcde6ae1b9

Modified Files
--------------
src/backend/access/heap/heapam.c | 46 +++++++++++++++++++++++++++-------------
1 file changed, 31 insertions(+), 15 deletions(-)



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

* pgsql: Fix bug in following update chain when locking a heap tuple
@ 2025-12-23 12:07  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 6+ messages in thread

From: Heikki Linnakangas @ 2025-12-23 12:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix bug in following update chain when locking a heap tuple

After waiting for a concurrent updater to finish, heap_lock_tuple()
followed the update chain to lock all tuple versions. However, when
stepping from the initial tuple to the next one, it failed to check
that the next tuple's XMIN matches the initial tuple's XMAX. That's an
important check whenever following an update chain, and the recursive
part that follows the chain did it, but the initial step missed it.
Without the check, if the updating transaction aborts, the updated
tuple is vacuumed away and replaced by an unrelated tuple, the
unrelated tuple might get incorrectly locked.

Author: Jasper Smit <jasper.smit@servicenow.com>
Discussion: https://www.postgresql.org/message-id/CAOG+RQ74x0q=kgBBQ=mezuvOeZBfSxM1qu_o0V28bwDz3dHxLw@mail.gmail...
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3e3a80f62c09709de899cc7649f1c86c63b78981

Modified Files
--------------
src/backend/access/heap/heapam.c                   |  48 ++++++---
src/test/modules/injection_points/Makefile         |   5 +-
.../injection_points/expected/heap_lock_update.out |  83 +++++++++++++++
src/test/modules/injection_points/meson.build      |   1 +
.../injection_points/specs/heap_lock_update.spec   | 117 +++++++++++++++++++++
5 files changed, 238 insertions(+), 16 deletions(-)



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

* pgsql: Fix bug in following update chain when locking a heap tuple
@ 2025-12-23 12:07  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 6+ messages in thread

From: Heikki Linnakangas @ 2025-12-23 12:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix bug in following update chain when locking a heap tuple

After waiting for a concurrent updater to finish, heap_lock_tuple()
followed the update chain to lock all tuple versions. However, when
stepping from the initial tuple to the next one, it failed to check
that the next tuple's XMIN matches the initial tuple's XMAX. That's an
important check whenever following an update chain, and the recursive
part that follows the chain did it, but the initial step missed it.
Without the check, if the updating transaction aborts, the updated
tuple is vacuumed away and replaced by an unrelated tuple, the
unrelated tuple might get incorrectly locked.

Author: Jasper Smit <jasper.smit@servicenow.com>
Discussion: https://www.postgresql.org/message-id/CAOG+RQ74x0q=kgBBQ=mezuvOeZBfSxM1qu_o0V28bwDz3dHxLw@mail.gmail...
Backpatch-through: 14

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/backend/access/heap/heapam.c | 46 +++++++++++++++++++++++++++-------------
1 file changed, 31 insertions(+), 15 deletions(-)



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

* pgsql: Fix bug in following update chain when locking a heap tuple
@ 2025-12-23 12:07  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 6+ messages in thread

From: Heikki Linnakangas @ 2025-12-23 12:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix bug in following update chain when locking a heap tuple

After waiting for a concurrent updater to finish, heap_lock_tuple()
followed the update chain to lock all tuple versions. However, when
stepping from the initial tuple to the next one, it failed to check
that the next tuple's XMIN matches the initial tuple's XMAX. That's an
important check whenever following an update chain, and the recursive
part that follows the chain did it, but the initial step missed it.
Without the check, if the updating transaction aborts, the updated
tuple is vacuumed away and replaced by an unrelated tuple, the
unrelated tuple might get incorrectly locked.

Author: Jasper Smit <jasper.smit@servicenow.com>
Discussion: https://www.postgresql.org/message-id/CAOG+RQ74x0q=kgBBQ=mezuvOeZBfSxM1qu_o0V28bwDz3dHxLw@mail.gmail...
Backpatch-through: 14

Branch
------
REL_17_STABLE

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

Modified Files
--------------
src/backend/access/heap/heapam.c                   |  48 ++++++---
src/test/modules/injection_points/Makefile         |   4 +-
.../injection_points/expected/heap_lock_update.out |  83 +++++++++++++++
src/test/modules/injection_points/meson.build      |   1 +
.../injection_points/specs/heap_lock_update.spec   | 117 +++++++++++++++++++++
5 files changed, 237 insertions(+), 16 deletions(-)



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

* pgsql: Fix bug in following update chain when locking a heap tuple
@ 2025-12-23 12:07  Heikki Linnakangas <heikki.linnakangas@iki.fi>
  0 siblings, 0 replies; 6+ messages in thread

From: Heikki Linnakangas @ 2025-12-23 12:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix bug in following update chain when locking a heap tuple

After waiting for a concurrent updater to finish, heap_lock_tuple()
followed the update chain to lock all tuple versions. However, when
stepping from the initial tuple to the next one, it failed to check
that the next tuple's XMIN matches the initial tuple's XMAX. That's an
important check whenever following an update chain, and the recursive
part that follows the chain did it, but the initial step missed it.
Without the check, if the updating transaction aborts, the updated
tuple is vacuumed away and replaced by an unrelated tuple, the
unrelated tuple might get incorrectly locked.

Author: Jasper Smit <jasper.smit@servicenow.com>
Discussion: https://www.postgresql.org/message-id/CAOG+RQ74x0q=kgBBQ=mezuvOeZBfSxM1qu_o0V28bwDz3dHxLw@mail.gmail...
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/955f5506863dce0a3416e3fae7c3297dbbaa946d

Modified Files
--------------
src/backend/access/heap/heapam.c                   |  48 ++++++---
src/test/modules/injection_points/Makefile         |   3 +-
.../injection_points/expected/heap_lock_update.out |  83 +++++++++++++++
src/test/modules/injection_points/meson.build      |   1 +
.../injection_points/specs/heap_lock_update.spec   | 117 +++++++++++++++++++++
5 files changed, 236 insertions(+), 16 deletions(-)



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


end of thread, other threads:[~2025-12-23 12:07 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-12-23 12:07 pgsql: Fix bug in following update chain when locking a heap tuple Heikki Linnakangas <heikki.linnakangas@iki.fi>
2025-12-23 12:07 pgsql: Fix bug in following update chain when locking a heap tuple Heikki Linnakangas <heikki.linnakangas@iki.fi>
2025-12-23 12:07 pgsql: Fix bug in following update chain when locking a heap tuple Heikki Linnakangas <heikki.linnakangas@iki.fi>
2025-12-23 12:07 pgsql: Fix bug in following update chain when locking a heap tuple Heikki Linnakangas <heikki.linnakangas@iki.fi>
2025-12-23 12:07 pgsql: Fix bug in following update chain when locking a heap tuple Heikki Linnakangas <heikki.linnakangas@iki.fi>
2025-12-23 12:07 pgsql: Fix bug in following update chain when locking a heap tuple Heikki Linnakangas <heikki.linnakangas@iki.fi>

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