pg_wal/RECOVERYHISTORY file remains after archive recovery

Поиск
Список
Период
Сортировка
От Masahiko Sawada
Тема pg_wal/RECOVERYHISTORY file remains after archive recovery
Дата
Msg-id CAD21AoBO_eDQub6zojFnWtnmutRBWvYf7=cW4Hsqj+U_R26w3Q@mail.gmail.com
обсуждение исходный текст
Ответы Re: pg_wal/RECOVERYHISTORY file remains after archive recovery  (Fujii Masao <masao.fujii@gmail.com>)
Список pgsql-hackers
Hi,

When we do archive recovery from the database cluster of which
timeline ID is more than 2 pg_wal/RECOVERYHISTORY is remained even
after archive recovery completed.

The cause of this seems cbc55da556b that moved exitArchiveRecovery()
to before writeTimeLineHistory(). writeTimeLineHIstory() restores the
history file from archive directory and therefore creates
RECOVERYHISTORY file in pg_wal directory. We used to remove such
temporary file by exitArchiveRecovery() but with this commit the order
of calling these functions is reversed. Therefore we create
RECOVERYHISTORY file after exited from archive recovery mode and
remain it.

To fix it I think that we can remove RECOVERYHISTORY file before the
history file is archived in writeTimeLineHIstory(). The commit
cbc55da556b is intended to minimize the window between the moment the
file is written and the end-of-recovery record is generated. So I
think it's not good to put exitArchiveRecovery() after
writeTimeLineHIstory().

This issue seems to exist in all supported version as far as I read
the code, although I don't test all of them yet.

I've attached the draft patch to fix this issue. Regression test might
be required. Feedback and suggestion are very welcome.

Regards,

--
Masahiko Sawada

Вложения

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

Предыдущее
От: Amit Langote
Дата:
Сообщение: Re: Proposal for syntax to support creation of partition tables whencreating parent table
Следующее
От: Amit Langote
Дата:
Сообщение: Re: Add comments for a postgres program in bootstrap mode