Re: pg_usleep for multisecond delays

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_usleep for multisecond delays
Date: 2023-07-26 23:41:25
Message-ID: 20230726234125.GA3560354@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Mar 13, 2023 at 02:16:31PM -0700, Nathan Bossart wrote:
> At the moment, I'm thinking about either removing the check_interrupts
> function pointer argument altogether or making it optional for code paths
> where we might not want any interrupt handling to run. In the former
> approach, we could simply call WaitLatch() without a latch. While this
> wouldn't do any interrupt handling, we'd still get custom wait event
> support and better responsiveness when the postmaster dies, which is
> strictly better than what's there today. And many of these sleeps are in
> uncommon or debug paths, so delaying interrupt handling might be okay. In
> the latter approach, we would have interrupt handling, but I'm worried that
> would be easy to get wrong. I think it would be nice to have interrupt
> handling if possible, so I'm still (over)thinking about this.

I started on the former approach (work-in-progress patch attached), but I
figured I'd ask whether folks are alright with this before I spend more
time on it. Many of the sleeps in question are relatively short, are
intended for debugging, or are meant to prevent errors from repeating as
fast as possible, so I don't know if we should bother adding interrupt
handling support.

Nathan Bossart
Amazon Web Services:

Attachment Content-Type Size
v3-0001-WORK-IN-PROGRESS-pg_msleep.patch text/x-diff 16.8 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-07-27 00:05:05 Re: psql: Could we get "-- " prefixing on the **** QUERY **** outputs? (ECHO_HIDDEN)
Previous Message Gurjeet Singh 2023-07-26 22:36:25 Re: There should be a way to use the force flag when restoring databases