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

Thomas Munro <thomas.munro@enterprisedb.com>

From: Thomas Munro <thomas.munro@enterprisedb.com>
To: Andres Freund <andres@anarazel.de>
Cc: Marco Pfatschbacher <Marco_Pfatschbacher@genua.de>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2018-04-18T06:55:52Z
Lists: pgsql-hackers

Attachments

Hi,

I'd like to disentangle two related topics.  For "I want
PostmasterIsAlive() to go faster using signals on platforms that can
support that", please see over here:

https://www.postgresql.org/message-id/flat/7261eb39-0369-f2f4-1bb5-62f3b6083b5e@iki.fi#7261eb39-0369-f2f4-1bb5-62f3b6083b5e@iki.fi

For "I want to fix all the code that ignores the WL_POSTMASTER_DEATH
event and then calls PostmasterIsAlive() every time through its loop,
or fails to detect postmaster death at all", this is the thread
(unless someone sees a reason to reentangle them).

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?

I'm not sure if the exit(1) vs proc_exit(1) distinction is important.

-- 
Thomas Munro
http://www.enterprisedb.com

Commits

  1. Add WL_EXIT_ON_PM_DEATH pseudo-event.

  2. Use signals for postmaster death on Linux.