Skip to content

Commit bb93640

Browse files
committed
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
1 parent 0844b39 commit bb93640

File tree

13 files changed

+215
-131
lines changed

13 files changed

+215
-131
lines changed

doc/src/sgml/monitoring.sgml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,14 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
10631063
See <xref linkend="wait-event-extension-table"/>.
10641064
</entry>
10651065
</row>
1066+
<row>
1067+
<entry><literal>InjectionPoint</literal></entry>
1068+
<entry>The server process is waiting for an injection point to reach an
1069+
outcome defined in a test. See
1070+
<xref linkend="xfunc-addin-injection-points"/> for more details. This
1071+
type has no predefined wait points.
1072+
</entry>
1073+
</row>
10661074
<row>
10671075
<entry><literal>IO</literal></entry>
10681076
<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
11391147

11401148
<note>
11411149
<para>
1142-
Extensions can add <literal>Extension</literal> and
1143-
<literal>LWLock</literal> events
1150+
Extensions can add <literal>Extension</literal>,
1151+
<literal>InjectionPoint</literal>. and <literal>LWLock</literal> events
11441152
to the lists shown in <xref linkend="wait-event-extension-table"/> and
11451153
<xref linkend="wait-event-lwlock-table"/>. In some cases, the name
11461154
of an <literal>LWLock</literal> assigned by an extension will not be

doc/src/sgml/xfunc.sgml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3643,7 +3643,11 @@ extern void InjectionPointAttach(const char *name,
36433643
static void
36443644
custom_injection_callback(const char *name, const void *private_data)
36453645
{
3646+
uint32 wait_event_info = WaitEventInjectionPointNew(name);
3647+
3648+
pgstat_report_wait_start(wait_event_info);
36463649
elog(NOTICE, "%s: executed custom callback", name);
3650+
pgstat_report_wait_end();
36473651
}
36483652
</programlisting>
36493653
This callback prints a message to server error log with severity

src/backend/storage/ipc/ipci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ CalculateShmemSize(int *num_semaphores)
149149
size = add_size(size, SyncScanShmemSize());
150150
size = add_size(size, AsyncShmemSize());
151151
size = add_size(size, StatsShmemSize());
152-
size = add_size(size, WaitEventExtensionShmemSize());
152+
size = add_size(size, WaitEventCustomShmemSize());
153153
size = add_size(size, InjectionPointShmemSize());
154154
size = add_size(size, SlotSyncShmemSize());
155155
#ifdef EXEC_BACKEND
@@ -355,7 +355,7 @@ CreateOrAttachShmemStructs(void)
355355
SyncScanShmemInit();
356356
AsyncShmemInit();
357357
StatsShmemInit();
358-
WaitEventExtensionShmemInit();
358+
WaitEventCustomShmemInit();
359359
InjectionPointShmemInit();
360360
}
361361

src/backend/utils/activity/generate-wait_event_types.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,10 @@
181181
foreach my $waitclass (sort { uc($a) cmp uc($b) } keys %hashwe)
182182
{
183183
# Don't generate the pgstat_wait_event.c and wait_event_types.h files
184-
# for Extension, LWLock and Lock, these are handled independently.
184+
# for types handled independently.
185185
next
186186
if ( $waitclass eq 'WaitEventExtension'
187+
|| $waitclass eq 'WaitEventInjectionPoint'
187188
|| $waitclass eq 'WaitEventLWLock'
188189
|| $waitclass eq 'WaitEventLock');
189190

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy