pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sami Imseih <samimseih@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Restart pg_usleep when interrupted
Date: Fri, 28 Jun 2024 17:50:20 -0500
Message-ID: <AC328D21-21D6-4FFC-8F6B-BFE9AD940524@gmail.com> (raw)
In-Reply-To: <2100439.1719610468@sss.pgh.pa.us>
References: <152895F3-6B22-45ED-8038-9E14A72AAC88@amazon.com>
	<01000190606e3d2a-116ead16-84d2-4449-8d18-5053da66b1f4-000000@email.amazonses.com>
	<CA+TgmobMqV95Zj2906s4_dtS2_JKqG-6ogKHGdiH+y3rar9NCA@mail.gmail.com>
	<7D50DC5B-80C6-47B5-8DA8-A6C68A115EE5@gmail.com>
	<2100439.1719610468@sss.pgh.pa.us>


Thanks for the feedback!

> On Jun 28, 2024, at 4:34 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 
> Sami Imseih <samimseih@gmail.com> writes:
>> Reattaching the patch.
> 
> I feel like this is fundamentally a wrong solution, for the reasons
> cited in the comment for pg_usleep: long sleeps are a bad idea
> because of the resulting uncertainty about whether we'll respond to
> interrupts and such promptly.  An example here is that if we get
> a query cancel interrupt, we should probably not insist on finishing
> out the current sleep before responding.

The case which brought up this discussion is the pg_usleep that 
is called within the vacuum_delay_point being interrupted. 

When I read the same code comment you cited, it sounded to me 
that “long sleeps” are those that are in seconds or minutes. The longest 
vacuum delay allowed is 100ms.


> Therefore, rather than "improving" pg_usleep (and uglifying its API),
> the right answer is to fix parallel vacuum leaders to not depend on
> pg_usleep in the first place.  A better idea might be to use
> pg_sleep() or equivalent code.

Yes, that is a good idea to explore and it will not require introducing
an awkward new API. I will look into using something similar to
pg_sleep.

Regards,

Sami

view thread (73+ messages)  latest in thread

Message-ID: <AC328D21-21D6-4FFC-8F6B-BFE9AD940524@gmail.com>
Permalink:  ../AC328D21-21D6-4FFC-8F6B-BFE9AD940524@gmail.com/
Also on:    postgresql.org/message-id/AC328D21-21D6-4FFC-8F6B-BFE9AD940524@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: samimseih@gmail.com, tgl@sss.pgh.pa.us, robertmhaas@gmail.com
  Subject: Re: Restart pg_usleep when interrupted
  In-Reply-To: <AC328D21-21D6-4FFC-8F6B-BFE9AD940524@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox