Re: Excessive PostmasterIsAlive calls slow down WAL redo

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Excessive PostmasterIsAlive calls slow down WAL redo
Date: 2018-04-19 03:05:50
Message-ID: CAEepm=0qJsxrY6uJ6ZqxJPpssL8xj299CpreNuZhVbmv69Zfgg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Apr 18, 2018 at 5:04 PM, Thomas Munro
<thomas(dot)munro(at)enterprisedb(dot)com> wrote:
> On Wed, Apr 11, 2018 at 10:22 PM, Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
>>> On Tue, Apr 10, 2018 at 12:53 PM, Andres Freund <andres(at)anarazel(dot)de>
>>> wrote:
>>>> That person said he'd work on adding an equivalent of linux'
>>>> prctl(PR_SET_PDEATHSIG) to FreeBSD.
>
> Here is an implementation of Andres's idea for Linux, and also for
> patched FreeBSD (for later if/when that lands). Do you think this
> makes sense Heikki? I am planning to add this to the next CF.

Here's a new version with a stupid bug fixed (I accidentally posted a
testing version that returned false instead of true, as cfbot quickly
pointed out -- d'oh).

By the way, these patches only use the death signal to make
PostmasterIsAlive() fast, for use by busy loops like recovery. The
postmaster pipe is still used for IO/timeout loops to detect
postmaster death. In theory you could get rid of the postmaster pipe
completely when USE_POSTMASTER_DEATH_SIGNAL is defined and make it
like the latch code, using the same self-pipe. I'm not sure if there
is anything to be gained by that (that wasn't already gained by using
epoll/kqueue) so I'm not proposing it.

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

Attachment Content-Type Size
0001-Use-signals-for-postmaster-death-on-Linux-v2.patch application/octet-stream 8.4 KB
0002-Use-signals-for-postmaster-death-on-FreeBSD-v2.patch application/octet-stream 4.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2018-04-19 03:14:17 Re: [HACKERS] PATCH: Keep one postmaster monitoring pipe per process
Previous Message Kyotaro HORIGUCHI 2018-04-19 03:01:45 Re: Postgres 10 problem with UNION ALL of null value in "subselect"