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

2016-09-19 Thread Andres Freund
On 2016-09-20 11:07:03 +1200, Thomas Munro wrote: > Yeah, I wondered why that was different than the pattern established > elsewhere when I was hacking on replication code. There are actually > several places where we call PostmasterIsAlive() unconditionally in a > loop that waits for WL_POSTMASTE

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

2016-09-19 Thread Thomas Munro
On Sat, Sep 17, 2016 at 6:23 AM, Andres Freund wrote: > On 2016-09-16 09:55:48 +0200, Marco Pfatschbacher wrote: >> On Thu, Sep 15, 2016 at 12:26:16PM -0700, Andres Freund wrote: >> > Yikes, that's a pretty absurd implementation. >> >> Not when you take into account that it's been written over 20

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

2016-09-19 Thread Robert Haas
On Fri, Sep 16, 2016 at 2:23 PM, Andres Freund wrote: >> Every read is an event, and that's what PostmasterIsAlive does. > > But in most places we only do a PostmasterIsAlive if WaitLatch returns > WL_POSTMASTER_DEATH. The only walreceiver related place that doesn't is > WalRcvWaitForStartPositio

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

2016-09-16 Thread Andres Freund
Hi, On 2016-09-16 09:55:48 +0200, Marco Pfatschbacher wrote: > On Thu, Sep 15, 2016 at 12:26:16PM -0700, Andres Freund wrote: > > Yikes, that's a pretty absurd implementation. > > Not when you take into account that it's been written over 20 years ago ;) Well, that doesn't mean it can't be fixed

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

2016-09-16 Thread Marco Pfatschbacher
On Thu, Sep 15, 2016 at 12:26:16PM -0700, Andres Freund wrote: > Hi, > > On 2016-09-15 15:57:55 +0200, Marco Pfatschbacher wrote: > > the current implementation of PostmasterIsAlive() uses a pipe to > > monitor the existence of the postmaster process. > > One end of the pipe is held open in the po

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

2016-09-16 Thread Marco Pfatschbacher
On Thu, Sep 15, 2016 at 04:40:00PM -0400, Tom Lane wrote: > Thomas Munro writes: > > Very interesting. Perhaps that is why NetBSD shows a speedup with the > > kqueue patch[1] but FreeBSD doesn't. I guess that if I could get the > > kqueue patch to perform better on large FreeBSD systems, it woul

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

2016-09-16 Thread Marco Pfatschbacher
On Thu, Sep 15, 2016 at 04:24:07PM -0400, Tom Lane wrote: > Marco Pfatschbacher writes: > > the current implementation of PostmasterIsAlive() uses a pipe to > > monitor the existence of the postmaster process. > > One end of the pipe is held open in the postmaster, while the other end is > > inher

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

2016-09-15 Thread Tom Lane
Thomas Munro writes: > Very interesting. Perhaps that is why NetBSD shows a speedup with the > kqueue patch[1] but FreeBSD doesn't. I guess that if I could get the > kqueue patch to perform better on large FreeBSD systems, it would also > be a solution to this problem. I just noticed that kqueu

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

2016-09-15 Thread Tom Lane
Marco Pfatschbacher writes: > the current implementation of PostmasterIsAlive() uses a pipe to > monitor the existence of the postmaster process. > One end of the pipe is held open in the postmaster, while the other end is > inherited to all the auxiliary and background processes when they fork. >

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

2016-09-15 Thread Thomas Munro
On Fri, Sep 16, 2016 at 1:57 AM, Marco Pfatschbacher wrote: > the current implementation of PostmasterIsAlive() uses a pipe to > monitor the existence of the postmaster process. > One end of the pipe is held open in the postmaster, while the other end is > inherited to all the auxiliary and backgr

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

2016-09-15 Thread Andres Freund
Hi, On 2016-09-15 15:57:55 +0200, Marco Pfatschbacher wrote: > the current implementation of PostmasterIsAlive() uses a pipe to > monitor the existence of the postmaster process. > One end of the pipe is held open in the postmaster, while the other end is > inherited to all the auxiliary and backg

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

2016-09-15 Thread Marco Pfatschbacher
Hi, the current implementation of PostmasterIsAlive() uses a pipe to monitor the existence of the postmaster process. One end of the pipe is held open in the postmaster, while the other end is inherited to all the auxiliary and background processes when they fork. This leads to multiple processes