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-09-11 09:05:34
Message-ID: CAH2L28tZ4sR-N41NXzgG3dbmygDTcOyCZDtjEmnMiU_zE0khtw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

> 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.
>

While I agree that calling ResourceOwnerRelease() three times results
in a patch with minimal changes to existing logic, I think it is worth avoiding
the unneces calls to simplify the code.

Hence, I added another phase to the ResourceReleasePhase which
bypasses the phased release in the existing
ResourceOwnerRelease function. This allows us to maintain the existing function
signature for both phased and non-phased resource release.
This is similar to what NoLock does in the case of LOCKMODE.

A separate thread for this discussion with a patch has been started
here [1] as it
has branched off from the original proposal in this thread.

[1] https://www.postgresql.org/message-id/CAH2L28vVo-Q3Jf%2BP4huRKxjnbF%2B2t7OdDh3ZGMxL88hiWezd%3DA%40mail.gmail.com

Thank you,
Rahila Syed

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2026-09-11 09:05:38 Re: REPACK (CONCURRENTLY) fails when replica identity index is dropped
Previous Message Álvaro Herrera 2026-09-11 09:03:14 Re: Race conditions in logical decoding