Re: walreceiver is uninterruptible on win32 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: walreceiver is uninterruptible on win32
Date
Msg-id 24130.1270222011@sss.pgh.pa.us
Whole thread Raw
In response to Re: walreceiver is uninterruptible on win32  (Magnus Hagander <magnus@hagander.net>)
Responses Re: walreceiver is uninterruptible on win32
Re: walreceiver is uninterruptible on win32
List pgsql-hackers
Magnus Hagander <magnus@hagander.net> writes:
> On Thu, Mar 25, 2010 at 15:33, Fujii Masao <masao.fujii@gmail.com> wrote:
>> Sorry for the delay. The attached patch replaces PQexec() used by dblink
>> and libpqwalreceiver with pgwin32_PQexec() which is the win32 version of
>> PQexec().
>> 
>> pgwin32_PQexec() is provided as the library 'libpqbe.dll', which is created
>> only on win32. dblink.dll and libpqwalreceiver.dll refer to libpqbe.dll.
>> Also libpqbe.dll refers to libpq.dll.

> [ assorted objections ]

I disapprove of the whole approach, actually.  The right way to fix this
is to not touch or replace libpq at all, but to change walreceiver to
use libpq's async-query facilities directly.  Instead of PQexec, use
PQsendQuery and then a loop involving PQisBusy, PQgetResult, etc.
You've more or less done that loop, but you've put it in the wrong
place.

The larger point is that I don't believe this issue exists only on
Windows.  I think we're going to want something like this on all
platforms, and that implies supporting poll() not just select() for the
waiting part.

The patch also seems confused about whether it's intending to be a
general-purpose solution or not.  You can maybe take some shortcuts
if it's only going to be for walreceiver, but if you're going to put
it in dblink it is *not* acceptable to take shortcuts like not
processing errors completely.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: pgindent bizarreness
Next
From: "David E. Wheeler"
Date:
Subject: Re: Proposal: Add JSON support