Temporary WAL segments files not cleaned up after an instance crash

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Temporary WAL segments files not cleaned up after an instance crash
Дата
Msg-id 20180514054955.GF1528@paquier.xyz
обсуждение исходный текст
Ответы Re: Temporary WAL segments files not cleaned up after an instancecrash  (Yugo Nagata <nagata@sraoss.co.jp>)
Список pgsql-hackers
Hi all,

While playing with a standby as follows I noticed that xlogtemp.*
generated in pg_wal may stay around when entering crash recovery.  The
test I was conducting is pretty simple:
- Use a primary and a standby.
- Run pgbench on the primary.
- Then restart the standby with -m immediate and force WAL segment
switch on the primary in a loop.  Depending on the timing, one can see
that those xlogtemp files stay around.  Those files are here when
creating a new segment from scratch and append the PID of the process
creating them.  Any previous file existing with the same name is
unlinked.

The problem is that if an instance is not really stable for a reason or
another and starts crash recovery periodically, then there is a risk of
accumulating those temporary files.  If pg_wal is on its own partition,
tuned by max_wal_size, then there is a risk to run into ENOSPC and take
PostgreSQL down as new WAL segments cannot be created.

Shouldn't those files be cleaned up at the beginning of crash recovery?
Attached is a proposal of patch doing so.

Thoughts?
--
Michael

Вложения

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

Предыдущее
От: Amit Langote
Дата:
Сообщение: Re: Incorrect comment in get_partition_dispatch_recurse
Следующее
От: Amit Khandekar
Дата:
Сообщение: Re: Needless additional partition check in INSERT?