Question about resource owners - Mailing list pgsql-hackers

From pgsql@j-davis.com
Subject Question about resource owners
Date
Msg-id 2dbf65d9c7464b0e06a0caa84d60bef5efaa56f4.camel@j-davis.com
Whole thread Raw
List pgsql-hackers
The way we handle resource owners seems a bit inconsistent.

* Transactions always have a resource owner (hierarchical for
subtransactions).

* Portals have resource owners where the parent is the transaction's
resource owner.

* Some auxiliary processes have one, but if that process were to
start/end transactions, it would clobber CurrentResourceOwner and it
would just be left with AuxProcessResourceOwner.

* It doesn't seem like a custom background worker process can make use
of resource owners in all cases, because the cleanup after sigsetjmp
doesn't release them unless it's attached to shared memory (which might
ordinarily be the case, but I don't know why we'd assume that).

Why don't we just use a hierarchy of resource owners, so that there's
always a TopResourceOwner and a non-NULL CurrentResourceOwner in every
process? If we don't expect some particular process to hold resources
there, we can emit a WARNING.

Regards,
    Jeff Davis




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Requesting advanced Group By support
Next
From: Bruce Momjian
Date:
Subject: Re: file cloning in pg_upgrade and CREATE DATABASE