Re: [Patch] pg_rewind: options to use restore_command fromrecovery.conf or command line - Mailing list pgsql-hackers

From Andrey Borodin
Subject Re: [Patch] pg_rewind: options to use restore_command fromrecovery.conf or command line
Date
Msg-id 0B43C5FA-5DE7-4669-88E0-486425F078C3@yandex-team.ru
Whole thread Raw
In response to [Patch] pg_rewind: options to use restore_command from recovery.confor command line  (Alexey Kondratov <a.kondratov@postgrespro.ru>)
Responses Re: [Patch] pg_rewind: options to use restore_command fromrecovery.conf or command line  (Alexey Kondratov <a.kondratov@postgrespro.ru>)
List pgsql-hackers
Hi, Alexey!

19 окт. 2018 г., в 22:49, Alexey Kondratov <a.kondratov@postgrespro.ru> написал(а):

I expect, that it will be a good idea to allow pg_rewind to look for a restore_command

+1
Normally you do not expect huge progress on failed master. But you still can get a lot of WAL if you have network partition and scheduled tasks like pg_repack.
I'm not actually aware what kind of problems led to these but we were considering some automation to fetch WALs for failed master to improve rewinded\resetuped ratio.

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.

I think it is better to load restore_command from recovery.conf.

I didn't actually try patch yet, but the idea seems interesting. Will you add it to the commitfest?

Best regards, Andrey Borodin.

pgsql-hackers by date:

Previous
From: Narayanan V
Date:
Subject: Re: WAL archive (archive_mode = always) ?
Next
From: Laurenz Albe
Date:
Subject: Re: Contribution to postgresql