From: | 张广舟(明虚) <guangzhou(dot)zgz(at)alibaba-inc(dot)com> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de> |
Cc: | <pgsql-hackers(at)postgresql(dot)org>, 周正中(德歌) <dege(dot)zzz(at)alibaba-inc(dot)com>, 范孝剑(康贤) <funnyxj(dot)fxj(at)alibaba-inc(dot)com>, 曾文旌(义从) <wenjing(dot)zwj(at)alibaba-inc(dot)com>, 窦贤明(执白) <xianming(dot)dxm(at)alibaba-inc(dot)com>, 萧少聪(铁庵) <shaocong(dot)xsc(at)alibaba-inc(dot)com>, 陈新坚(惧留孙) <xinjian(dot)chen(at)alibaba-inc(dot)com> |
Subject: | Re: about fsync in CLOG buffer write |
Date: | 2015-09-07 12:55:43 |
Message-ID: | D213A9E6.2CB1B%guangzhou.zgz@alibaba-inc.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Andres,
Thanks for the reply!
I will try the ForwardFsyncRequest-like approach.
在 15-9-2 下午8:32, "Andres Freund" <andres(at)anarazel(dot)de> 写入:
>On 2015-09-10 19:39:59 +0800, 张广舟(明虚) wrote:
>> We found there is a fsync call when CLOG buffer
>> is written out in SlruPhysicalWritePage(). It is often called when a
>>backend
>> needs to check transaction status with SimpleLruReadPage().
>
>That's when there's not enough buffers available some other, and your
>case dirty, needs to be written out.
>
>You could try increasing the max (32) in CLOGShmemBuffers() further.
>
>> ctl->do_fsync is true for CLOG. Question is, could we just disable
>>fsync
>> for CLOG buffer write out here? Is it safe to do so? I understand a
>> checkpoint will calls SimpleLruFlush to flush all CLOG buffer at once,
>>and
>> the fsync call here (for buffer write out) is not necessary.
>
>No, that'd not be safe. The reason we fsync in SlruPhysicalWritePage()
>is that the flush during checkpoint won't necessarily touch those files
>at all (as they've been replaced with other buffers in memory).
>
>This could be optimized though - it should be possible to delay the
>fsync for slru files that have been evicted from memory till
>checkpoint. Using something like ForwardFsyncRequest() except that it
>obviously has to be usable for other files than normal relfilenodes.
>
>Greetings,
>
>Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2015-09-07 13:11:21 | Re: synchronous_commit = apply |
Previous Message | Greg Stark | 2015-09-07 12:39:41 | Re: [COMMITTERS] pgsql: Move DTK_ISODOW DTK_DOW and DTK_DOY to be type UNITS rather than |