1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Add wait event type "InjectionPoint", a custom type like "Extension".

Both injection points and customization of type "Extension" are new in
v17, so this just changes a detail of an unreleased feature.

Reported by Robert Haas.  Reviewed by Michael Paquier.

Discussion: https://postgr.es/m/CA+TgmobfMU5pdXP36D5iAwxV5WKE_vuDLtp_1QyH+H5jMMt21g@mail.gmail.com
This commit is contained in:
Noah Misch
2024-06-27 19:21:05 -07:00
parent 0844b39689
commit bb93640a68
13 changed files with 215 additions and 131 deletions

View File

@ -1063,6 +1063,14 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
See <xref linkend="wait-event-extension-table"/>.
</entry>
</row>
<row>
<entry><literal>InjectionPoint</literal></entry>
<entry>The server process is waiting for an injection point to reach an
outcome defined in a test. See
<xref linkend="xfunc-addin-injection-points"/> for more details. This
type has no predefined wait points.
</entry>
</row>
<row>
<entry><literal>IO</literal></entry>
<entry>The server process is waiting for an I/O operation to complete.
@ -1139,8 +1147,8 @@ description | Waiting for a newly initialized WAL file to reach durable storage
<note>
<para>
Extensions can add <literal>Extension</literal> and
<literal>LWLock</literal> events
Extensions can add <literal>Extension</literal>,
<literal>InjectionPoint</literal>. and <literal>LWLock</literal> events
to the lists shown in <xref linkend="wait-event-extension-table"/> and
<xref linkend="wait-event-lwlock-table"/>. In some cases, the name
of an <literal>LWLock</literal> assigned by an extension will not be

View File

@ -3643,7 +3643,11 @@ extern void InjectionPointAttach(const char *name,
static void
custom_injection_callback(const char *name, const void *private_data)
{
uint32 wait_event_info = WaitEventInjectionPointNew(name);
pgstat_report_wait_start(wait_event_info);
elog(NOTICE, "%s: executed custom callback", name);
pgstat_report_wait_end();
}
</programlisting>
This callback prints a message to server error log with severity