Re: Optimization for updating foreign tables in Postgres FDW - Mailing list pgsql-hackers

From Etsuro Fujita
Subject Re: Optimization for updating foreign tables in Postgres FDW
Date
Msg-id 57075841.9040608@lab.ntt.co.jp
Whole thread Raw
In response to Re: Optimization for updating foreign tables in Postgres FDW  (Noah Misch <noah@leadboat.com>)
Responses Re: Optimization for updating foreign tables in Postgres FDW  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On 2016/04/08 13:42, Noah Misch wrote:
> On Tue, Apr 05, 2016 at 03:22:03PM +0900, Etsuro Fujita wrote:
>> On 2016/04/04 20:35, Michael Paquier wrote:
>>> On Mon, Apr 4, 2016 at 7:49 PM, Etsuro Fujita
>>> <fujita.etsuro@lab.ntt.co.jp> wrote:
>>>> 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?

>> Will check.  Thanks for the comment!

> What do you think?  This open item's seven-day deadline has passed.  It would
> help keep things moving to know whether you consider your latest patch optimal
> or whether you wish to change it the way Michael described.

I wish to change it that way because it not only avoids the duplicate
but fixes a bug in the previous patch that I overlooked that there is a
race condition if a signal arrives just before entering the CheckSocket.

Attached is an updated version of the patch.

Sorry for the delay.

Best regards,
Etsuro Fujita

Attachment

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Refactoring speculative insertion with unique indexes a little
Next
From: Amit Kapila
Date:
Subject: Re: Speed up Clog Access by increasing CLOG buffers