Re: [Patch] pg_rewind: options to use restore_command from recovery.conf or command line

Alexey Kondratov <a.kondratov@postgrespro.ru>

From: Alexey Kondratov <a.kondratov@postgrespro.ru>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Liudmila Mantrova <l.mantrova@postgrespro.ru>, Thomas Munro <thomas.munro@gmail.com>, Michael Paquier <michael@paquier.xyz>, Andrey Borodin <x4mmm@yandex-team.ru>, David Steele <david@pgmasters.net>, Andres Freund <andres@anarazel.de>, PostgreSQL-development <pgsql-hackers@postgresql.org>, Dmitry Dolgov <9erthalion6@gmail.com>, vladimirlesk@yandex-team.ru, dsarafan@yandex-team.ru
Date: 2019-09-26T12:08:22Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Move frontend-side archive APIs from src/common/ to src/fe_utils/

  2. Add -c/--restore-target-wal to pg_rewind

  3. Move routine definitions of xlogarchive.c to a new header file

  4. Move routine building restore_command to src/common/

  5. Integrate recovery.conf into postgresql.conf

Attachments

On 01.08.2019 19:53, Alexey Kondratov wrote:
> On 26.07.2019 20:43, Liudmila Mantrova wrote:
>> On a more general note, I wonder if everyone is happy with the 
>> --using-postgresql-conf option name, or we should continue searching 
>> for a narrower term. Unfortunately, I don't have any better 
>> suggestions right now, but I believe it should be clear that its 
>> purpose is to fetch missing WAL files for target. What do you think?
>>
>
> I don't like it either, but this one was my best guess then. Maybe 
> --restore-target-wal instead of --using-postgresql-conf will be 
> better? And --target-restore-command instead of --restore-command if 
> we want to specify that this is restore_command for target server?
>

As Alvaro correctly pointed in the nearby thread [1], we've got an 
interference regarding -R command line argument. I agree that it's a 
good idea to reserve -R for recovery configuration write to be 
consistent with pg_basebackup, so I've updated my patch to use another 
letters:

1. -c/--restore-target-wal --- to use restore_command from postgresql.conf
2. -C/--target-restore-command --- to pass restore_command as a command 
line argument

Updated and rebased patch is attached. However, now I'm wondering, do we 
actually need 1. as a separated option and not being enabled by default? 
I cannot imagine a situation, when restore_command is set in the 
postgresql.conf and someone prefer pg_rewind to fail instead of fetching 
missed WALs automatically, but maybe there are some cases?


[1] 
https://www.postgresql.org/message-id/20190925174812.GA4916%40alvherre.pgsql


-- 
Alexey Kondratov

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