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:
parent
77d0ad6c46
commit
c8e318b1b8
@ -3473,8 +3473,8 @@ uint32 WaitEventExtensionNew(const char *wait_event_name)
|
|||||||
=# SELECT wait_event_type, wait_event FROM pg_stat_activity
|
=# SELECT wait_event_type, wait_event FROM pg_stat_activity
|
||||||
WHERE backend_type ~ 'worker_spi';
|
WHERE backend_type ~ 'worker_spi';
|
||||||
wait_event_type | wait_event
|
wait_event_type | wait_event
|
||||||
-----------------+-----------------
|
-----------------+---------------
|
||||||
Extension | worker_spi_main
|
Extension | WorkerSpiMain
|
||||||
(1 row)
|
(1 row)
|
||||||
</screen>
|
</screen>
|
||||||
</para>
|
</para>
|
||||||
|
@ -43,15 +43,15 @@ is($result, qq(total|1), 'dynamic bgworker correctly consumed tuple data');
|
|||||||
$result = $node->poll_query_until(
|
$result = $node->poll_query_until(
|
||||||
'postgres',
|
'postgres',
|
||||||
qq[SELECT wait_event FROM pg_stat_activity WHERE backend_type ~ 'worker_spi';],
|
qq[SELECT wait_event FROM pg_stat_activity WHERE backend_type ~ 'worker_spi';],
|
||||||
qq[worker_spi_main]);
|
qq[WorkerSpiMain]);
|
||||||
is($result, 1,
|
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
|
# Check the wait event used by the dynamic bgworker appears in pg_wait_events
|
||||||
$result = $node->safe_psql('postgres',
|
$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";
|
note "testing bgworkers loaded with shared_preload_libraries";
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ ok( $node->poll_query_until(
|
|||||||
'mydb',
|
'mydb',
|
||||||
qq[SELECT datname, count(datname), wait_event FROM pg_stat_activity
|
qq[SELECT datname, count(datname), wait_event FROM pg_stat_activity
|
||||||
WHERE backend_type = 'worker_spi' GROUP BY datname, wait_event;],
|
WHERE backend_type = 'worker_spi' GROUP BY datname, wait_event;],
|
||||||
'mydb|3|worker_spi_main'),
|
'mydb|3|WorkerSpiMain'),
|
||||||
'bgworkers all launched'
|
'bgworkers all launched'
|
||||||
) or die "Timed out while waiting for bgworkers to be 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
|
qq[SELECT datname, count(datname), wait_event FROM pg_stat_activity
|
||||||
WHERE backend_type = 'worker_spi dynamic' AND
|
WHERE backend_type = 'worker_spi dynamic' AND
|
||||||
pid IN ($worker1_pid, $worker2_pid) GROUP BY datname, wait_event;],
|
pid IN ($worker1_pid, $worker2_pid) GROUP BY datname, wait_event;],
|
||||||
'mydb|2|worker_spi_main'),
|
'mydb|2|WorkerSpiMain'),
|
||||||
'dynamic bgworkers all launched'
|
'dynamic bgworkers all launched'
|
||||||
) or die "Timed out while waiting for dynamic bgworkers to be launched";
|
) or die "Timed out while waiting for dynamic bgworkers to be launched";
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ worker_spi_main(Datum main_arg)
|
|||||||
|
|
||||||
/* First time, allocate or get the custom wait event */
|
/* First time, allocate or get the custom wait event */
|
||||||
if (worker_spi_wait_event_main == 0)
|
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:
|
* Background workers mustn't call usleep() or any direct equivalent:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user