From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Noah Misch <noah(at)leadboat(dot)com> |
Cc: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Injection point locking |
Date: | 2024-06-26 01:56:12 |
Message-ID: | Znt1PO_ceVserr-W@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Jun 25, 2024 at 09:10:06AM -0700, Noah Misch wrote:
> I think your last sentence is what Heikki is saying should happen, and I
> agree. Yes, it matters. As written, InjectionPointRun() could cache an
> entry_by_name->function belonging to a different injection point.
That's true, we could delay the release of the lock to happen just
before a callback is run.
Now, how much do people wish to see for the postmaster bits mentioned
upthread? Taking a spinlock for so long is not going to work, so we
could just remove it and let developers deal with that and feed on the
flexibility with the lock removal to allow this stuff in more areas.
All the existing tests are OK with that, and I think that also the
case of what you have proposed for the concurrency issues with
in-place updates of catalogs. Or we could live with a no-lock path
when going through that with the postmaster, but that's a bit weird.
Note that with the current callbacks in the module, assuming that a
point is added within BackendStartup() in the postmaster like the
attached, an ERROR is promoted to a FATAL, taking down the cluster. A
NOTICE of course works find. Waits with conditional variables are not
really OK. How much are you looking for here?
The shmem state being initialized in the DSM registry is not something
that's going to work in the context of the postmaster, but we could
tweak the module so as it can be loaded, initializing the shared state
with the shmem hooks and falling back to a DSM registry when the
library is not loaded with shared_preload_libraries. For example, see
the POC attached, where I've played with injection points in
BackendStartup(), which is the area I'm guessing Heikki was looking
at.
--
Michael
Attachment | Content-Type | Size |
---|---|---|
0001-Extend-injection-points-to-work-within-a-postmaster-.patch | text/x-diff | 8.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Smith | 2024-06-26 02:36:07 | Re: Pgoutput not capturing the generated columns |
Previous Message | Bruce Momjian | 2024-06-26 01:54:37 | Re: psql (PostgreSQL) 17beta2 (Debian 17~beta2-1.pgdg+~20240625.1534.g23c5a0e) Failed to retrieve data from the server.. |