Re: pg_receivexlog --status-interval add fsync feedback

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: <furuyao(at)pm(dot)nttdata(dot)co(dot)jp>, <simon(at)2ndQuadrant(dot)com>, <masao(dot)fujii(at)gmail(dot)com>
Cc: <sawada(dot)mshk(at)gmail(dot)com>, <pgsql-hackers(at)postgresql(dot)org>, <teranishih(at)nttdata(dot)co(dot)jp>
Subject: Re: pg_receivexlog --status-interval add fsync feedback
Date: 2014-10-24 14:21:27
Message-ID: 544A6067.4060906@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/24/2014 01:24 PM, furuyao(at)pm(dot)nttdata(dot)co(dot)jp wrote:
>>>> Sorry, I'm going around in the circle. But I'd like to say again, I
>>>> don't think this is good idea. It prevents asynchronous
>>>> pg_receivexlog from fsyncing WAL data and sending feedbacks more
>>>> frequently at all. They are useful, for example, when we want to
>>>> monitor the write location of asynchronous pg_receivexlog in almost
>>>> realtime. But if we adopt the idea, since feedback cannot be sent
>>>> soon in async mode, pg_stat_replication always returns the
>> not-up-to-date location.
>>>
>>> Why not send a message every 10 seconds when its not sync rep?
>>
>> Or even after every write(). It's a tiny amount of network traffic anyway.
>
> I understand that send feedback message frequently will keep pg_stat_replication up-to-date state.
>
> Are there really no needs who wants to fsync even in async mode ?
> I think the people who dislike Data lost will like that idea.

The OS will not sit on the written but not fsync'd data forever, it will
get flushed to disk in a few seconds even without the fsync. It's just
that there is no guarantee on when it will hit the disk, but there are
no strong guarantees in asynchronous replication anyway.

> Nevertheless in sync or async, returning feedback and executing
> fsync() same as like walreceiver is such a problem?

Probably would be OK. It would increase the I/O a lot, thanks to a lot
of small writes and fsyncs, which might be surprising for a tool like
pg_receivexlog.

One idea is to change the default behavior to be like walreceiver, and
fsync() after every write. But provide an option to get the old
behavior, "--no-fsync".

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-10-24 14:27:15 Re: Getting rid of "accept incoming network connections" prompts on OS X
Previous Message Heikki Linnakangas 2014-10-24 14:13:49 Re: uninitialized values in revised prepared xact code