pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix data loss at inplace update after heap_update(). 7+ messages / 1 participants [nested] [flat]
* pgsql: Fix data loss at inplace update after heap_update(). @ 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 Fix data loss at inplace update after heap_update(). As previously-added tests demonstrated, heap_inplace_update() could instead update an unrelated tuple of the same catalog. It could lose the update. Losing relhasindex=t was a source of index corruption. Inplace-updating commands like VACUUM will now wait for heap_update() commands like GRANT TABLE and GRANT DATABASE. That isn't ideal, but a long-running GRANT already hurts VACUUM progress more just by keeping an XID running. The VACUUM will behave like a DELETE or UPDATE waiting for the uncommitted change. For implementation details, start at the systable_inplace_update_begin() header comment and README.tuplock. Back-patch to v12 (all supported versions). In back branches, retain a deprecated heap_inplace_update(), for extensions. Reported by Smolkin Grigory. Reviewed by Nitin Motiani, (in earlier versions) Heikki Linnakangas, and (in earlier versions) Alexander Lakhin. Discussion: https://postgr.es/m/CAMp+ueZQz3yDk7qg42hk6-9gxniYbp-=bG2mgqecErqR5gGGOA@mail.gmail.com Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/63f01980560adb57524f8b004b8f47de7e29cc38 Modified Files -------------- src/backend/access/heap/README.tuplock | 11 + src/backend/access/heap/heapam.c | 252 +++++++++++++++++++-- src/backend/access/index/genam.c | 136 +++++++++++ src/backend/catalog/index.c | 38 +--- src/backend/catalog/toasting.c | 31 ++- src/backend/commands/dbcommands.c | 34 +-- src/backend/commands/vacuum.c | 32 ++- src/include/access/genam.h | 9 + src/include/access/heapam.h | 7 + .../isolation/expected/intra-grant-inplace-db.out | 10 +- .../isolation/expected/intra-grant-inplace.out | 16 +- .../isolation/specs/intra-grant-inplace-db.spec | 1 - src/test/isolation/specs/intra-grant-inplace.spec | 4 +- 13 files changed, 485 insertions(+), 96 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix data loss at inplace update after heap_update(). @ 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 Fix data loss at inplace update after heap_update(). As previously-added tests demonstrated, heap_inplace_update() could instead update an unrelated tuple of the same catalog. It could lose the update. Losing relhasindex=t was a source of index corruption. Inplace-updating commands like VACUUM will now wait for heap_update() commands like GRANT TABLE and GRANT DATABASE. That isn't ideal, but a long-running GRANT already hurts VACUUM progress more just by keeping an XID running. The VACUUM will behave like a DELETE or UPDATE waiting for the uncommitted change. For implementation details, start at the systable_inplace_update_begin() header comment and README.tuplock. Back-patch to v12 (all supported versions). In back branches, retain a deprecated heap_inplace_update(), for extensions. Reported by Smolkin Grigory. Reviewed by Nitin Motiani, (in earlier versions) Heikki Linnakangas, and (in earlier versions) Alexander Lakhin. Discussion: https://postgr.es/m/CAMp+ueZQz3yDk7qg42hk6-9gxniYbp-=bG2mgqecErqR5gGGOA@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/a07e03fd8fa7daf4d1356f7cb501ffe784ea6257 Modified Files -------------- src/backend/access/heap/README.tuplock | 11 + src/backend/access/heap/heapam.c | 226 ++++++++++++---- src/backend/access/index/genam.c | 137 ++++++++++ src/backend/catalog/index.c | 38 +-- src/backend/catalog/toasting.c | 30 ++- src/backend/commands/dbcommands.c | 34 +-- src/backend/commands/event_trigger.c | 27 +- src/backend/commands/vacuum.c | 32 ++- src/include/access/genam.h | 9 + src/include/access/heapam.h | 8 +- .../isolation/expected/intra-grant-inplace-db.out | 10 +- .../isolation/expected/intra-grant-inplace.out | 16 +- .../isolation/specs/intra-grant-inplace-db.spec | 1 - src/test/isolation/specs/intra-grant-inplace.spec | 4 +- .../modules/injection_points/expected/inplace.out | 299 ++++++++++++++++++++- .../modules/injection_points/specs/inplace.spec | 74 ++++- 16 files changed, 801 insertions(+), 155 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix data loss at inplace update after heap_update(). @ 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 Fix data loss at inplace update after heap_update(). As previously-added tests demonstrated, heap_inplace_update() could instead update an unrelated tuple of the same catalog. It could lose the update. Losing relhasindex=t was a source of index corruption. Inplace-updating commands like VACUUM will now wait for heap_update() commands like GRANT TABLE and GRANT DATABASE. That isn't ideal, but a long-running GRANT already hurts VACUUM progress more just by keeping an XID running. The VACUUM will behave like a DELETE or UPDATE waiting for the uncommitted change. For implementation details, start at the systable_inplace_update_begin() header comment and README.tuplock. Back-patch to v12 (all supported versions). In back branches, retain a deprecated heap_inplace_update(), for extensions. Reported by Smolkin Grigory. Reviewed by Nitin Motiani, (in earlier versions) Heikki Linnakangas, and (in earlier versions) Alexander Lakhin. Discussion: https://postgr.es/m/CAMp+ueZQz3yDk7qg42hk6-9gxniYbp-=bG2mgqecErqR5gGGOA@mail.gmail.com Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/fd27b878c2ea54b6132758084270cb13e5e66f2e Modified Files -------------- src/backend/access/heap/README.tuplock | 11 + src/backend/access/heap/heapam.c | 254 +++++++++++++++-- src/backend/access/index/genam.c | 139 ++++++++++ src/backend/catalog/index.c | 38 +-- src/backend/catalog/toasting.c | 30 ++- src/backend/commands/dbcommands.c | 34 +-- src/backend/commands/event_trigger.c | 27 +- src/backend/commands/vacuum.c | 32 ++- src/include/access/genam.h | 9 + src/include/access/heapam.h | 7 + .../isolation/expected/intra-grant-inplace-db.out | 10 +- .../isolation/expected/intra-grant-inplace.out | 16 +- .../isolation/specs/intra-grant-inplace-db.spec | 1 - src/test/isolation/specs/intra-grant-inplace.spec | 4 +- .../modules/injection_points/expected/inplace.out | 299 ++++++++++++++++++++- .../modules/injection_points/specs/inplace.spec | 74 ++++- 16 files changed, 862 insertions(+), 123 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix data loss at inplace update after heap_update(). @ 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 Fix data loss at inplace update after heap_update(). As previously-added tests demonstrated, heap_inplace_update() could instead update an unrelated tuple of the same catalog. It could lose the update. Losing relhasindex=t was a source of index corruption. Inplace-updating commands like VACUUM will now wait for heap_update() commands like GRANT TABLE and GRANT DATABASE. That isn't ideal, but a long-running GRANT already hurts VACUUM progress more just by keeping an XID running. The VACUUM will behave like a DELETE or UPDATE waiting for the uncommitted change. For implementation details, start at the systable_inplace_update_begin() header comment and README.tuplock. Back-patch to v12 (all supported versions). In back branches, retain a deprecated heap_inplace_update(), for extensions. Reported by Smolkin Grigory. Reviewed by Nitin Motiani, (in earlier versions) Heikki Linnakangas, and (in earlier versions) Alexander Lakhin. Discussion: https://postgr.es/m/CAMp+ueZQz3yDk7qg42hk6-9gxniYbp-=bG2mgqecErqR5gGGOA@mail.gmail.com Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/a8ad1929d2ec04a5e46dd51d2ef5768c7179ef0b Modified Files -------------- src/backend/access/heap/README.tuplock | 11 + src/backend/access/heap/heapam.c | 248 +++++++++++++++++++-- src/backend/access/index/genam.c | 138 ++++++++++++ src/backend/catalog/index.c | 38 +--- src/backend/catalog/toasting.c | 31 ++- src/backend/commands/dbcommands.c | 34 +-- src/backend/commands/vacuum.c | 32 ++- src/include/access/genam.h | 9 + src/include/access/heapam.h | 7 + .../isolation/expected/intra-grant-inplace-db.out | 10 +- .../isolation/expected/intra-grant-inplace.out | 16 +- .../isolation/specs/intra-grant-inplace-db.spec | 1 - src/test/isolation/specs/intra-grant-inplace.spec | 4 +- 13 files changed, 485 insertions(+), 94 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix data loss at inplace update after heap_update(). @ 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 Fix data loss at inplace update after heap_update(). As previously-added tests demonstrated, heap_inplace_update() could instead update an unrelated tuple of the same catalog. It could lose the update. Losing relhasindex=t was a source of index corruption. Inplace-updating commands like VACUUM will now wait for heap_update() commands like GRANT TABLE and GRANT DATABASE. That isn't ideal, but a long-running GRANT already hurts VACUUM progress more just by keeping an XID running. The VACUUM will behave like a DELETE or UPDATE waiting for the uncommitted change. For implementation details, start at the systable_inplace_update_begin() header comment and README.tuplock. Back-patch to v12 (all supported versions). In back branches, retain a deprecated heap_inplace_update(), for extensions. Reported by Smolkin Grigory. Reviewed by Nitin Motiani, (in earlier versions) Heikki Linnakangas, and (in earlier versions) Alexander Lakhin. Discussion: https://postgr.es/m/CAMp+ueZQz3yDk7qg42hk6-9gxniYbp-=bG2mgqecErqR5gGGOA@mail.gmail.com Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/8590c942c1a6b861d0cf4fa5aa694ab3a65fa306 Modified Files -------------- src/backend/access/heap/README.tuplock | 11 + src/backend/access/heap/heapam.c | 252 +++++++++++++++++++-- src/backend/access/index/genam.c | 137 +++++++++++ src/backend/catalog/index.c | 38 +--- src/backend/catalog/toasting.c | 31 ++- src/backend/commands/dbcommands.c | 34 +-- src/backend/commands/vacuum.c | 32 ++- src/include/access/genam.h | 9 + src/include/access/heapam.h | 7 + .../isolation/expected/intra-grant-inplace-db.out | 10 +- .../isolation/expected/intra-grant-inplace.out | 16 +- .../isolation/specs/intra-grant-inplace-db.spec | 1 - src/test/isolation/specs/intra-grant-inplace.spec | 4 +- 13 files changed, 486 insertions(+), 96 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix data loss at inplace update after heap_update(). @ 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 Fix data loss at inplace update after heap_update(). As previously-added tests demonstrated, heap_inplace_update() could instead update an unrelated tuple of the same catalog. It could lose the update. Losing relhasindex=t was a source of index corruption. Inplace-updating commands like VACUUM will now wait for heap_update() commands like GRANT TABLE and GRANT DATABASE. That isn't ideal, but a long-running GRANT already hurts VACUUM progress more just by keeping an XID running. The VACUUM will behave like a DELETE or UPDATE waiting for the uncommitted change. For implementation details, start at the systable_inplace_update_begin() header comment and README.tuplock. Back-patch to v12 (all supported versions). In back branches, retain a deprecated heap_inplace_update(), for extensions. Reported by Smolkin Grigory. Reviewed by Nitin Motiani, (in earlier versions) Heikki Linnakangas, and (in earlier versions) Alexander Lakhin. Discussion: https://postgr.es/m/CAMp+ueZQz3yDk7qg42hk6-9gxniYbp-=bG2mgqecErqR5gGGOA@mail.gmail.com Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/7354b680ab64fbde6072f248fe3b2ff909a99d12 Modified Files -------------- src/backend/access/heap/README.tuplock | 11 + src/backend/access/heap/heapam.c | 248 +++++++++++++++++++-- src/backend/access/index/genam.c | 138 ++++++++++++ src/backend/catalog/index.c | 38 +--- src/backend/catalog/toasting.c | 31 ++- src/backend/commands/dbcommands.c | 34 +-- src/backend/commands/vacuum.c | 32 ++- src/include/access/genam.h | 9 + src/include/access/heapam.h | 7 + .../isolation/expected/intra-grant-inplace-db.out | 10 +- .../isolation/expected/intra-grant-inplace.out | 16 +- .../isolation/specs/intra-grant-inplace-db.spec | 1 - src/test/isolation/specs/intra-grant-inplace.spec | 4 +- 13 files changed, 485 insertions(+), 94 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Fix data loss at inplace update after heap_update(). @ 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 Fix data loss at inplace update after heap_update(). As previously-added tests demonstrated, heap_inplace_update() could instead update an unrelated tuple of the same catalog. It could lose the update. Losing relhasindex=t was a source of index corruption. Inplace-updating commands like VACUUM will now wait for heap_update() commands like GRANT TABLE and GRANT DATABASE. That isn't ideal, but a long-running GRANT already hurts VACUUM progress more just by keeping an XID running. The VACUUM will behave like a DELETE or UPDATE waiting for the uncommitted change. For implementation details, start at the systable_inplace_update_begin() header comment and README.tuplock. Back-patch to v12 (all supported versions). In back branches, retain a deprecated heap_inplace_update(), for extensions. Reported by Smolkin Grigory. Reviewed by Nitin Motiani, (in earlier versions) Heikki Linnakangas, and (in earlier versions) Alexander Lakhin. Discussion: https://postgr.es/m/CAMp+ueZQz3yDk7qg42hk6-9gxniYbp-=bG2mgqecErqR5gGGOA@mail.gmail.com Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/82c2d9e0220666ff698c226db41cb119ed4bfa44 Modified Files -------------- src/backend/access/heap/README.tuplock | 11 + src/backend/access/heap/heapam.c | 252 +++++++++++++++++++-- src/backend/access/index/genam.c | 137 +++++++++++ src/backend/catalog/index.c | 38 +--- src/backend/catalog/toasting.c | 31 ++- src/backend/commands/dbcommands.c | 34 +-- src/backend/commands/vacuum.c | 32 ++- src/include/access/genam.h | 9 + src/include/access/heapam.h | 7 + .../isolation/expected/intra-grant-inplace-db.out | 10 +- .../isolation/expected/intra-grant-inplace.out | 16 +- .../isolation/specs/intra-grant-inplace-db.spec | 1 - src/test/isolation/specs/intra-grant-inplace.spec | 4 +- 13 files changed, 486 insertions(+), 96 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: Fix data loss at inplace update after heap_update(). Noah Misch <noah@leadboat.com> 2024-09-24 22:27 pgsql: Fix data loss at inplace update after heap_update(). Noah Misch <noah@leadboat.com> 2024-09-24 22:27 pgsql: Fix data loss at inplace update after heap_update(). Noah Misch <noah@leadboat.com> 2024-09-24 22:27 pgsql: Fix data loss at inplace update after heap_update(). Noah Misch <noah@leadboat.com> 2024-09-24 22:27 pgsql: Fix data loss at inplace update after heap_update(). Noah Misch <noah@leadboat.com> 2024-09-24 22:27 pgsql: Fix data loss at inplace update after heap_update(). Noah Misch <noah@leadboat.com> 2024-09-24 22:27 pgsql: Fix data loss at inplace update after heap_update(). 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