From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp> |
Cc: | Noah Misch <noah(at)leadboat(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Thom Brown <thom(at)linux(dot)com>, Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Shigeru Hanada <shigeru(dot)hanada(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Optimization for updating foreign tables in Postgres FDW |
Date: | 2016-04-04 11:35:52 |
Message-ID: | CAB7nPqQguUzMMUGiCkwrcFFMt1S-9z3Cb3_MCKZRmB7tGnsGfQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Apr 4, 2016 at 7:49 PM, Etsuro Fujita
<fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> On 2016/03/31 16:38, Etsuro Fujita wrote:
>>
>> On 2016/03/31 14:07, Noah Misch wrote:
>>>
>>> On Thu, Mar 24, 2016 at 01:02:57PM +0900, Etsuro Fujita wrote:
>>>>
>>>> On 2016/03/24 11:14, Michael Paquier wrote:
>>>>>
>>>>> On Wed, Mar 23, 2016 at 10:05 PM, Thom Brown <thom(at)linux(dot)com> wrote:
>>>>>>
>>>>>> I've noticed that you now can't cancel a query if there's DML pushdown
>>>>>> to a foreign server. This previously worked while it was sending
>>>>>> individual statements as it interrupted and rolled it back.
>>>>>>
>>>>>> Here's what the local server sees when trying to cancel:
>>>>>>
>>>>>> # DELETE FROM remote.contacts;
>>>>>> ^CCancel request sent
>>>>>> DELETE 5000000
>>>>>>
>>>>>> This should probably be fixed.
>
>
>>>>> Looking at what has been committed, execute_dml_stmt is using
>>>>> PQexecParams, so we'd want to use an asynchronous call and loop on
>>>>> PQgetResult with CHECK_FOR_INTERRUPTS() in it.
>
>
>>>> Will fix.
>
>
>>> [This is a generic notification.]
>
>
>> Sorry for not having taken any action. I've been busy with another task
>> lately, but I started working on this. I plan to post a patch early
>> next week.
>
>
> Here is a patch to fix this issue. As proposed by Michael, I modified
> execute_dml_stmt so that it uses PQsendQueryParams, not PQexecParams. Any
> comments are welcome.
+ * This is based on pqSocketCheck.
+ */
+ bool
+ CheckSocket(PGconn *conn)
+ {
+ int ret;
+
+ Assert(conn != NULL);
Instead of copying again pqSocketQuery, which is as well copied in
libpqwalreceiver.c, wouldn't it be better to use WaitLatchOrSocket
with the socket returned by PQsocket?
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Teodor Sigaev | 2016-04-04 12:06:12 | Re: GIN data corruption bug(s) in 9.6devel |
Previous Message | Etsuro Fujita | 2016-04-04 11:11:21 | Incorrect comment in contrib/postgres_fdw/deparse.c |