Re: Adding facility for injection points (or probe points?) for more advanced tests
Alvaro Herrera <alvherre@alvh.no-ip.org>
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Michael Paquier <michael@paquier.xyz>
Cc: Andres Freund <andres@anarazel.de>, Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-11-14T13:11:50Z
Lists: pgsql-hackers
Hello, Good stuff here, I also have a bunch of bugfix commits that ended up not having a test because of the need for a debugger or other interaction, so let's move forward. I think the docs (and the macro/function naming) describe things backwards. In my mind, it is INJECTION_POINT_RUN() that creates the injection point; then InjectionPointCreate() attaches something to it. So I would rename the macro to just INJECTION_POINT() and the function to InjectionPointAttach(). This way you're saying "attach function FN from library L to the injection point P"; where P is an entity that is being created by the INJECTION_POINT() call in the code. You named the hash table InjectionPointHashByName, which seems weird. Is there any *other* way to locate an injection point that is not by name? In this patch, injection points are instance-wide (because the hash table is in shmem). As soon as you install a callback to one point, that callback will be fired in every session. Maybe for some tests this is OK (and in particular your TAP tests have them attached in one ->safe_psql call and then they hit a completely different session, which wouldn't work if the attachments were process-local), but maybe one would want them limited to some specific process. Maybe give an optional PID so that if any other process hits that injection point, nothing happens? -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "La rebeldía es la virtud original del hombre" (Arthur Schopenhauer)
Commits
-
ci: Enable injection points in builds
- 183b6f73b04e 17.0 landed
-
Fix two memcpy() bugs in the new injection point code
- 0eb23285a257 17.0 landed
-
Add test module injection_points
- 49cd2b93d7db 17.0 landed
-
Add backend support for injection points
- d86d20f0ba79 17.0 landed
-
Refactor code checking for file existence
- e72a37528dda 17.0 landed