Re: Fix unsafe coding in ResourceOwnerReleaseAll()

From: Rahila Syed <rahilasyed90(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Fix unsafe coding in ResourceOwnerReleaseAll()
Date: 2026-08-27 17:52:51
Message-ID: CAH2L28sLsqA-Se5E-bw-4o0YwF4-aA_S-kew2d9Jh1ADO-QtFA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

> +1 for having a function that just releases all resources in a resource
> owner in one call. I don't think it's performance critical so it could
> just call ResourceOwnerRelease() three times.
> ReleaseAuxProcessResources() could make use of it too.
>

Thank you for the feedback. I am working on a patch for this and will
post it soon.

>
> > Removing ResourceOwnerReleaseAllOfKind will also help get rid of one
> > of the flags "releasing" or "sorted" in ResourceOwnerData.
>
> You still need those flags when you release in phases. I don't see us
> getting rid of the three phases in the usual transaction-scoped resource
> owners any time soon, even if some resource owners don't need them.
>

We do need one of these flags, but not both, for phased release to work.
I don't see any occurrence of these flags where one is true and the
other is false
except for the ResourceOwnerReleaseAllOfKind() function.
Both flags are set simultaneously when entering the release phase.

The following comment in ResourceOwnerData also shows that we have
separate flags only
due to the ResourceOwnerReleaseAllOfKind() function.

* We have separate flags because
* ResourceOwnerReleaseAllOfKind() temporarily sets 'releasing' without
* sorting the arrays.

Thank you,
Rahila Syed

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2026-08-27 17:56:29 Re: pg_upgrade silently truncates nextMultiOffset to 32 bits
Previous Message Masahiko Sawada 2026-08-27 17:25:31 Re: pg_upgrade silently truncates nextMultiOffset to 32 bits