pgsql: Make RelationFlushRelation() work without ResourceOwner during a - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Make RelationFlushRelation() work without ResourceOwner during a
Date
Msg-id E1sFFU2-000HYh-UL@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Alexander Korotkov
Date:
Subject: pgsql: Restore preprocess_groupclause()
Next
From: Tom Lane
Date:
Subject: pgsql: Fix failure with SQL-procedure polymorphic output arguments in v