Re: Replication server timeout patch

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Replication server timeout patch
Date: 2011-03-24 13:24:34
Message-ID: AANLkTimpTM47zpGO=6Gx_x+48Wn-TrVswA1nMFcGYQ8m@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 23, 2011 at 7:33 PM, Heikki Linnakangas
<heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:
> I don't much like the API for this. Walsender shouldn't need to know about
> the details of the FE/BE protocol, pq_putbytes_if_available() seems too low
> level to be useful.
>
> I think a better API would be to have a non-blocking version of
> pq_putmessage(). We can make the output buffer in pqcomm.c resizeable, so
> that when the message doesn't fit in the output buffer in pq_putmessage(),
> the buffer is enlarged instead of trying to flush it.
>
> Attached is a patch using that approach. This is a much smaller patch, and
> easier to understand.

Agreed. Thanks for improving the patch.

pq_flush_if_writable() calls internal_flush() without using PG_TRY block.
This seems unsafe because for example pgwin32_waitforsinglesocket()
called by secure_write() can throw ERROR.

> I'm not totally happy with the walsender main loop, it
> seems to work as it is, but the logic has become quite complicated. Ideas
> welcome on how to simplify that.

As the patch I proposed before did, how about leaving XLogSend() instead
of WalSndLoop() to call pq_flush_if_writable() when there is pending data
in output buffer?

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2011-03-24 13:45:14 Re: sync rep & fsync=off
Previous Message Kevin Grittner 2011-03-24 12:16:05 Re: Re: making write location work (was: Efficient transaction-controlled synchronous replication)