[Patch] pg_rewind: options to use restore_command from recovery.confor command line

Поиск
Список
Период
Сортировка
От Alexey Kondratov
Тема [Patch] pg_rewind: options to use restore_command from recovery.confor command line
Дата
Msg-id a3acff50-5a0d-9a2c-b3b2-ee36168955c1@postgrespro.ru
обсуждение исходный текст
Ответы Re: [Patch] pg_rewind: options to use restore_command fromrecovery.conf or command line
Список pgsql-hackers

Hi hackers,

Currently Postgres has options for continuous WAL files archiving, which is quite often used along with master-replica setup. OK, then the worst is happened and it's time to get your old master back and synchronize it with new master (ex-replica) with pg_rewind. However, required WAL files may be already archived and pg_rewind will fail. You can copy these files manually, but it is difficult to calculate, which ones you need. Anyway, it complicates building failover system with automatic failure recovery.

I expect, that it will be a good idea to allow pg_rewind to look for a restore_command in the target data directory recovery.conf or pass it is as a command line argument. Then pg_rewind can use it to get missing WAL files from the archive. I had a few talks with DBAs and came to conclusion, that this is a highly requested feature.

I prepared a proof of concept patch (please, find attached), which does exactly what I described above. I played with it a little and it seems to be working, tests were accordingly updated to verify this archive retrieval functionality too.

Patch is relatively simple excepting the one part: if we want to parse recovery.conf (with all possible includes, etc.) and get restore_command, then we should use guc-file.l parser, which is heavily linked to backend, e.g. in error reporting part. So I copied it and made frontend-safe version guc-file-fe.l. Personally, I don't think it's a good idea, but nothing else came to mind. It is also possible to leave the only one option -- passing restore_command as command line argument.

What do you think?


--

Alexey Kondratov

Postgres Professional: https://www.postgrespro.com

Russian Postgres Company

Вложения

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: pgsql: Add TAP tests for pg_verify_checksums
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: pgsql: Add TAP tests for pg_verify_checksums