Обсуждение: Question about resource owners

Поиск
Список
Период
Сортировка

Question about resource owners

От
pgsql@j-davis.com
Дата:
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