public inbox for [email protected]  
help / color / mirror / Atom feed
From: Michael Paquier <[email protected]>
To: Jeff Davis <[email protected]>
Cc: [email protected]
Subject: Re: injection points for hash aggregation
Date: Tue, 4 Feb 2025 09:21:49 +0900
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On Mon, Feb 03, 2025 at 12:45:24PM -0800, Jeff Davis wrote:
> A couple questions on the injection points framework:
> 
> * The patch allows forcing the partition fan-out to one. I could
> imagine forcing it to a specific value, is there a way to do that?
> 
> * The injection_points extension offers the concept of a "local"
> injection point. While that makes sense for the callback function, it
> doesn't make sense when using the "local_var = 123" style, because that
> will happen regardless of the condition, right?
>
> * Callbacks are given very little context from the injection point
> itself, so it's hard for me to imagine what a callback might do other
> than logging the name of the injection point or waiting (as the
> extension implements). What else would callbacks be good for?

Being able to pass down some runtime states to a callback is something
I've drafted a patch for, as of:
https://www.postgresql.org/message-id/[email protected]

There was no real agreement if this facility was worth having or not,
because there were no use case for it.  Well, perhaps until now based
on what you are saying.

If you want to force a callback to use a specific value or trigger
conditions based on that, you could add your own new callback in the
module injection_points and give it some custom data when attaching
the point, with a SQL function that uses InjectionPointAttach()'s
private_data.  Then you could rely on injection_point_allowed(), for
example, to decide if a callback is run or not.  So it depends on if
you want to use data known when attaching a callback or do something
based on a state given by a backend when it runs an attached callback.

Something worth mentioning.  Heikki and Peter G. have mentioned to me
at the last pgconf.dev that it could be nice to allow files to hold
their own callbacks rather than have an extension do that (don't
recall there is a footprint about that on the lists, that was an
informal offline discussion).  This would have the advantage to limit
the number of code-path-specific callbacks in the injection_points
module (or just limit the number of modules), with callbacks only
existing locally where they are used.  IS_INJECTION_POINT_ATTACHED()
is what I see as a a simplified version of this idea.
--
Michael


Attachments:

  [application/pgp-signature] signature.asc (833B, ../[email protected]/2-signature.asc)
  download

view thread (8+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: injection points for hash aggregation
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox