Re: Injection points: some tools to wait and wake

Поиск
Список
Период
Сортировка
От Bertrand Drouvot
Тема Re: Injection points: some tools to wait and wake
Дата
Msg-id ZeV2wHlDjb0uPf+B@ip-10-97-1-34.eu-west-3.compute.internal
обсуждение исходный текст
Ответ на Re: Injection points: some tools to wait and wake  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers
Hi,

On Mon, Mar 04, 2024 at 10:44:34AM +0900, Michael Paquier wrote:
> 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.

Works for me.

> 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(),

Good idea, fully makes sense.

> tweaked a bit its
> internals, and the result looked fine so I have applied it

Thanks!

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



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

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: a wrong index choose when statistics is out of date
Следующее
От: jian he
Дата:
Сообщение: Re: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block