Re: [HACKERS] PATCH: Keep one postmaster monitoring pipe per process

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Cc: Marco Pfatschbacher <Marco_Pfatschbacher(at)genua(dot)de>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] PATCH: Keep one postmaster monitoring pipe per process
Date: 2018-07-13 17:34:36
Message-ID: 6417314e-93d5-ed2d-9012-8d6e9ed21778@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 18/04/18 09:55, Thomas Munro wrote:
> Here's a draft patch that does that. One contentious question is:
> should you have to opt *in* to auto-exit-on-postmaster death? Andres
> opined that you should. I actually think it's not so bad if you don't
> have to do that, and instead have to opt out. I think of it as a kind
> of 'process cancellation point' or a quiet PANIC that you can opt out
> of. It's nice to remove the old boilerplate code without having to
> add a new boilerplate event that you have to remember every time. Any
> other opinions?

Hmm. Exiting on postmaster death by default does feel a bit too magical
to me. But as your patch points out, there are currently no places where
you *don't* want to exit on postmaster death, some callers just prefer
to handle it themselves. And I like having a default or something to
make sure that all call sites in the future will also exit quickly.

I'd suggest that we add a new WL_EXIT_ON_POSTMASTER_DEATH flag, making
it opt-on. But add an assertion in WaitLatchOrSocket:

Assert ((wakeEvents & (WL_EXIT_POSTMASTER_DEATH | WL_POSTMASTER_DEATH))
!= 0);

That ensures that all callers either use WL_EXIT_ON_POSTMASTER_DEATH, or
WL_POSTMASTER_DEATH to handle it in the caller. Having to specify
WL_EXIT_ON_POSTMASTER_DEATH reminds you that the call might exit(), so
if that's not what you want, you need to do something else. But the
assertion makes sure that all callers deal with postmaster death in some
way.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christophe Pettus 2018-07-13 18:06:50 Re: requested timeline ... does not contain minimum recovery point ...
Previous Message Alvaro Herrera 2018-07-13 17:28:38 Re: Cannot dump foreign key constraints on partitioned table