Re: Restart pg_usleep when interrupted

Поиск
Список
Период
Сортировка
От Bertrand Drouvot
Тема Re: Restart pg_usleep when interrupted
Дата
Msg-id ZqNd7WfTm3sUCpjy@ip-10-97-1-34.eu-west-3.compute.internal
обсуждение исходный текст
Ответ на Re: Restart pg_usleep when interrupted  (Sami Imseih <samimseih@gmail.com>)
Список pgsql-hackers
Hi,

On Thu, Jul 25, 2024 at 05:27:15PM -0500, Sami Imseih wrote:
> I am attaching v3 of the patch which addresses the comments made
> earlier by Bertrand about the comment in the patch [1].

Thanks!

Looking at it:

1 ===

+       struct instr_time start_time;

I think we can get rid of the "struct" keyword here.

2 ===

+           struct instr_time current_time;
+           struct instr_time elapsed_time;

Same as above.

3 ===

I gave more thoughts and I think it can be simplified a bit to reduce the
number of operations in the while loop.

What about relying on a "absolute" time that way:

    instr_time absolute;
    absolute.ticks = start_time.ticks + msec * 1000000;

and then in the while loop:

    while (nanosleep(&delay, &remain) == -1 && errno == EINTR)
    {
        instr_time current_time;
        INSTR_TIME_SET_CURRENT(current_time);

        if (current_time.ticks > absolute.ticks)
        {
            break;

Regards,

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



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

Предыдущее
От: Michał Kłeczek
Дата:
Сообщение: Re: DRAFT: Pass sk_attno to consistent function
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: [BUG] Fix DETACH with FK pointing to a partitioned table fails