From: Michael Paquier <michael@paquier.xyz>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Andrey M. Borodin <x4mmm@yandex-team.ru>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Injection points: preloading and runtime arguments
Date: Wed, 10 Jul 2024 13:16:15 +0900
Message-ID: <Zo4LD044_H9aSLqQ@paquier.xyz> (raw)
In-Reply-To: <58d588d0-e63f-432f-9181-bed29313dece@iki.fi>
References: <BF05D322-C71D-432C-8029-8315BEABA5A1@yandex-team.ru>
<Zkv5XJci7e2jbyvk@paquier.xyz>
<B0FAFD52-FB9F-452B-A370-25C69A397FA7@yandex-team.ru>
<Zl-asNW0NUYd_MuF@paquier.xyz>
<F5CA5FD7-4731-4663-8A05-8B641CF11CA6@yandex-team.ru>
<ZmJIhkc73nvFNEUS@paquier.xyz>
<9ED3A789-0516-4781-87C1-5BF966D681EE@yandex-team.ru>
<ZmaY2W_ZWHlma2Ln@paquier.xyz>
<Zoe54pHExN-USTpy@paquier.xyz>
<58d588d0-e63f-432f-9181-bed29313dece@iki.fi>
On Tue, Jul 09, 2024 at 12:08:26PM +0300, Heikki Linnakangas wrote:
> And the injection point is attached in between the INJECTION_POINT_LOAD()
> and INJECTION_POINT() calls, you will still get an assertion failure. For a
> testing facility, maybe that's acceptable, but it could be fixed pretty
> easily.
>
> I propose we introduce an INJECTION_POINT_CACHED(name) macro that *only*
> uses the local cache.
You mean with something that does a injection_point_cache_get()
followed by a callback run if anything is found in the local cache?
Why not. Based on what you have posted at [1], it looks like this had
better check the contents of the cache's generation with what's in
shmem, as well as destroying InjectionPointCache if there is nothing
else, so there's a possible dependency here depending on how much
maintenance this should do with the cache to keep it consistent.
> We could then also add an assertion in
> InjectionPointRun() to check that it's not used in a critical section, to
> enforce correct usage.
That would be the same as what we do currently with a palloc() coming
from load_external_function() or hash_create(), whichever comes first.
Okay, the stack reported is deeper in this case.
[1]: https://www.postgresql.org/message-id/87c748b3-0786-490f-a17a-51bef63e6c7f@iki.fi
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
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: pgsql-hackers@postgresql.org
Cc: michael@paquier.xyz, hlinnaka@iki.fi, x4mmm@yandex-team.ru, alvherre@alvh.no-ip.org, pgsql-hackers@lists.postgresql.org
Subject: Re: Injection points: preloading and runtime arguments
In-Reply-To: <Zo4LD044_H9aSLqQ@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox