Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cktmp-00088g-MA for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Mar 2017 14:38:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cktmp-0005ni-8n for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Mar 2017 14:38:55 +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 1cktmo-0005mI-4n for pgsql-hackers@postgreSQL.org; Mon, 06 Mar 2017 14:38:54 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cktml-0001ea-K2 for pgsql-hackers@postgreSQL.org; Mon, 06 Mar 2017 14:38:52 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 2167E20899; Mon, 6 Mar 2017 09:38:50 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Mon, 06 Mar 2017 09:38:50 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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= smtpout; bh=cUvX26pj6R9FC5IuX2osGINmNN0=; b=NYcutnSxW8ft4jhtbFPm EgoY9mDC2KLsdMvwseane1YLE2NGTrz4OHsKPj5UW6ZoPX8nQSWWtWB+TASBV4h9 OkJhIjqSJk2eXXiMIGkblKga7Frnuvvfl/3Axcw8Ra57yPozyvgxlU8P27oqtNbB bGNI0R+M0XdZqiI6/ursY9Q= X-ME-Sender: X-Sasl-enc: e7s/Cf6lYYlAIIMFcbfKc67elrrD4miUeMEPQmfgNpLO 1488811129 Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id CAE0A241ED; Mon, 6 Mar 2017 09:38:49 -0500 (EST) Subject: Re: [COMMITTERS] pgsql: Use asynchronous connect API in libpqwalreceiver To: Petr Jelinek , Tom Lane References: <19403.1488586564@sss.pgh.pa.us> <34d98fbf-9195-04d2-b85a-634d6952ffdf@2ndquadrant.com> <19815.1488600693@sss.pgh.pa.us> <4144256b-dc4f-892c-a720-71f6e7b9ac87@2ndquadrant.com> Cc: pgsql-hackers@postgreSQL.org, Andrew Dunstan From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: Date: Mon, 6 Mar 2017 09:38:49 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <4144256b-dc4f-892c-a720-71f6e7b9ac87@2ndquadrant.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 3/4/17 01:45, Petr Jelinek wrote: > I can see one difference though (I didn't see this code before) and that > is, the connectDBComplete starts with waiting for socket to become > writable and only then calls PQconnectPoll, while my patch starts with > PQconnectPoll call. And I see following comment in connectDBstart >> /* >> * The code for processing CONNECTION_NEEDED state is in PQconnectPoll(), >> * so that it can easily be re-executed if needed again during the >> * asynchronous startup process. However, we must run it once here, >> * because callers expect a success return from this routine to mean that >> * we are in PGRES_POLLING_WRITING connection state. >> */ Yes, the libpq documentation also says that. > If that's the case, the attached should fix it, but I have no way of > testing it on windows, I can only say that it still works on my machine > so at least it hopefully does not make things worse. Committed that. Let's see how it goes. I rewrote the while loop as a for loop so that the control logic isn't spread out over three screens. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers