Skip to content

Commit c8e318b

Browse files
committed
worker_spi: Rename custom wait event to "WorkerSpiMain"
This naming is more consistent with all the other user-facing wait event strings. Other in-core modules will use the same naming convention, so let's be consistent here as well. Extracted from a larger patch by the same author. Author: Masahiro Ikeda Discussion: https://postgr.es/m/197bce267fa691a0ac62c86c4ab904c4@oss.nttdata.com
1 parent 77d0ad6 commit c8e318b

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

doc/src/sgml/xfunc.sgml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3472,9 +3472,9 @@ uint32 WaitEventExtensionNew(const char *wait_event_name)
34723472
<screen>
34733473
=# SELECT wait_event_type, wait_event FROM pg_stat_activity
34743474
WHERE backend_type ~ 'worker_spi';
3475-
wait_event_type | wait_event
3476-
-----------------+-----------------
3477-
Extension | worker_spi_main
3475+
wait_event_type | wait_event
3476+
-----------------+---------------
3477+
Extension | WorkerSpiMain
34783478
(1 row)
34793479
</screen>
34803480
</para>

src/test/modules/worker_spi/t/001_worker_spi.pl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@
4343
$result = $node->poll_query_until(
4444
'postgres',
4545
qq[SELECT wait_event FROM pg_stat_activity WHERE backend_type ~ 'worker_spi';],
46-
qq[worker_spi_main]);
46+
qq[WorkerSpiMain]);
4747
is($result, 1,
48-
'dynamic bgworker has reported "worker_spi_main" as wait event');
48+
'dynamic bgworker has reported "WorkerSpiMain" as wait event');
4949

5050
# Check the wait event used by the dynamic bgworker appears in pg_wait_events
5151
$result = $node->safe_psql('postgres',
52-
q[SELECT count(*) > 0 from pg_wait_events where type = 'Extension' and name = 'worker_spi_main';]
52+
q[SELECT count(*) > 0 from pg_wait_events where type = 'Extension' and name = 'WorkerSpiMain';]
5353
);
54-
is($result, 't', '"worker_spi_main" is reported in pg_wait_events');
54+
is($result, 't', '"WorkerSpiMain" is reported in pg_wait_events');
5555

5656
note "testing bgworkers loaded with shared_preload_libraries";
5757

@@ -74,7 +74,7 @@
7474
'mydb',
7575
qq[SELECT datname, count(datname), wait_event FROM pg_stat_activity
7676
WHERE backend_type = 'worker_spi' GROUP BY datname, wait_event;],
77-
'mydb|3|worker_spi_main'),
77+
'mydb|3|WorkerSpiMain'),
7878
'bgworkers all launched'
7979
) or die "Timed out while waiting for bgworkers to be launched";
8080

@@ -89,7 +89,7 @@
8989
qq[SELECT datname, count(datname), wait_event FROM pg_stat_activity
9090
WHERE backend_type = 'worker_spi dynamic' AND
9191
pid IN ($worker1_pid, $worker2_pid) GROUP BY datname, wait_event;],
92-
'mydb|2|worker_spi_main'),
92+
'mydb|2|WorkerSpiMain'),
9393
'dynamic bgworkers all launched'
9494
) or die "Timed out while waiting for dynamic bgworkers to be launched";
9595

src/test/modules/worker_spi/worker_spi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ worker_spi_main(Datum main_arg)
194194

195195
/* First time, allocate or get the custom wait event */
196196
if (worker_spi_wait_event_main == 0)
197-
worker_spi_wait_event_main = WaitEventExtensionNew("worker_spi_main");
197+
worker_spi_wait_event_main = WaitEventExtensionNew("WorkerSpiMain");
198198

199199
/*
200200
* Background workers mustn't call usleep() or any direct equivalent:

0 commit comments

Comments
 (0)