Re: Restart pg_usleep when interrupted - Mailing list pgsql-hackers

From Sami Imseih
Subject Re: Restart pg_usleep when interrupted
Date
Msg-id 3712E898-03DA-4E03-AF51-D3E24DE68216@gmail.com
Whole thread Raw
In response to Re: Restart pg_usleep when interrupted  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
Responses Re: Restart pg_usleep when interrupted
Re: Restart pg_usleep when interrupted
List pgsql-hackers

I did a few tests with the patch and did not see any "large" drifts like the
ones observed above.

Thanks for testing.

I think it could be "simplified" by making use of instr_time instead of timespec
for current and absolute. Then I think it would be enough to compare their
ticks.

Correct I attached a v2 of this patch that uses instr_time to check the elapsed
time and break out of the loop. It needs some more benchmarking.

Since sub-millisecond sleep times are not guaranteed as suggested by
the vacuum_cost_delay docs ( see below ), an alternative idea
is to use clock_nanosleep for vacuum delay when it’s available, else
fallback to WaitLatch.

Wouldn't that increase even more the cases where sub-millisecond won't be
guaranteed?

Yes, nanosleep is going to provide the most coverage as it’s widely available.

Regards,


Sami

Attachment

pgsql-hackers by date:

Previous
From: "cca5507"
Date:
Subject: Re: Redundant syscache access in get_rel_sync_entry()
Next
From: Sami Imseih
Date:
Subject: Re: Restart pg_usleep when interrupted