Re: [COMMITTERS] pgsql: Use asynchronous connect API in libpqwalreceiver

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: [COMMITTERS] pgsql: Use asynchronous connect API in libpqwalreceiver
Date: 2017-03-06 14:38:49
Message-ID: dcef4616-21af-5ec0-4113-d409e5ddbf86@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2017-03-06 17:23:38 pgsql: Fix user-after-free bug.
Previous Message Peter Eisentraut 2017-03-06 14:37:29 pgsql: Reorder the asynchronous libpq calls for replication connection

Browse pgsql-hackers by date

  From Date Subject
Next Message Rader, David 2017-03-06 14:45:47 Re: [BUGS] Seems bug in postgres_fdw?
Previous Message Stephen Frost 2017-03-06 14:30:59 Re: PATCH: psql show index with type info