pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: For inplace update durability, make heap_update() callers wait. 7+ messages / 1 participants [nested] [flat]
* pgsql: For inplace update durability, make heap_update() callers wait. @ 2024-09-24 22:27 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 7+ messages in thread From: Noah Misch @ 2024-09-24 22:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org For inplace update durability, make heap_update() callers wait. The previous commit fixed some ways of losing an inplace update. It remained possible to lose one when a backend working toward a heap_update() copied a tuple into memory just before inplace update of that tuple. In catalogs eligible for inplace update, use LOCKTAG_TUPLE to govern admission to the steps of copying an old tuple, modifying it, and issuing heap_update(). This includes MERGE commands. To avoid changing most of the pg_class DDL, don't require LOCKTAG_TUPLE when holding a relation lock sufficient to exclude inplace updaters. Back-patch to v12 (all supported versions). In v13 and v12, "UPDATE pg_class" or "UPDATE pg_database" can still lose an inplace update. The v14+ UPDATE fix needs commit 86dc90056dfdbd9d1b891718d2e5614e3e432f35, and it wasn't worth reimplementing that fix without such infrastructure. Reviewed by Nitin Motiani and (in earlier versions) Heikki Linnakangas. Discussion: https://postgr.es/m/20231027214946.79.nmisch@google.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/aac2c9b4fde889d13f859c233c2523345e72d32b Modified Files -------------- src/backend/access/heap/README.tuplock | 42 ++++++ src/backend/access/heap/heapam.c | 150 ++++++++++++++++++++- src/backend/access/index/genam.c | 4 +- src/backend/catalog/aclchk.c | 9 +- src/backend/catalog/catalog.c | 9 ++ src/backend/commands/dbcommands.c | 25 +++- src/backend/commands/event_trigger.c | 7 +- src/backend/commands/indexcmds.c | 7 +- src/backend/commands/tablecmds.c | 28 +++- src/backend/executor/execMain.c | 6 + src/backend/executor/execReplication.c | 6 +- src/backend/executor/nodeModifyTable.c | 98 +++++++++++--- src/backend/utils/cache/relcache.c | 9 +- src/backend/utils/cache/syscache.c | 117 ++++++++++++++++ src/include/nodes/execnodes.h | 3 + src/include/storage/lockdefs.h | 2 + src/include/utils/syscache.h | 5 + .../isolation/expected/intra-grant-inplace.out | 14 +- src/test/isolation/specs/eval-plan-qual.spec | 2 +- src/test/isolation/specs/intra-grant-inplace.spec | 12 +- 20 files changed, 498 insertions(+), 57 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: For inplace update durability, make heap_update() callers wait. @ 2024-09-24 22:27 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 7+ messages in thread From: Noah Misch @ 2024-09-24 22:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org For inplace update durability, make heap_update() callers wait. The previous commit fixed some ways of losing an inplace update. It remained possible to lose one when a backend working toward a heap_update() copied a tuple into memory just before inplace update of that tuple. In catalogs eligible for inplace update, use LOCKTAG_TUPLE to govern admission to the steps of copying an old tuple, modifying it, and issuing heap_update(). This includes MERGE commands. To avoid changing most of the pg_class DDL, don't require LOCKTAG_TUPLE when holding a relation lock sufficient to exclude inplace updaters. Back-patch to v12 (all supported versions). In v13 and v12, "UPDATE pg_class" or "UPDATE pg_database" can still lose an inplace update. The v14+ UPDATE fix needs commit 86dc90056dfdbd9d1b891718d2e5614e3e432f35, and it wasn't worth reimplementing that fix without such infrastructure. Reviewed by Nitin Motiani and (in earlier versions) Heikki Linnakangas. Discussion: https://postgr.es/m/20231027214946.79.nmisch@google.com Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/3b7a689e1a805c4dac2f35ff14fd5c9fdbddf150 Modified Files -------------- src/backend/access/heap/README.tuplock | 42 ++++++ src/backend/access/heap/heapam.c | 150 ++++++++++++++++++++- src/backend/access/index/genam.c | 4 +- src/backend/catalog/aclchk.c | 9 +- src/backend/catalog/catalog.c | 9 ++ src/backend/commands/dbcommands.c | 25 +++- src/backend/commands/event_trigger.c | 7 +- src/backend/commands/indexcmds.c | 7 +- src/backend/commands/tablecmds.c | 28 +++- src/backend/executor/execMain.c | 6 + src/backend/executor/execReplication.c | 6 +- src/backend/executor/nodeModifyTable.c | 98 +++++++++++--- src/backend/utils/cache/relcache.c | 9 +- src/backend/utils/cache/syscache.c | 117 ++++++++++++++++ src/include/nodes/execnodes.h | 3 + src/include/storage/lockdefs.h | 2 + src/include/utils/syscache.h | 5 + .../isolation/expected/intra-grant-inplace.out | 14 +- src/test/isolation/specs/eval-plan-qual.spec | 2 +- src/test/isolation/specs/intra-grant-inplace.spec | 12 +- 20 files changed, 498 insertions(+), 57 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: For inplace update durability, make heap_update() callers wait. @ 2024-09-24 22:27 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 7+ messages in thread From: Noah Misch @ 2024-09-24 22:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org For inplace update durability, make heap_update() callers wait. The previous commit fixed some ways of losing an inplace update. It remained possible to lose one when a backend working toward a heap_update() copied a tuple into memory just before inplace update of that tuple. In catalogs eligible for inplace update, use LOCKTAG_TUPLE to govern admission to the steps of copying an old tuple, modifying it, and issuing heap_update(). This includes MERGE commands. To avoid changing most of the pg_class DDL, don't require LOCKTAG_TUPLE when holding a relation lock sufficient to exclude inplace updaters. Back-patch to v12 (all supported versions). In v13 and v12, "UPDATE pg_class" or "UPDATE pg_database" can still lose an inplace update. The v14+ UPDATE fix needs commit 86dc90056dfdbd9d1b891718d2e5614e3e432f35, and it wasn't worth reimplementing that fix without such infrastructure. Reviewed by Nitin Motiani and (in earlier versions) Heikki Linnakangas. Discussion: https://postgr.es/m/20231027214946.79.nmisch@google.com Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/51ff46de29f67d73549b2858f57e77ada8513369 Modified Files -------------- src/backend/access/heap/README.tuplock | 42 ++++++ src/backend/access/heap/heapam.c | 150 ++++++++++++++++++++- src/backend/access/index/genam.c | 4 +- src/backend/catalog/aclchk.c | 9 +- src/backend/catalog/catalog.c | 9 ++ src/backend/commands/dbcommands.c | 25 +++- src/backend/commands/indexcmds.c | 7 +- src/backend/commands/tablecmds.c | 28 +++- src/backend/executor/execMain.c | 6 + src/backend/executor/execReplication.c | 6 +- src/backend/executor/nodeModifyTable.c | 87 ++++++++++-- src/backend/utils/cache/relcache.c | 9 +- src/backend/utils/cache/syscache.c | 117 ++++++++++++++++ src/include/nodes/execnodes.h | 3 + src/include/storage/lockdefs.h | 2 + src/include/utils/syscache.h | 5 + .../isolation/expected/intra-grant-inplace.out | 14 +- src/test/isolation/specs/eval-plan-qual.spec | 2 +- src/test/isolation/specs/intra-grant-inplace.spec | 12 +- 19 files changed, 488 insertions(+), 49 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: For inplace update durability, make heap_update() callers wait. @ 2024-09-24 22:27 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 7+ messages in thread From: Noah Misch @ 2024-09-24 22:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org For inplace update durability, make heap_update() callers wait. The previous commit fixed some ways of losing an inplace update. It remained possible to lose one when a backend working toward a heap_update() copied a tuple into memory just before inplace update of that tuple. In catalogs eligible for inplace update, use LOCKTAG_TUPLE to govern admission to the steps of copying an old tuple, modifying it, and issuing heap_update(). This includes MERGE commands. To avoid changing most of the pg_class DDL, don't require LOCKTAG_TUPLE when holding a relation lock sufficient to exclude inplace updaters. Back-patch to v12 (all supported versions). In v13 and v12, "UPDATE pg_class" or "UPDATE pg_database" can still lose an inplace update. The v14+ UPDATE fix needs commit 86dc90056dfdbd9d1b891718d2e5614e3e432f35, and it wasn't worth reimplementing that fix without such infrastructure. Reviewed by Nitin Motiani and (in earlier versions) Heikki Linnakangas. Discussion: https://postgr.es/m/20231027214946.79.nmisch@google.com Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/5c837f8fa022ff9d9ebced71fdcae273fe433570 Modified Files -------------- src/backend/access/heap/README.tuplock | 42 ++++++ src/backend/access/heap/heapam.c | 150 ++++++++++++++++++++- src/backend/access/index/genam.c | 4 +- src/backend/catalog/aclchk.c | 9 +- src/backend/catalog/catalog.c | 9 ++ src/backend/commands/dbcommands.c | 25 +++- src/backend/commands/indexcmds.c | 7 +- src/backend/commands/tablecmds.c | 28 +++- src/backend/executor/execMain.c | 7 + src/backend/executor/execReplication.c | 7 +- src/backend/executor/nodeModifyTable.c | 87 ++++++++++-- src/backend/utils/cache/relcache.c | 9 +- src/backend/utils/cache/syscache.c | 117 ++++++++++++++++ src/include/nodes/execnodes.h | 3 + src/include/storage/lockdefs.h | 2 + src/include/utils/syscache.h | 5 + .../isolation/expected/intra-grant-inplace.out | 14 +- src/test/isolation/specs/eval-plan-qual.spec | 2 +- src/test/isolation/specs/intra-grant-inplace.spec | 12 +- 19 files changed, 490 insertions(+), 49 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: For inplace update durability, make heap_update() callers wait. @ 2024-09-24 22:27 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 7+ messages in thread From: Noah Misch @ 2024-09-24 22:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org For inplace update durability, make heap_update() callers wait. The previous commit fixed some ways of losing an inplace update. It remained possible to lose one when a backend working toward a heap_update() copied a tuple into memory just before inplace update of that tuple. In catalogs eligible for inplace update, use LOCKTAG_TUPLE to govern admission to the steps of copying an old tuple, modifying it, and issuing heap_update(). This includes MERGE commands. To avoid changing most of the pg_class DDL, don't require LOCKTAG_TUPLE when holding a relation lock sufficient to exclude inplace updaters. Back-patch to v12 (all supported versions). In v13 and v12, "UPDATE pg_class" or "UPDATE pg_database" can still lose an inplace update. The v14+ UPDATE fix needs commit 86dc90056dfdbd9d1b891718d2e5614e3e432f35, and it wasn't worth reimplementing that fix without such infrastructure. Reviewed by Nitin Motiani and (in earlier versions) Heikki Linnakangas. Discussion: https://postgr.es/m/20231027214946.79.nmisch@google.com Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f51b34b3eddbc501063f7b8ac470d26ce4e18a48 Modified Files -------------- src/backend/access/heap/README.tuplock | 42 ++++++ src/backend/access/heap/heapam.c | 150 ++++++++++++++++++++- src/backend/access/index/genam.c | 4 +- src/backend/catalog/aclchk.c | 9 +- src/backend/catalog/catalog.c | 9 ++ src/backend/commands/dbcommands.c | 14 +- src/backend/commands/indexcmds.c | 7 +- src/backend/commands/tablecmds.c | 28 +++- src/backend/executor/execMain.c | 7 + src/backend/executor/execReplication.c | 7 +- src/backend/executor/nodeModifyTable.c | 30 +++++ src/backend/utils/cache/relcache.c | 9 +- src/backend/utils/cache/syscache.c | 117 ++++++++++++++++ src/include/nodes/execnodes.h | 3 + src/include/storage/lockdefs.h | 2 + src/include/utils/syscache.h | 5 + .../isolation/expected/intra-grant-inplace.out | 14 +- src/test/isolation/specs/eval-plan-qual.spec | 2 +- src/test/isolation/specs/intra-grant-inplace.spec | 12 +- 19 files changed, 437 insertions(+), 34 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: For inplace update durability, make heap_update() callers wait. @ 2024-09-24 22:27 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 7+ messages in thread From: Noah Misch @ 2024-09-24 22:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org For inplace update durability, make heap_update() callers wait. The previous commit fixed some ways of losing an inplace update. It remained possible to lose one when a backend working toward a heap_update() copied a tuple into memory just before inplace update of that tuple. In catalogs eligible for inplace update, use LOCKTAG_TUPLE to govern admission to the steps of copying an old tuple, modifying it, and issuing heap_update(). This includes MERGE commands. To avoid changing most of the pg_class DDL, don't require LOCKTAG_TUPLE when holding a relation lock sufficient to exclude inplace updaters. Back-patch to v12 (all supported versions). In v13 and v12, "UPDATE pg_class" or "UPDATE pg_database" can still lose an inplace update. The v14+ UPDATE fix needs commit 86dc90056dfdbd9d1b891718d2e5614e3e432f35, and it wasn't worth reimplementing that fix without such infrastructure. Reviewed by Nitin Motiani and (in earlier versions) Heikki Linnakangas. Discussion: https://postgr.es/m/20231027214946.79.nmisch@google.com Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/14c57cb63907eb7af0f973022b919c0f777db0d9 Modified Files -------------- src/backend/access/heap/README.tuplock | 42 ++++++ src/backend/access/heap/heapam.c | 150 ++++++++++++++++++++- src/backend/access/index/genam.c | 4 +- src/backend/catalog/aclchk.c | 9 +- src/backend/catalog/catalog.c | 9 ++ src/backend/commands/dbcommands.c | 14 +- src/backend/commands/indexcmds.c | 7 +- src/backend/commands/tablecmds.c | 28 +++- src/backend/executor/execReplication.c | 7 +- src/backend/executor/nodeModifyTable.c | 26 ++++ src/backend/utils/cache/relcache.c | 9 +- src/backend/utils/cache/syscache.c | 117 ++++++++++++++++ src/include/storage/lockdefs.h | 2 + src/include/utils/syscache.h | 5 + .../isolation/expected/intra-grant-inplace.out | 14 +- src/test/isolation/specs/eval-plan-qual.spec | 2 +- src/test/isolation/specs/intra-grant-inplace.spec | 12 +- 17 files changed, 423 insertions(+), 34 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: For inplace update durability, make heap_update() callers wait. @ 2024-09-24 22:27 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 7+ messages in thread From: Noah Misch @ 2024-09-24 22:27 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org For inplace update durability, make heap_update() callers wait. The previous commit fixed some ways of losing an inplace update. It remained possible to lose one when a backend working toward a heap_update() copied a tuple into memory just before inplace update of that tuple. In catalogs eligible for inplace update, use LOCKTAG_TUPLE to govern admission to the steps of copying an old tuple, modifying it, and issuing heap_update(). This includes MERGE commands. To avoid changing most of the pg_class DDL, don't require LOCKTAG_TUPLE when holding a relation lock sufficient to exclude inplace updaters. Back-patch to v12 (all supported versions). In v13 and v12, "UPDATE pg_class" or "UPDATE pg_database" can still lose an inplace update. The v14+ UPDATE fix needs commit 86dc90056dfdbd9d1b891718d2e5614e3e432f35, and it wasn't worth reimplementing that fix without such infrastructure. Reviewed by Nitin Motiani and (in earlier versions) Heikki Linnakangas. Discussion: https://postgr.es/m/20231027214946.79.nmisch@google.com Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/cafcc3ad0ed324993211b0dce09362aad3165146 Modified Files -------------- src/backend/access/heap/README.tuplock | 42 ++++++ src/backend/access/heap/heapam.c | 150 ++++++++++++++++++++- src/backend/access/index/genam.c | 4 +- src/backend/catalog/aclchk.c | 9 +- src/backend/catalog/catalog.c | 9 ++ src/backend/commands/dbcommands.c | 14 +- src/backend/commands/indexcmds.c | 7 +- src/backend/commands/tablecmds.c | 28 +++- src/backend/executor/execReplication.c | 7 +- src/backend/executor/nodeModifyTable.c | 26 ++++ src/backend/utils/cache/relcache.c | 9 +- src/backend/utils/cache/syscache.c | 117 ++++++++++++++++ src/include/storage/lockdefs.h | 2 + src/include/utils/syscache.h | 5 + .../isolation/expected/intra-grant-inplace.out | 14 +- src/test/isolation/specs/eval-plan-qual.spec | 2 +- src/test/isolation/specs/intra-grant-inplace.spec | 12 +- 17 files changed, 423 insertions(+), 34 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2024-09-24 22:27 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2024-09-24 22:27 pgsql: For inplace update durability, make heap_update() callers wait. Noah Misch <noah@leadboat.com> 2024-09-24 22:27 pgsql: For inplace update durability, make heap_update() callers wait. Noah Misch <noah@leadboat.com> 2024-09-24 22:27 pgsql: For inplace update durability, make heap_update() callers wait. Noah Misch <noah@leadboat.com> 2024-09-24 22:27 pgsql: For inplace update durability, make heap_update() callers wait. Noah Misch <noah@leadboat.com> 2024-09-24 22:27 pgsql: For inplace update durability, make heap_update() callers wait. Noah Misch <noah@leadboat.com> 2024-09-24 22:27 pgsql: For inplace update durability, make heap_update() callers wait. Noah Misch <noah@leadboat.com> 2024-09-24 22:27 pgsql: For inplace update durability, make heap_update() callers wait. Noah Misch <noah@leadboat.com>
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