Re: Can a child process detect postmaster death when in pg_usleep? - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: Can a child process detect postmaster death when in pg_usleep?
Date
Msg-id CALj2ACXapf2aNKSZaWpFFBZasyu2VC=AHNhgHUN-dOeyMDS-OA@mail.gmail.com
Whole thread Raw
In response to Re: Can a child process detect postmaster death when in pg_usleep?  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Responses Re: Can a child process detect postmaster death when in pg_usleep?  (Aleksander Alekseev <aleksander@timescale.com>)
List pgsql-hackers
On Tue, Apr 20, 2021 at 7:36 AM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.com> wrote:
>
> On Thu, Apr 15, 2021 at 11:48 AM Bharath Rupireddy
> <bharath.rupireddyforpostgres@gmail.com> wrote:
> > > We definitely have replaced a lot of sleeps with latch.c primitives
> > > over the past few years, since we got WL_EXIT_ON_PM_DEATH and
> > > condition variables.  There may be many more to improve...  You
> > > mentioned autovacuum... yeah, Stephen fixed one of these with commit
> > > 4753ef37, but yeah it's not great to have those others in there...
> >
> > I have not looked at the commit 4753ef37 previously, but it
> > essentially addresses the problem with pg_usleep for vacuum delay. I'm
> > thinking we can also replace pg_usleep in below places based on the
> > fact that pg_usleep should be avoided in 1) short waits in a loop 2)
> > when wait time is dependent on user configurable parameters. And using
> > WaitLatch may require us to add wait event types to WaitEventTimeout
> > enum, but that's okay.
>
> I'm attaching 3 patches that replace pg_usleep with WaitLatch: 0001 in
> lazy_truncate_heap, 0002 in do_pg_stop_backup and 0003 for Pre and
> Post Auth Delay. Regression tests pass with these patches. Please
> review them.

I made a CF entry [1] so that it may get a chance for review.

[1] https://commitfest.postgresql.org/33/3085/

With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Justin Pryzby
Date:
Subject: Re: Addition of authenticated ID to pg_stat_activity
Next
From: Amit Langote
Date:
Subject: Re: Does rewriteTargetListIU still need to add UPDATE tlist entries?