Re: Remove condition variables from injection wait logic.

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>
Subject: Re: Remove condition variables from injection wait logic.
Date: 2025-08-20 23:02:14
Message-ID: aKZT9vGMvcIWzMPS@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 20, 2025 at 11:20:11AM +0500, Kirill Reshke wrote:
> $sub proposed in a nearby thread. Looks like we have a consensus that
> $subj is beneficial.
> I implemented necessary legwork, namely a clock-based check in the
> wait() routine, PFA. I'm not sure the default pg_sleep argument of 50
> millisecond is good, but it is fast enough to not spot any difference
> in by-hand testing.

I may be missing something, but I don't think that we have reached a
consensus yet. There is the argument of AIO and being able to
broadcast writes.

+ pgstat_report_wait_start(injection_wait_event);
+#define DEFAULT_INJ_POINT_SLEEP_MICROSEC 50000L /* 50 milliseconds */
+ pg_usleep(DEFAULT_INJ_POINT_SLEEP_MICROSEC);

I would not object to that if that's the actual consensus as we don't
have a strong requirement for condition variables when it comes to
testing. That's just a more efficient implementation, and it makes
the tests faster. If we do that, I'd suggest to choose a cap and a
variable wait time, that increases across iterations to still make the
wait more responsive on faster machines.

Your patch lacks a pgstat_report_wait_end().
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kirk Wolak 2025-08-20 23:03:47 Re: date_trunc function in interval version
Previous Message Michael Paquier 2025-08-20 22:55:36 Re: Add GUC to enable libxml2's XML_PARSE_HUGE