pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Make RelationFlushRelation() work without ResourceOwner during a
Date: Thu, 06 Jun 2024 15:56:59 +0000
Message-ID: <E1sFFU2-000HYh-UL@gemulon.postgresql.org> (raw)

Make RelationFlushRelation() work without ResourceOwner during abort

ReorderBufferImmediateInvalidation() executes invalidation messages in
an aborted transaction. However, RelationFlushRelation sometimes
required a valid resource owner, to temporarily increment the refcount
of the relache entry. Commit b8bff07daa worked around that in the main
subtransaction abort function, AbortSubTransaction(), but missed this
similar case in ReorderBufferImmediateInvalidation().

To fix, introduce a separate function to invalidate a relcache
entry. It does the same thing as RelationClearRelation(rebuild==true)
does when outside a transaction, but can be called without
incrementing the refcount.

Add regression test. Before this fix, it failed with:

ERROR: ResourceOwnerEnlarge called after release started

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://www.postgresql.org/message-id/e56be7d9-14b1-664d-0bfc-00ce9772721c@gmail.com

Branch
------
master

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

Modified Files
--------------
.../test_decoding/expected/decoding_in_xact.out    | 48 +++++++++++++++++++
contrib/test_decoding/sql/decoding_in_xact.sql     | 27 +++++++++++
src/backend/access/transam/xact.c                  | 13 ------
src/backend/utils/cache/relcache.c                 | 54 +++++++++++++++++++---
4 files changed, 122 insertions(+), 20 deletions(-)



Message-ID: <E1sFFU2-000HYh-UL@gemulon.postgresql.org>
Permalink:  ../E1sFFU2-000HYh-UL@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1sFFU2-000HYh-UL@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: heikki.linnakangas@iki.fi, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Make RelationFlushRelation() work without ResourceOwner during a
  In-Reply-To: <E1sFFU2-000HYh-UL@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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