diff options
author | Heikki Linnakangas | 2024-06-06 15:56:28 +0000 |
---|---|---|
committer | Heikki Linnakangas | 2024-06-06 15:56:28 +0000 |
commit | e6cd85772647099563da5ada53bd6ab7d096ce00 (patch) | |
tree | b0f9135f14ac914e5d2621b37ce052896f4e6413 /src/backend/access/transam/xact.c | |
parent | 505c008ca37c4f6f2fffcde370b5d8354c4d4dc3 (diff) |
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 <[email protected]>
Discussion: https://www.postgresql.org/message-id/[email protected]
Diffstat (limited to 'src/backend/access/transam/xact.c')
-rw-r--r-- | src/backend/access/transam/xact.c | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 4f4ce757623..9bda1aa6bc6 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -5279,20 +5279,7 @@ AbortSubTransaction(void) AtEOSubXact_RelationCache(false, s->subTransactionId, s->parent->subTransactionId); - - - /* - * AtEOSubXact_Inval sometimes needs to temporarily bump the refcount - * on the relcache entries that it processes. We cannot use the - * subtransaction's resource owner anymore, because we've already - * started releasing it. But we can use the parent resource owner. - */ - CurrentResourceOwner = s->parent->curTransactionOwner; - AtEOSubXact_Inval(false); - - CurrentResourceOwner = s->curTransactionOwner; - ResourceOwnerRelease(s->curTransactionOwner, RESOURCE_RELEASE_LOCKS, false, false); |