Re: Can a child process detect postmaster death when in pg_usleep?

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: Can a child process detect postmaster death when in pg_usleep?
Date: 2021-04-26 03:26:57
Message-ID: CALj2ACXapf2aNKSZaWpFFBZasyu2VC=AHNhgHUN-dOeyMDS-OA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 20, 2021 at 7:36 AM Bharath Rupireddy
<bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>
> On Thu, Apr 15, 2021 at 11:48 AM Bharath Rupireddy
> <bharath(dot)rupireddyforpostgres(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2021-04-26 03:54:23 Re: Does rewriteTargetListIU still need to add UPDATE tlist entries?
Previous Message Justin Pryzby 2021-04-26 03:14:43 Re: Addition of authenticated ID to pg_stat_activity