Re: Enables to call Unregister*XactCallback() in Call*XactCallback()

From: Andres Freund <andres(at)anarazel(dot)de>
To: Hao Wu <gfphoenix78(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Enables to call Unregister*XactCallback() in Call*XactCallback()
Date: 2022-04-03 16:39:23
Message-ID: 20220403163923.zeyslujq6q4aik7u@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2022-03-29 14:48:54 +0800, Hao Wu wrote:
> It's a natural requirement to unregister the callback for transaction or
> subtransaction when the callback is invoked, so we don't have to
> unregister the callback somewhere.

You normally shouldn'd need to do this frequently - what's your use case?
UnregisterXactCallback() is O(N), so workloads registering / unregistering a
lot of callbacks would be problematic.

> Luckily, we just need a few lines of code to support this feature,
> by saving the next pointer before calling the callback.

That seems reasonable...

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joseph Koshakow 2022-04-03 16:44:46 Re: Fix overflow in DecodeInterval
Previous Message Andres Freund 2022-04-03 16:32:56 Re: A qsort template