pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael.paquier@gmail.com>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: pgsql-committers@postgresql.org
Subject: Re: pgsql: Use latch instead of select() in walreceiver
Date: Fri, 2 Dec 2016 10:50:30 +0900
Message-ID: <CAB7nPqRA_cO_r_PLmRvFUtpvrTUeeBooXst1+oDecTPmTckp5A@mail.gmail.com> (raw)
In-Reply-To: <E1cCcfd-0008G5-2z@gemulon.postgresql.org>
References: <E1cCcfd-0008G5-2z@gemulon.postgresql.org>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

On Fri, Dec 2, 2016 at 10:29 AM, Peter Eisentraut <peter_e@gmx.net> wrote:
> Use latch instead of select() in walreceiver
>
> Replace use of poll()/select() by WaitLatchOrSocket(), which is more
> portable and flexible.
>
> Also change walreceiver to use its procLatch instead of a custom latch.
>
> From: Petr Jelinek <petr@2ndquadrant.com>

+           ResetLatch(&MyProc->procLatch);
+           rc = WaitLatchOrSocket(&MyProc->procLatch,
+                                  WL_POSTMASTER_DEATH | WL_SOCKET_READABLE |
+                                  WL_LATCH_SET,
+                                  PQsocket(streamConn),
+                                  0,
+                                  WAIT_EVENT_LIBPQWALRECEIVER_READ);
+           if (rc & WL_POSTMASTER_DEATH)
+               exit(1);
Hmm. We have always been very careful about not leaving immediately
from libpqwalreceiver.c which is an independent shared library so as
the WAL receiver can take cleanup actions. See here for more details:
https://www.postgresql.org/message-id/CAEepm=0hg_FX7kdUhosTpJ_kPsUZw6k-7nuQNy-dGAOaetn_tA@mail.gmail...
-- 
Michael


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



view thread (3+ messages)  latest in thread

Message-ID: <CAB7nPqRA_cO_r_PLmRvFUtpvrTUeeBooXst1+oDecTPmTckp5A@mail.gmail.com>
Permalink:  ../CAB7nPqRA_cO_r_PLmRvFUtpvrTUeeBooXst1+oDecTPmTckp5A@mail.gmail.com/
Also on:    postgresql.org/message-id/CAB7nPqRA_cO_r_PLmRvFUtpvrTUeeBooXst1+oDecTPmTckp5A@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael.paquier@gmail.com, peter_e@gmx.net
  Subject: Re: pgsql: Use latch instead of select() in walreceiver
  In-Reply-To: <CAB7nPqRA_cO_r_PLmRvFUtpvrTUeeBooXst1+oDecTPmTckp5A@mail.gmail.com>
  References: <E1cCcfd-0008G5-2z@gemulon.postgresql.org> <CAB7nPqRA_cO_r_PLmRvFUtpvrTUeeBooXst1+oDecTPmTckp5A@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox