Re: Why standby restores some WALs many times from archive?

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Why standby restores some WALs many times from archive?
Дата
Msg-id 20171230122027.GA7704@paquier.xyz
обсуждение исходный текст
Ответ на Re: Why standby restores some WALs many times from archive?  (Sergey Burladyan <eshkinkot@gmail.com>)
Ответы Re: Why standby restores some WALs many times from archive?  (Sergey Burladyan <eshkinkot@gmail.com>)
Re: Why standby restores some WALs many times from archive?  (Jeff Janes <jeff.janes@gmail.com>)
Список pgsql-hackers
On Sat, Dec 30, 2017 at 04:30:07AM +0300, Sergey Burladyan wrote:
> We use this scripts:
> https://github.com/avito-tech/dba-utils/tree/master/pg_archive
>
> But I can reproduce problem with simple cp & mv:
> archive_command:
>   test ! -f /var/lib/postgresql/wals/%f && \
>   test ! -f /var/lib/postgresql/wals/%f.tmp && \
>   cp %p /var/lib/postgresql/wals/%f.tmp && \
>   mv /var/lib/postgresql/wals/%f.tmp /var/lib/postgresql/wals/%f

This is unsafe. PostgreSQL expects the WAL segment archived to be
flushed to disk once the archive command has returned its result to the
backend. Don't be surprised if you get corrupted instances or that you
are not able to recover up to a consistent point if you need to roll in
a backup. Note that the documentation of PostgreSQL provides a simple
example of archive command, which is itself bad enough not to use.
--
Michael

Вложения

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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: [HACKERS] MERGE SQL Statement for PG11
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: [HACKERS] Commits don't block for synchronous replication