pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Petr Jelinek <petr@2ndquadrant.com>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: Noah Misch <noah@leadboat.com>
Cc: Augustine, Jobin <jobin.augustine@openscg.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Replication to Postgres 10 on Windows is broken
Date: Sun, 6 Aug 2017 10:48:22 -0700
Message-ID: <20170806174822.puc4jq46rqltrtwq@alap3.anarazel.de> (raw)
In-Reply-To: <3826.1502040882@sss.pgh.pa.us>
References: <CAHBggj8g2T+ZDcACZ2FmzX9CTxkWjKBsHd6NkYB4i9Ojf6K1Fw@mail.gmail.com>
	<20170806062634.GA3180536@rfd.leadboat.com>
	<3819.1502032677@sss.pgh.pa.us>
	<20170806155037.GD3179882@rfd.leadboat.com>
	<6525.1502036947@sss.pgh.pa.us>
	<20170806171436.ve646fu4bpagdrc2@alap3.anarazel.de>
	<3826.1502040882@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hi,

On 2017-08-06 13:34:42 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On 2017-08-06 12:29:07 -0400, Tom Lane wrote:
> >> This is problematic, because the APIs in between don't provide a way
> >> to report that we're still waiting for connect rather than for
> >> data-write-ready.  Anybody have the stomach for extending PQconnectPoll's
> >> API with an extra PGRES_POLLING_CONNECTING state?
> 
> > I'm a bit hesitant to do so at this phase of the release cycle,
> 
> I'm pretty hesitant to do that at *any* phase of the release cycle,
> it's just too likely to break user code.

Right, that's what I went on to say ;)


> However, there's always more than one way to skin the cat.  What we need
> to know is whether PQconnectPoll's state machine is in CONNECTION_STARTED
> state, and PQstatus() does expose that, even though it claims it's an
> internal state that callers shouldn't rely on.  So here's a sketch:
> 
> * Invent a separate WL_SOCKET_CONNECTED flag for WaitLatchOrSocket.
> On Unix we can treat that the same as WL_SOCKET_WRITEABLE, on Windows
> it maps to FD_CONNECT.

Yea, that should work, and could be useful-ish for things outside of
libpqwalreceiver. E.g. parallel fdw scan, that IIRC somebody is working
on, seems like it very well could run into similar issues if we want to
handle interrupts, which we should...


> * In libpqwalreceiver, do something like
> 
>         io_flag = (status == PGRES_POLLING_READING
>                    ? WL_SOCKET_READABLE
> #ifdef WIN32
>                    : PQstatus(conn->streamConn) == CONNECTION_STARTED
> 		   ? WL_SOCKET_CONNECTED
> #endif
>                    : WL_SOCKET_WRITEABLE);
> 
> The #ifdef's optional, but no reason to spend extra cycles if we don't
> have to.  (Not sure if this is adequately parenthesized...)

Let's use proper ifs ;)...


Greetings,

Andres Freund


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



view thread (51+ messages)  latest in thread

Message-ID: <20170806174822.puc4jq46rqltrtwq@alap3.anarazel.de>
Permalink:  ../20170806174822.puc4jq46rqltrtwq@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20170806174822.puc4jq46rqltrtwq@alap3.anarazel.de

 · 

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-bugs@postgresql.org
  Cc: andres@anarazel.de, tgl@sss.pgh.pa.us, petr@2ndquadrant.com, peter_e@gmx.net, noah@leadboat.com, jobin.augustine@openscg.com
  Subject: Re: Replication to Postgres 10 on Windows is broken
  In-Reply-To: <20170806174822.puc4jq46rqltrtwq@alap3.anarazel.de>
  References: <CAHBggj8g2T+ZDcACZ2FmzX9CTxkWjKBsHd6NkYB4i9Ojf6K1Fw@mail.gmail.com> <20170806062634.GA3180536@rfd.leadboat.com> <3819.1502032677@sss.pgh.pa.us> <20170806155037.GD3179882@rfd.leadboat.com> <6525.1502036947@sss.pgh.pa.us> <20170806171436.ve646fu4bpagdrc2@alap3.anarazel.de> <3826.1502040882@sss.pgh.pa.us> <20170806174822.puc4jq46rqltrtwq@alap3.anarazel.de>

* 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