Re: about fsync in CLOG buffer write

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: about fsync in CLOG buffer write
Дата
Msg-id 20150902123241.GA25109@alap3.anarazel.de
обсуждение исходный текст
Ответ на about fsync in CLOG buffer write  ("张广舟(明虚)" <guangzhou.zgz@alibaba-inc.com>)
Ответы Re: about fsync in CLOG buffer write  ("张广舟(明虚)" <guangzhou.zgz@alibaba-inc.com>)
Re: about fsync in CLOG buffer write  (Jeff Janes <jeff.janes@gmail.com>)
Список pgsql-hackers
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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Fujii Masao
Дата:
Сообщение: Re: synchronous_commit = apply
Следующее
От: Nikolay Shaplov
Дата:
Сообщение: commitfest does not see my real latest patch