Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dePg6-00018J-6a for pgsql-bugs@arkaria.postgresql.org; Sun, 06 Aug 2017 17:49:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dePg5-000331-Am for pgsql-bugs@arkaria.postgresql.org; Sun, 06 Aug 2017 17:49:25 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dePfO-0001mC-CU for pgsql-bugs@postgresql.org; Sun, 06 Aug 2017 17:48:42 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dePf6-0004NT-KT for pgsql-bugs@postgresql.org; Sun, 06 Aug 2017 17:48:41 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id D46C320F86; Sun, 6 Aug 2017 13:48:23 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Sun, 06 Aug 2017 13:48:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=YaUcoNugwpNxR0D2MA kbtzyEQhHTxYOe+CVXK42WCjs=; b=aPD5HW8KF+MhgdJr0W3ha6HHRSavrfWv9w M57fB70FpAmq9b8nMhdsy/jEuajnSP6PhOiY9hgPptKKPcs4KB03AsQ9X69s1e8A 3+wNrTNhQuVb+8cNTtbHx5S/jk/qay0jhhPMvpUKAPYkQ+CaHYlbuaGsccT4fK/S 4Fp6z7TI9NfyCb8TebTMfqi+nwkVqXHRQo+p8XRvuEOVx63pOUrLIUFzLCrlH28c t7T//yCtGRv/iVmPJigriUqlYwTJ5+sJydl74fVfhKgCRHA2POkXONImwga79Boe Jj4WpSIpTkphhraZOwmemZlTRI+o9CP3MorMWcx31BQ1+v3VWCvw== X-ME-Sender: X-Sasl-enc: BdEZSVT2fdvInMbK74o1zq5Xxk+Kg0WdEiJMwMUT5s49 1502041703 Received: from intern.anarazel.de (unknown [136.24.76.72]) by mail.messagingengine.com (Postfix) with ESMTPA id 7EA057E522; Sun, 6 Aug 2017 13:48:23 -0400 (EDT) Date: Sun, 6 Aug 2017 10:48:22 -0700 From: Andres Freund To: Tom Lane , Petr Jelinek , Peter Eisentraut Cc: Noah Misch , "Augustine, Jobin" , pgsql-bugs@postgresql.org Subject: Re: Replication to Postgres 10 on Windows is broken Message-ID: <20170806174822.puc4jq46rqltrtwq@alap3.anarazel.de> References: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3826.1502040882@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Hi, On 2017-08-06 13:34:42 -0400, Tom Lane wrote: > Andres Freund 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