pgsql: For inplace update, send nontransactional invalidations.

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: For inplace update, send nontransactional invalidations.
Date: 2024-10-25 13:51:48
Message-ID: E1t4KjF-002OMV-1v@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Melanie Plageman 2024-10-25 14:22:10 pgsql: Move EXPLAIN counter increment to heapam_scan_bitmap_next_block
Previous Message Daniel Gustafsson 2024-10-25 12:14:51 pgsql: doc: Fix typo in pg_restore_*_stats function documentation