| From: | Rahila Syed <rahilasyed90(at)gmail(dot)com> |
|---|---|
| To: | Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
| Subject: | Removal of ResourceOwnerReleaseAllOfKind function |
| Date: | 2026-09-10 08:39:20 |
| Message-ID: | CAH2L28vVo-Q3Jf+P4huRKxjnbF+2t7OdDh3ZGMxL88hiWezd=A@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
There appears to be a consensus in thread [1] regarding the removal of
the ResourceOwnerReleaseAllOfKind function. It contains errors and is
rarely used, except in a few instances within the plpgsql code.
Furthermore, in those cases, it releases all resources held by the
resource owner instead of releasing resources of a specific kind. It
mainly exists to bypass the three-phase resource release mechanism.
So here is an attempt to add better-designed code to allow releasing
all resources of
a resource owner without using the three phase release mechanism when
it is not needed.
Attached patch adds a new ResourceReleasePhase value,
RESOURCE_RELEASE_AT_ONCE. A ResourceOwnerRelease(owner,
RESOURCE_RELEASE_AT_ONCE, ...) call sorts the owner's resources as
usual, then releases every remaining entry regardless of its
individual release_phase, without breaking out between phases. Leak
warnings are unconditionally suppressed for this phase, since anything
found is by definition meant to be released here, not left behind by
mistake. ResourceOwnerReleaseAllOfKind() is removed, and the plpgsql
call sites each make one ResourceOwnerRelease() call instead of three
phased ones.
A secondary cleanup results from this: `releasing` and `sorted` were
two separate booleans in `ResourceOwnerData` only because
`ResourceOwnerReleaseAllOfKind()` needed to set `releasing` without
sorting. With that function gone, the two flags are always set
together, so they collapse into one flag(releasing).
This approach maintains a single release path via ResourceOwnerRelease
function call and avoids maintaining two separate functions that
perform nearly the same task.
Kindly let me know your views.
[1] https://www.postgresql.org/message-id/flat/646741.1782157515%40sss.pgh.pa.us
Best Regards,
Rahila Syed
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Add-RESOURCE_RELEASE_AT_ONCE-phase-remove-ResourceOw.patch | application/octet-stream | 13.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrey Borodin | 2026-09-10 08:45:31 | Re: SSI: ON CONFLICT DO SELECT takes no predicate lock on the returned row |
| Previous Message | Etsuro Fujita | 2026-09-10 08:39:03 | Re: Further cleanup related to statistics import support in postgres_fdw |