pgsql: Don't destroy SMgrRelations at relcache invalidation

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Don't destroy SMgrRelations at relcache invalidation
Date: 2024-03-11 07:09:34
Message-ID: E1rjZmw-003BJJ-7C@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Don't destroy SMgrRelations at relcache invalidation

With commit 21d9c3ee4e, SMgrRelations remain valid until end of
transaction (or longer if they're "pinned"). Relcache invalidation can
happen in the middle of a transaction, so we must not destroy them at
relcache invalidation anymore.

This was revealed by failures in the 'constraints' test in buildfarm
animals using -DCLOBBER_CACHE_ALWAYS. That started failing with commit
8af2565248, which was the first commit that started to rely on an
SMgrRelation living until end of transaction.

Diagnosed-by: Tomas Vondra, Thomas Munro
Reviewed-by: Thomas Munro
Discussion: https://www.postgresql.org/message-id/CA%2BhUKGK%2B5DOmLaBp3Z7C4S-Yv6yoROvr1UncjH2S1ZbPT8D%2BZg%40mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/storage/smgr/smgr.c | 2 --
src/backend/utils/cache/relcache.c | 10 +++-------
2 files changed, 3 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2024-03-11 09:20:47 pgsql: Set all_visible_according_to_vm correctly with DISABLE_PAGE_SKIP
Previous Message David Rowley 2024-03-11 05:22:02 pgsql: Fix incorrect accessing of pfree'd memory in Memoize