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: Store runtime conditions in private area
Date: Sun, 12 May 2024 10:45:23 +0000
Message-ID: <E1s66hm-000d2b-Au@gemulon.postgresql.org> (raw)

injection_points: Store runtime conditions in private area

This commit fixes a race condition between injection point run and
detach, where a point detached by a backend and concurrently running in
a second backend could cause the second backend to do an incorrect
condition check.  This issue happens because the second backend
retrieves the callback information in a first step in the shmem hash
table for injection points, and the condition in a second step within
the callback.  If the point is detached between these two steps, the
condition would be removed, causing the point to run while it should
not.  Storing the condition in the new private_data area introduced in
33181b48fd0e ensures that the condition retrieved is consistent with its
callback.

This commit leads to a lot of simplifications in the module
injection_points, as there is no need to handle the runtime conditions
inside it anymore.  Runtime conditions have no more a maximum number.

Per discussion with Noah Misch.

Reviewed-by: Noah Misch
Discussion: https://postgr.es/m/20240509031553.47@rfd.leadboat.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/267d41dc4f4184525353db4069709cfb3df02ceb

Modified Files
--------------
.../modules/injection_points/injection_points.c    | 173 +++++++--------------
src/tools/pgindent/typedefs.list                   |   1 +
2 files changed, 61 insertions(+), 113 deletions(-)



Message-ID: <E1s66hm-000d2b-Au@gemulon.postgresql.org>
Permalink:  ../E1s66hm-000d2b-Au@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1s66hm-000d2b-Au@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: Store runtime conditions in private area
  In-Reply-To: <E1s66hm-000d2b-Au@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