Re: Directory fsync and other fun

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Directory fsync and other fun
Дата
Msg-id 407d949e1002232309m3518538fta5ebc5ef18c1ea7e@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Directory fsync and other fun  (Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp>)
Список pgsql-hackers
On Wed, Feb 24, 2010 at 2:51 AM, Takahiro Itagaki
<itagaki.takahiro@oss.ntt.co.jp> wrote:
> Also, I heard ext4 has a "feature" in that rename() might truncate the
> renamed file to zero bytes on crash. The user data in the file might be
> lost if the machine crashes just after rename().

In our case I think this is the one thing that cannot happen. This
happens when you write out the new file and rename it over the old
file without every fsyncing the new file. If the rename succeeds but
all the writes get lost you end up with neither the new nor old file.

The ext4 guys want you do to do an fsync of the new file before doing
the rename. This is terrible for most of the applications that were
doing this -- the latency hit for interactive apps that didn't really
need an fsync is awful -- but in our case we were already doing fsyncs
in every case where we do renames.




-- 
greg


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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Issues for named/mixed function notation patch
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Move documentation of all recovery.conf option to a new chapter.