Re: fsync data directory after DB crash

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: fsync data directory after DB crash
Дата
Msg-id ZLcxKpcAU5mK7VG7@paquier.xyz
обсуждение исходный текст
Ответ на fsync data directory after DB crash  ("Pandora" <yeyukui@qq.com>)
Ответы Re: fsync data directory after DB crash  (Thomas Munro <thomas.munro@gmail.com>)
Список pgsql-general
On Tue, Jul 18, 2023 at 04:50:25PM +0800, Pandora wrote:
> I found that starting from version 9.5, PostgreSQL will do fsync on
> the entire data directory after DB crash. Here's a question: if I
> have FPW = on, why is this step still necessary?

Yes, see around the call of SyncDataDirectory() in xlog.c:
 * - There might be data which we had written, intending to fsync it, but
 *   which we had not actually fsync'd yet.  Therefore, a power failure in
 *   the near future might cause earlier unflushed writes to be lost, even
 *   though more recent data written to disk from here on would be
 *   persisted.  To avoid that, fsync the entire data directory.
--
Michael

Вложения

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

Предыдущее
От: Rob Sargent
Дата:
Сообщение: Re: Effects of dropping a large table
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: fsync data directory after DB crash