postgresql/src/test/modules/injection_points
Michael Paquier 267d41dc4f 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
33181b48fd 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
2024-05-12 19:42:26 +09:00
..
expected Introduce private data area for injection points 2024-05-12 18:53:06 +09:00
sql injection_points: Fix race condition with local injection point tests 2024-04-09 10:31:12 +09:00
.gitignore Add test module injection_points 2024-01-22 13:32:28 +09:00
injection_points--1.0.sql injection_points: Introduce runtime conditions 2024-04-08 09:47:50 +09:00
injection_points.c injection_points: Store runtime conditions in private area 2024-05-12 19:42:26 +09:00
injection_points.control Add test module injection_points 2024-01-22 13:32:28 +09:00
Makefile injection_points: Fix race condition with local injection point tests 2024-04-09 10:31:12 +09:00
meson.build injection_points: Fix race condition with local injection point tests 2024-04-09 10:31:12 +09:00