pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: injection_points: Add initialization of shmem state when loading
Date: Fri, 23 Aug 2024 01:13:10 +0000
Message-ID: <E1shIrW-00115t-2E@gemulon.postgresql.org> (raw)

injection_points: Add initialization of shmem state when loading module

This commits adds callbacks to initialize the shared memory state of the
module when loaded with shared_preload_libraries.  This is necessary to
be able to update the test introduced in 768a9fd5535f to use the macros
INJECTION_POINT_{LOAD,CACHED}() rather than a SQL function in the module
injection_points forcing a load, as this test runs a callback in a
critical section where no memory allocation should happen.

Initializing the shared memory state of the module while loading
provides a strict control on the timing of its allocation.  If the
module is not loaded at startup, it will use a GetNamedDSMSegment()
instead to initialize its shmem state on-the-fly.

Per discussion with Álvaro Herrera.

Author: Michael Paquier
Discussion: https://postgr.es/m/ZsUnJUlSOBNAzwW1@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b2b023aa3706ec6b3978708545301f7436205c6d

Modified Files
--------------
.../modules/injection_points/injection_points.c    | 62 ++++++++++++++++++++--
1 file changed, 59 insertions(+), 3 deletions(-)



Message-ID: <E1shIrW-00115t-2E@gemulon.postgresql.org>
Permalink:  ../E1shIrW-00115t-2E@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1shIrW-00115t-2E@gemulon.postgresql.org

 · 

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: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: injection_points: Add initialization of shmem state when loading
  In-Reply-To: <E1shIrW-00115t-2E@gemulon.postgresql.org>

* 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