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

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Alexey Kondratov <a.kondratov@postgrespro.ru>
Cc: Alexander Korotkov <a.korotkov@postgrespro.ru>, Alvaro Herrera <alvherre@2ndquadrant.com>, Kuntal Ghosh <kuntalghosh.2007@gmail.com>, Liudmila Mantrova <l.mantrova@postgrespro.ru>, Thomas Munro <thomas.munro@gmail.com>, 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: 2020-03-27T07:37:15Z
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

On Fri, Mar 27, 2020 at 12:24:19AM +0300, Alexey Kondratov wrote:
> The block of function declarations for xlogarchive.c inside xlog_internal.h
> looks a bit dangling already, since all other functions and variables
> defined/initialized in xlog.c. That way, it looks good to me to move it
> outside.

Yep, exactly my point of view.

> The only one concern about using the same name I have is that later someone
> may introduce a new variable or typedef inside xlogarchive.h. So someone
> else would be required to include both fe_archive.h and xlogarchive.h at
> once. But probably there should be a warning in the header comment section
> against doing so.
> 
> Anyway, I have tried to do what you proposed and attached is a small patch,
> that introduces xlogarchive.h.

Thanks for sending a patch, that's the split I would have done.

+#include "access/xlogdefs.h"
Oh, I see.  You need that in xlogarchive.h for XLogSegNo.  Makes sense.

+ * xlogarchive.h
+ *     Prototypes of functions for archiving WAL files and restoring
+ *     from the archive.
The only tweak I would have done here is to reword that as "Utilities
for interacting with WAL archives in the backend."

Alvaro, Alexander, do you like this split?  FWIW, I do as it is
simple.
--
Michael