pgsql: Fix inplace update buffer self-deadlock.

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix inplace update buffer self-deadlock.
Date: 2024-11-02 16:08:47
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix inplace update buffer self-deadlock.

A CacheInvalidateHeapTuple* callee might call
CatalogCacheInitializeCache(), which needs a relcache entry. Acquiring
a valid relcache entry might scan pg_class. Hence, to prevent
undetected LWLock self-deadlock, CacheInvalidateHeapTuple* callers must
not hold BUFFER_LOCK_EXCLUSIVE on buffers of pg_class. Move the
CacheInvalidateHeapTupleInplace() before the BUFFER_LOCK_EXCLUSIVE. No
back-patch, since I've reverted commit
243e9b40f1b2dd09d6e5bf91ebf6e822a2cd3704 from non-master branches.

Reported by Alexander Lakhin. Reviewed by Alexander Lakhin.

Discussion: https://postgr.es/m/[email protected]

Branch
------
master

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

Modified Files
--------------
src/backend/access/heap/heapam.c | 21 +++++++++++++--------
src/backend/utils/cache/inval.c | 12 ++++++++++++
src/include/utils/inval.h | 1 +
3 files changed, 26 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2024-11-03 02:32:56 Re: pgsql: Move I/O before the index_update_stats() buffer lock region.
Previous Message Bruce Momjian 2024-11-01 20:38:44 pgsql: doc: clarify text around MVCC example query