Question about resource owners

From: pgsql(at)j-davis(dot)com
To: pgsql-hackers(at)postgresql(dot)org
Subject: Question about resource owners
Date: 2018-10-10 18:31:35
Message-ID: 2dbf65d9c7464b0e06a0caa84d60bef5efaa56f4.camel@j-davis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2018-10-10 19:50:02 Re: file cloning in pg_upgrade and CREATE DATABASE
Previous Message Tom Lane 2018-10-10 18:30:18 Re: Requesting advanced Group By support