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

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Can a child process detect postmaster death when in pg_usleep?
Date: 2021-07-06 11:37:04
Message-ID: CALj2ACV68cP1ck_KkoPBcoh7oCKS0dd33pDZzbNNVgRPerG_UQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jul 6, 2021 at 4:33 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Tue, Jul 06, 2021 at 03:54:07PM +0530, Bharath Rupireddy wrote:
> > Thanks. You are right. The issue is due to the MyLatch being set by
> > SwitchToSharedLatch before WaitLatch. If we use (WL_TIMEOUT |
> > WL_EXIT_ON_PM_DEATH), then the backends will honour the
> > post_auth_delay as well as detect the postmaster death. Since we are
> > not using WL_LATCH_SET, I removed ResetLatch. Also, added some
> > comments around why we are not using WL_LATCH_SET.
> >
> > For PreAuthDelay, there's no problem to use WL_LATCH_SET as MyLatch
> > still points to the local latch(which is not set) in
> > BackendInitialize().
>
> FWIW, I think that it could be a good idea to use the same set of
> flags for all the pre/post_auth_delay paths for consistency. That's
> useful when grepping for one. Please note that I don't plan to look
> more at this patch set for this CF as I am not really excited by the
> updates involving developer options, and I suspect more issues like
> the one I found upthread so this needs a close lookup.
>
> If somebody else wishes to look at it, please feel free, of course.

Thanks. Anyways, I removed WL_LATCH_SET for PreAuthDelay as well. PSA v4 patch.

Regards,
Bharath Rupireddy.

Attachment Content-Type Size
v3-0001-Use-a-WaitLatch-for-Pre-and-Post-Auth-Delay.patch application/octet-stream 7.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2021-07-06 11:39:13 Re: [PATCH] expand the units that pg_size_pretty supports on output
Previous Message Ibrar Ahmed 2021-07-06 11:25:47 Re: Commit fest manager