Re: Injection points: some tools to wait and wake

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Injection points: some tools to wait and wake
Дата
Msg-id ZeUngiC5Wzi_LiYH@paquier.xyz
обсуждение исходный текст
Ответ на Re: Injection points: some tools to wait and wake  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
Ответы Re: Injection points: some tools to wait and wake  (Jelte Fennema-Nio <postgres@jeltef.nl>)
Re: Injection points: some tools to wait and wake  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
Список pgsql-hackers
On Fri, Mar 01, 2024 at 06:52:45AM +0000, Bertrand Drouvot wrote:
> +    if (defined($backend_type))
> +    {
> +        $backend_type = qq('$backend_type');
> +        $die_message = "the backend type $backend_type";
> +    }
> +    else
> +    {
> +        $backend_type = 'backend_type';
> +        $die_message = 'one backend';
> +
> +    }
> +
> +    $self->poll_query_until(
> +        'postgres', qq[
> +        SELECT count(*) > 0 FROM pg_stat_activity
> +        WHERE backend_type = $backend_type AND wait_event = '$injection_name'
> +    ])
> +      or die
> +      qq(timed out waiting for $die_message to wait for the injection point '$injection_name');

I was looking at that, and found v3 to be an overkill.  First, I think
that we should encourage callers to pass down a backend_type.  Perhaps
I am wrong to assume so, but that's based on my catalog of tests
waiting in my stack.

A second thing is that this is entirely unrelated to injection points,
because a test may want to wait for a given wait_event on a
backend_type without using the module injection_points.  At the end, I
have renamed the routine to wait_for_event(), tweaked a bit its
internals, and the result looked fine so I have applied it while
updating 041_checkpoint_at_promote.pl to use it.  Its internals could
always be expanded more depending on the demand for it.
--
Michael

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Introduce XID age and inactive timeout based replication slot invalidation
Следующее
От: David Rowley
Дата:
Сообщение: Re: Support boolcol IS [NOT] iso-8859-1 in partition pruning