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
This commit is contained in:
Michael Paquier 2023-10-04 16:16:50 +09:00
parent 77d0ad6c46
commit c8e318b1b8
3 changed files with 10 additions and 10 deletions

View File

@ -3472,9 +3472,9 @@ uint32 WaitEventExtensionNew(const char *wait_event_name)
<screen>
=# SELECT wait_event_type, wait_event FROM pg_stat_activity
WHERE backend_type ~ 'worker_spi';
wait_event_type | wait_event
-----------------+-----------------
Extension | worker_spi_main
wait_event_type | wait_event
-----------------+---------------
Extension | WorkerSpiMain
(1 row)
</screen>
</para>

View File

@ -43,15 +43,15 @@ is($result, qq(total|1), 'dynamic bgworker correctly consumed tuple data');
$result = $node->poll_query_until(
'postgres',
qq[SELECT wait_event FROM pg_stat_activity WHERE backend_type ~ 'worker_spi';],
qq[worker_spi_main]);
qq[WorkerSpiMain]);
is($result, 1,
'dynamic bgworker has reported "worker_spi_main" as wait event');
'dynamic bgworker has reported "WorkerSpiMain" as wait event');
# Check the wait event used by the dynamic bgworker appears in pg_wait_events
$result = $node->safe_psql('postgres',
q[SELECT count(*) > 0 from pg_wait_events where type = 'Extension' and name = 'worker_spi_main';]
q[SELECT count(*) > 0 from pg_wait_events where type = 'Extension' and name = 'WorkerSpiMain';]
);
is($result, 't', '"worker_spi_main" is reported in pg_wait_events');
is($result, 't', '"WorkerSpiMain" is reported in pg_wait_events');
note "testing bgworkers loaded with shared_preload_libraries";
@ -74,7 +74,7 @@ ok( $node->poll_query_until(
'mydb',
qq[SELECT datname, count(datname), wait_event FROM pg_stat_activity
WHERE backend_type = 'worker_spi' GROUP BY datname, wait_event;],
'mydb|3|worker_spi_main'),
'mydb|3|WorkerSpiMain'),
'bgworkers all launched'
) or die "Timed out while waiting for bgworkers to be launched";
@ -89,7 +89,7 @@ ok( $node->poll_query_until(
qq[SELECT datname, count(datname), wait_event FROM pg_stat_activity
WHERE backend_type = 'worker_spi dynamic' AND
pid IN ($worker1_pid, $worker2_pid) GROUP BY datname, wait_event;],
'mydb|2|worker_spi_main'),
'mydb|2|WorkerSpiMain'),
'dynamic bgworkers all launched'
) or die "Timed out while waiting for dynamic bgworkers to be launched";

View File

@ -194,7 +194,7 @@ worker_spi_main(Datum main_arg)
/* First time, allocate or get the custom wait event */
if (worker_spi_wait_event_main == 0)
worker_spi_wait_event_main = WaitEventExtensionNew("worker_spi_main");
worker_spi_wait_event_main = WaitEventExtensionNew("WorkerSpiMain");
/*
* Background workers mustn't call usleep() or any direct equivalent: