pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: For inplace update, send nontransactional invalidations.
11+ messages / 1 participants
[nested] [flat]

* pgsql: For inplace update, send nontransactional invalidations.
@ 2024-10-25 13:51  Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Noah Misch @ 2024-10-25 13:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

For inplace update, send nontransactional invalidations.

The inplace update survives ROLLBACK.  The inval didn't, so another
backend's DDL could then update the row without incorporating the
inplace update.  In the test this fixes, a mix of CREATE INDEX and ALTER
TABLE resulted in a table with an index, yet relhasindex=f.  That is a
source of index corruption.  Back-patch to v12 (all supported versions).
The back branch versions don't change WAL, because those branches just
added end-of-recovery SIResetAll().  All branches change the ABI of
extern function PrepareToInvalidateCacheTuple().  No PGXN extension
calls that, and there's no apparent use case in extensions.

Reviewed by Nitin Motiani and (in earlier versions) Andres Freund.

Discussion: https://postgr.es/m/20240523000548.58.nmisch@google.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/243e9b40f1b2dd09d6e5bf91ebf6e822a2cd3704

Modified Files
--------------
src/backend/access/heap/heapam.c              |  60 ++++-
src/backend/access/heap/heapam_xlog.c         |   6 +
src/backend/access/rmgrdesc/heapdesc.c        |   4 +
src/backend/access/rmgrdesc/standbydesc.c     |   6 +-
src/backend/access/transam/xact.c             |  26 +-
src/backend/catalog/index.c                   |  11 +-
src/backend/commands/event_trigger.c          |   5 -
src/backend/replication/logical/decode.c      |  26 +-
src/backend/utils/cache/catcache.c            |   7 +-
src/backend/utils/cache/inval.c               | 348 +++++++++++++++++++-------
src/backend/utils/cache/syscache.c            |   3 +-
src/include/access/heapam_xlog.h              |   8 +-
src/include/access/xlog_internal.h            |   2 +-
src/include/storage/sinval.h                  |   2 +
src/include/utils/catcache.h                  |   3 +-
src/include/utils/inval.h                     |   6 +
src/test/isolation/expected/inplace-inval.out |  10 +-
src/test/isolation/specs/inplace-inval.spec   |  12 +-
src/tools/pgindent/typedefs.list              |   1 +
19 files changed, 401 insertions(+), 145 deletions(-)



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

* pgsql: For inplace update, send nontransactional invalidations.
@ 2024-10-25 13:51  Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Noah Misch @ 2024-10-25 13:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

For inplace update, send nontransactional invalidations.

The inplace update survives ROLLBACK.  The inval didn't, so another
backend's DDL could then update the row without incorporating the
inplace update.  In the test this fixes, a mix of CREATE INDEX and ALTER
TABLE resulted in a table with an index, yet relhasindex=f.  That is a
source of index corruption.  Back-patch to v12 (all supported versions).
The back branch versions don't change WAL, because those branches just
added end-of-recovery SIResetAll().  All branches change the ABI of
extern function PrepareToInvalidateCacheTuple().  No PGXN extension
calls that, and there's no apparent use case in extensions.

Reviewed by Nitin Motiani and (in earlier versions) Andres Freund.

Discussion: https://postgr.es/m/20240523000548.58.nmisch@google.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4cf948cbeedffe597546af6c4a7a7e1d103c3923

Modified Files
--------------
src/backend/access/heap/heapam.c              |  43 ++++-
src/backend/access/transam/xact.c             |  26 ++-
src/backend/catalog/index.c                   |  11 +-
src/backend/replication/logical/decode.c      |  26 ++-
src/backend/utils/cache/catcache.c            |   7 +-
src/backend/utils/cache/inval.c               | 259 +++++++++++++++++++-------
src/backend/utils/cache/syscache.c            |   3 +-
src/include/utils/catcache.h                  |   3 +-
src/include/utils/inval.h                     |   6 +
src/test/isolation/expected/inplace-inval.out |  10 +-
src/test/isolation/specs/inplace-inval.spec   |  12 +-
11 files changed, 289 insertions(+), 117 deletions(-)



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

* pgsql: For inplace update, send nontransactional invalidations.
@ 2024-10-25 13:51  Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Noah Misch @ 2024-10-25 13:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

For inplace update, send nontransactional invalidations.

The inplace update survives ROLLBACK.  The inval didn't, so another
backend's DDL could then update the row without incorporating the
inplace update.  In the test this fixes, a mix of CREATE INDEX and ALTER
TABLE resulted in a table with an index, yet relhasindex=f.  That is a
source of index corruption.  Back-patch to v12 (all supported versions).
The back branch versions don't change WAL, because those branches just
added end-of-recovery SIResetAll().  All branches change the ABI of
extern function PrepareToInvalidateCacheTuple().  No PGXN extension
calls that, and there's no apparent use case in extensions.

Reviewed by Nitin Motiani and (in earlier versions) Andres Freund.

Discussion: https://postgr.es/m/20240523000548.58.nmisch@google.com

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4eac5a1fa78edde0de53a89bd2b06e1fe5588913

Modified Files
--------------
src/backend/access/heap/heapam.c              |  43 +++-
src/backend/access/transam/xact.c             |  26 ++-
src/backend/catalog/index.c                   |  11 +-
src/backend/replication/logical/decode.c      |  26 +--
src/backend/utils/cache/catcache.c            |   7 +-
src/backend/utils/cache/inval.c               | 304 ++++++++++++++++++--------
src/backend/utils/cache/syscache.c            |   3 +-
src/include/utils/catcache.h                  |   3 +-
src/include/utils/inval.h                     |   6 +
src/test/isolation/expected/inplace-inval.out |  10 +-
src/test/isolation/specs/inplace-inval.spec   |  12 +-
src/tools/pgindent/typedefs.list              |   1 +
12 files changed, 320 insertions(+), 132 deletions(-)



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

* pgsql: For inplace update, send nontransactional invalidations.
@ 2024-10-25 13:51  Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Noah Misch @ 2024-10-25 13:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

For inplace update, send nontransactional invalidations.

The inplace update survives ROLLBACK.  The inval didn't, so another
backend's DDL could then update the row without incorporating the
inplace update.  In the test this fixes, a mix of CREATE INDEX and ALTER
TABLE resulted in a table with an index, yet relhasindex=f.  That is a
source of index corruption.  Back-patch to v12 (all supported versions).
The back branch versions don't change WAL, because those branches just
added end-of-recovery SIResetAll().  All branches change the ABI of
extern function PrepareToInvalidateCacheTuple().  No PGXN extension
calls that, and there's no apparent use case in extensions.

Reviewed by Nitin Motiani and (in earlier versions) Andres Freund.

Discussion: https://postgr.es/m/20240523000548.58.nmisch@google.com

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0ea9d40a667960ad5cca5f537bb88d3bf6038379

Modified Files
--------------
src/backend/access/heap/heapam.c              |  43 ++++-
src/backend/access/transam/xact.c             |  26 ++-
src/backend/catalog/index.c                   |  11 +-
src/backend/replication/logical/decode.c      |  26 ++-
src/backend/utils/cache/catcache.c            |   7 +-
src/backend/utils/cache/inval.c               | 259 +++++++++++++++++++-------
src/backend/utils/cache/syscache.c            |   3 +-
src/include/utils/catcache.h                  |   3 +-
src/include/utils/inval.h                     |   6 +
src/test/isolation/expected/inplace-inval.out |  10 +-
src/test/isolation/specs/inplace-inval.spec   |  12 +-
11 files changed, 289 insertions(+), 117 deletions(-)



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

* pgsql: For inplace update, send nontransactional invalidations.
@ 2024-10-25 13:51  Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Noah Misch @ 2024-10-25 13:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

For inplace update, send nontransactional invalidations.

The inplace update survives ROLLBACK.  The inval didn't, so another
backend's DDL could then update the row without incorporating the
inplace update.  In the test this fixes, a mix of CREATE INDEX and ALTER
TABLE resulted in a table with an index, yet relhasindex=f.  That is a
source of index corruption.  Back-patch to v12 (all supported versions).
The back branch versions don't change WAL, because those branches just
added end-of-recovery SIResetAll().  All branches change the ABI of
extern function PrepareToInvalidateCacheTuple().  No PGXN extension
calls that, and there's no apparent use case in extensions.

Reviewed by Nitin Motiani and (in earlier versions) Andres Freund.

Discussion: https://postgr.es/m/20240523000548.58.nmisch@google.com

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/backend/access/heap/heapam.c              |  43 ++++-
src/backend/access/transam/xact.c             |  26 ++-
src/backend/catalog/index.c                   |  11 +-
src/backend/replication/logical/decode.c      |  26 ++-
src/backend/utils/cache/catcache.c            |   7 +-
src/backend/utils/cache/inval.c               | 261 +++++++++++++++++++-------
src/backend/utils/cache/syscache.c            |   3 +-
src/include/utils/catcache.h                  |   3 +-
src/include/utils/inval.h                     |   6 +
src/test/isolation/expected/inplace-inval.out |  10 +-
src/test/isolation/specs/inplace-inval.spec   |  12 +-
11 files changed, 290 insertions(+), 118 deletions(-)



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

* pgsql: For inplace update, send nontransactional invalidations.
@ 2024-10-25 13:51  Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Noah Misch @ 2024-10-25 13:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

For inplace update, send nontransactional invalidations.

The inplace update survives ROLLBACK.  The inval didn't, so another
backend's DDL could then update the row without incorporating the
inplace update.  In the test this fixes, a mix of CREATE INDEX and ALTER
TABLE resulted in a table with an index, yet relhasindex=f.  That is a
source of index corruption.  Back-patch to v12 (all supported versions).
The back branch versions don't change WAL, because those branches just
added end-of-recovery SIResetAll().  All branches change the ABI of
extern function PrepareToInvalidateCacheTuple().  No PGXN extension
calls that, and there's no apparent use case in extensions.

Reviewed by Nitin Motiani and (in earlier versions) Andres Freund.

Discussion: https://postgr.es/m/20240523000548.58.nmisch@google.com

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/95c5acb3fc261067ab65ddc0b2dca8e162f09442

Modified Files
--------------
src/backend/access/heap/heapam.c              |  43 +++-
src/backend/access/transam/xact.c             |  26 ++-
src/backend/catalog/index.c                   |  11 +-
src/backend/commands/event_trigger.c          |   5 -
src/backend/replication/logical/decode.c      |  26 +--
src/backend/utils/cache/catcache.c            |   7 +-
src/backend/utils/cache/inval.c               | 304 ++++++++++++++++++--------
src/backend/utils/cache/syscache.c            |   3 +-
src/include/utils/catcache.h                  |   3 +-
src/include/utils/inval.h                     |   6 +
src/test/isolation/expected/inplace-inval.out |  10 +-
src/test/isolation/specs/inplace-inval.spec   |  12 +-
src/tools/pgindent/typedefs.list              |   1 +
13 files changed, 320 insertions(+), 137 deletions(-)



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

* pgsql: For inplace update, send nontransactional invalidations.
@ 2024-10-25 13:51  Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Noah Misch @ 2024-10-25 13:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

For inplace update, send nontransactional invalidations.

The inplace update survives ROLLBACK.  The inval didn't, so another
backend's DDL could then update the row without incorporating the
inplace update.  In the test this fixes, a mix of CREATE INDEX and ALTER
TABLE resulted in a table with an index, yet relhasindex=f.  That is a
source of index corruption.  Back-patch to v12 (all supported versions).
The back branch versions don't change WAL, because those branches just
added end-of-recovery SIResetAll().  All branches change the ABI of
extern function PrepareToInvalidateCacheTuple().  No PGXN extension
calls that, and there's no apparent use case in extensions.

Reviewed by Nitin Motiani and (in earlier versions) Andres Freund.

Discussion: https://postgr.es/m/20240523000548.58.nmisch@google.com

Branch
------
REL_16_STABLE

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

Modified Files
--------------
src/backend/access/heap/heapam.c              |  43 +++-
src/backend/access/transam/xact.c             |  26 ++-
src/backend/catalog/index.c                   |  11 +-
src/backend/replication/logical/decode.c      |  26 +--
src/backend/utils/cache/catcache.c            |   7 +-
src/backend/utils/cache/inval.c               | 304 ++++++++++++++++++--------
src/backend/utils/cache/syscache.c            |   3 +-
src/include/utils/catcache.h                  |   3 +-
src/include/utils/inval.h                     |   6 +
src/test/isolation/expected/inplace-inval.out |  10 +-
src/test/isolation/specs/inplace-inval.spec   |  12 +-
src/tools/pgindent/typedefs.list              |   1 +
12 files changed, 320 insertions(+), 132 deletions(-)



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

* pgsql: For inplace update, send nontransactional invalidations.
@ 2025-12-17 00:14  Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Noah Misch @ 2025-12-17 00:14 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

For inplace update, send nontransactional invalidations.

The inplace update survives ROLLBACK.  The inval didn't, so another
backend's DDL could then update the row without incorporating the
inplace update.  In the test this fixes, a mix of CREATE INDEX and ALTER
TABLE resulted in a table with an index, yet relhasindex=f.  That is a
source of index corruption.

Back-patch to v14 - v17.  This is a back-patch of commits:

- 243e9b40f1b2dd09d6e5bf91ebf6e822a2cd3704
  (main change, on master, before v18 branched)
- 0bada39c83a150079567a6e97b1a25a198f30ea3
  (defect fix, on master, before v18 branched)
- bae8ca82fd00603ebafa0658640d6e4dfe20af92
  (cosmetics from post-commit review, on REL_18_STABLE)

It reverses commit c1099dd745b0135960895caa8892a1873ac6cbe5, my revert
of the original back-patch of 243e9b4.

This back-patch omits the non-comment heap_decode() changes.  I find
those changes removed harmless code that was last necessary in v13.  See
discussion thread for details.  The back branches aren't the place to
remove such code.

Like the original back-patch, this doesn't change WAL, because these
branches use end-of-recovery SIResetAll().  All branches change the ABI
of extern function PrepareToInvalidateCacheTuple().  No PGXN extension
calls that, and there's no apparent use case in extensions.  Expect
".abi-compliance-history" edits to follow.

Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Surya Poondla <s_poondla@apple.com>
Reviewed-by: Ilyasov Ian <ianilyasov@outlook.com>
Reviewed-by: Nitin Motiani <nitinmotiani@google.com> (in earlier versions)
Reviewed-by: Andres Freund <andres@anarazel.de> (in earlier versions)
Discussion: https://postgr.es/m/20240523000548.58.nmisch@google.com
Backpatch-through: 14-17

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8114224719401da8e30131310f1a227781cac6eb

Modified Files
--------------
src/backend/access/heap/README.tuplock        |  32 +++
src/backend/access/heap/heapam.c              |  46 ++++-
src/backend/access/transam/xact.c             |  26 ++-
src/backend/catalog/index.c                   |  11 +-
src/backend/replication/logical/decode.c      |  11 +-
src/backend/utils/cache/catcache.c            |   7 +-
src/backend/utils/cache/inval.c               | 277 +++++++++++++++++++-------
src/backend/utils/cache/syscache.c            |   3 +-
src/include/utils/catcache.h                  |   3 +-
src/include/utils/inval.h                     |   6 +
src/test/isolation/expected/inplace-inval.out |  10 +-
src/test/isolation/specs/inplace-inval.spec   |  12 +-
src/tools/pgindent/typedefs.list              |   4 +-
13 files changed, 334 insertions(+), 114 deletions(-)



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

* pgsql: For inplace update, send nontransactional invalidations.
@ 2025-12-17 00:14  Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Noah Misch @ 2025-12-17 00:14 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

For inplace update, send nontransactional invalidations.

The inplace update survives ROLLBACK.  The inval didn't, so another
backend's DDL could then update the row without incorporating the
inplace update.  In the test this fixes, a mix of CREATE INDEX and ALTER
TABLE resulted in a table with an index, yet relhasindex=f.  That is a
source of index corruption.

Back-patch to v14 - v17.  This is a back-patch of commits:

- 243e9b40f1b2dd09d6e5bf91ebf6e822a2cd3704
  (main change, on master, before v18 branched)
- 0bada39c83a150079567a6e97b1a25a198f30ea3
  (defect fix, on master, before v18 branched)
- bae8ca82fd00603ebafa0658640d6e4dfe20af92
  (cosmetics from post-commit review, on REL_18_STABLE)

It reverses commit c1099dd745b0135960895caa8892a1873ac6cbe5, my revert
of the original back-patch of 243e9b4.

This back-patch omits the non-comment heap_decode() changes.  I find
those changes removed harmless code that was last necessary in v13.  See
discussion thread for details.  The back branches aren't the place to
remove such code.

Like the original back-patch, this doesn't change WAL, because these
branches use end-of-recovery SIResetAll().  All branches change the ABI
of extern function PrepareToInvalidateCacheTuple().  No PGXN extension
calls that, and there's no apparent use case in extensions.  Expect
".abi-compliance-history" edits to follow.

Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Surya Poondla <s_poondla@apple.com>
Reviewed-by: Ilyasov Ian <ianilyasov@outlook.com>
Reviewed-by: Nitin Motiani <nitinmotiani@google.com> (in earlier versions)
Reviewed-by: Andres Freund <andres@anarazel.de> (in earlier versions)
Discussion: https://postgr.es/m/20240523000548.58.nmisch@google.com
Backpatch-through: 14-17

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0f69beddea113dd1d6c5b6f6d82df577ef3c21f2

Modified Files
--------------
src/backend/access/heap/README.tuplock        |  32 +++
src/backend/access/heap/heapam.c              |  46 +++-
src/backend/access/transam/xact.c             |  26 ++-
src/backend/catalog/index.c                   |  11 +-
src/backend/commands/event_trigger.c          |   5 -
src/backend/replication/logical/decode.c      |  11 +-
src/backend/utils/cache/catcache.c            |   7 +-
src/backend/utils/cache/inval.c               | 320 +++++++++++++++++++-------
src/backend/utils/cache/syscache.c            |   3 +-
src/include/utils/catcache.h                  |   3 +-
src/include/utils/inval.h                     |   6 +
src/test/isolation/expected/inplace-inval.out |  10 +-
src/test/isolation/specs/inplace-inval.spec   |  12 +-
src/tools/pgindent/typedefs.list              |   1 +
14 files changed, 362 insertions(+), 131 deletions(-)



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

* pgsql: For inplace update, send nontransactional invalidations.
@ 2025-12-17 00:14  Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Noah Misch @ 2025-12-17 00:14 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

For inplace update, send nontransactional invalidations.

The inplace update survives ROLLBACK.  The inval didn't, so another
backend's DDL could then update the row without incorporating the
inplace update.  In the test this fixes, a mix of CREATE INDEX and ALTER
TABLE resulted in a table with an index, yet relhasindex=f.  That is a
source of index corruption.

Back-patch to v14 - v17.  This is a back-patch of commits:

- 243e9b40f1b2dd09d6e5bf91ebf6e822a2cd3704
  (main change, on master, before v18 branched)
- 0bada39c83a150079567a6e97b1a25a198f30ea3
  (defect fix, on master, before v18 branched)
- bae8ca82fd00603ebafa0658640d6e4dfe20af92
  (cosmetics from post-commit review, on REL_18_STABLE)

It reverses commit c1099dd745b0135960895caa8892a1873ac6cbe5, my revert
of the original back-patch of 243e9b4.

This back-patch omits the non-comment heap_decode() changes.  I find
those changes removed harmless code that was last necessary in v13.  See
discussion thread for details.  The back branches aren't the place to
remove such code.

Like the original back-patch, this doesn't change WAL, because these
branches use end-of-recovery SIResetAll().  All branches change the ABI
of extern function PrepareToInvalidateCacheTuple().  No PGXN extension
calls that, and there's no apparent use case in extensions.  Expect
".abi-compliance-history" edits to follow.

Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Surya Poondla <s_poondla@apple.com>
Reviewed-by: Ilyasov Ian <ianilyasov@outlook.com>
Reviewed-by: Nitin Motiani <nitinmotiani@google.com> (in earlier versions)
Reviewed-by: Andres Freund <andres@anarazel.de> (in earlier versions)
Discussion: https://postgr.es/m/20240523000548.58.nmisch@google.com
Backpatch-through: 14-17

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1d7b02711f70f1ae87be562bca11ea2a9c43e85b

Modified Files
--------------
src/backend/access/heap/README.tuplock        |  32 +++
src/backend/access/heap/heapam.c              |  46 +++-
src/backend/access/transam/xact.c             |  26 ++-
src/backend/catalog/index.c                   |  11 +-
src/backend/replication/logical/decode.c      |  11 +-
src/backend/utils/cache/catcache.c            |   7 +-
src/backend/utils/cache/inval.c               | 320 +++++++++++++++++++-------
src/backend/utils/cache/syscache.c            |   3 +-
src/include/utils/catcache.h                  |   3 +-
src/include/utils/inval.h                     |   6 +
src/test/isolation/expected/inplace-inval.out |  10 +-
src/test/isolation/specs/inplace-inval.spec   |  12 +-
src/tools/pgindent/typedefs.list              |   1 +
13 files changed, 362 insertions(+), 126 deletions(-)



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

* pgsql: For inplace update, send nontransactional invalidations.
@ 2025-12-17 00:14  Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 11+ messages in thread

From: Noah Misch @ 2025-12-17 00:14 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

For inplace update, send nontransactional invalidations.

The inplace update survives ROLLBACK.  The inval didn't, so another
backend's DDL could then update the row without incorporating the
inplace update.  In the test this fixes, a mix of CREATE INDEX and ALTER
TABLE resulted in a table with an index, yet relhasindex=f.  That is a
source of index corruption.

Back-patch to v14 - v17.  This is a back-patch of commits:

- 243e9b40f1b2dd09d6e5bf91ebf6e822a2cd3704
  (main change, on master, before v18 branched)
- 0bada39c83a150079567a6e97b1a25a198f30ea3
  (defect fix, on master, before v18 branched)
- bae8ca82fd00603ebafa0658640d6e4dfe20af92
  (cosmetics from post-commit review, on REL_18_STABLE)

It reverses commit c1099dd745b0135960895caa8892a1873ac6cbe5, my revert
of the original back-patch of 243e9b4.

This back-patch omits the non-comment heap_decode() changes.  I find
those changes removed harmless code that was last necessary in v13.  See
discussion thread for details.  The back branches aren't the place to
remove such code.

Like the original back-patch, this doesn't change WAL, because these
branches use end-of-recovery SIResetAll().  All branches change the ABI
of extern function PrepareToInvalidateCacheTuple().  No PGXN extension
calls that, and there's no apparent use case in extensions.  Expect
".abi-compliance-history" edits to follow.

Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Surya Poondla <s_poondla@apple.com>
Reviewed-by: Ilyasov Ian <ianilyasov@outlook.com>
Reviewed-by: Nitin Motiani <nitinmotiani@google.com> (in earlier versions)
Reviewed-by: Andres Freund <andres@anarazel.de> (in earlier versions)
Discussion: https://postgr.es/m/20240523000548.58.nmisch@google.com
Backpatch-through: 14-17

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/05d605b6c69f0276ae091ced1ed9082963052550

Modified Files
--------------
src/backend/access/heap/README.tuplock        |  32 +++
src/backend/access/heap/heapam.c              |  46 +++-
src/backend/access/transam/xact.c             |  26 ++-
src/backend/catalog/index.c                   |  11 +-
src/backend/replication/logical/decode.c      |  11 +-
src/backend/utils/cache/catcache.c            |   7 +-
src/backend/utils/cache/inval.c               | 320 +++++++++++++++++++-------
src/backend/utils/cache/syscache.c            |   3 +-
src/include/utils/catcache.h                  |   3 +-
src/include/utils/inval.h                     |   6 +
src/test/isolation/expected/inplace-inval.out |  10 +-
src/test/isolation/specs/inplace-inval.spec   |  12 +-
src/tools/pgindent/typedefs.list              |   1 +
13 files changed, 362 insertions(+), 126 deletions(-)



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


end of thread, other threads:[~2025-12-17 00:14 UTC | newest]

Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-10-25 13:51 pgsql: For inplace update, send nontransactional invalidations. Noah Misch <noah@leadboat.com>
2024-10-25 13:51 pgsql: For inplace update, send nontransactional invalidations. Noah Misch <noah@leadboat.com>
2024-10-25 13:51 pgsql: For inplace update, send nontransactional invalidations. Noah Misch <noah@leadboat.com>
2024-10-25 13:51 pgsql: For inplace update, send nontransactional invalidations. Noah Misch <noah@leadboat.com>
2024-10-25 13:51 pgsql: For inplace update, send nontransactional invalidations. Noah Misch <noah@leadboat.com>
2024-10-25 13:51 pgsql: For inplace update, send nontransactional invalidations. Noah Misch <noah@leadboat.com>
2024-10-25 13:51 pgsql: For inplace update, send nontransactional invalidations. Noah Misch <noah@leadboat.com>
2025-12-17 00:14 pgsql: For inplace update, send nontransactional invalidations. Noah Misch <noah@leadboat.com>
2025-12-17 00:14 pgsql: For inplace update, send nontransactional invalidations. Noah Misch <noah@leadboat.com>
2025-12-17 00:14 pgsql: For inplace update, send nontransactional invalidations. Noah Misch <noah@leadboat.com>
2025-12-17 00:14 pgsql: For inplace update, send nontransactional invalidations. 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