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: Alexander Korotkov <a.korotkov@postgrespro.ru>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, Alexey Kondratov <a.kondratov@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-06-08T06:14:52Z
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 Sun, Jun 07, 2020 at 10:05:03PM +0300, Alexander Korotkov wrote:
> On Sat, Jun 6, 2020 at 8:49 PM Peter Eisentraut
> <peter.eisentraut@2ndquadrant.com> wrote:
>> Why is fe_archive.c in src/common/ and not in src/fe_utils/?  It is not
>> "common" to frontend and backend.
> 
> Yep, this seems wrong to me.  I can propose following file rename.
> 
> src/common/fe_archive.c => src/fe_utils/archive.c
> include/common/fe_archive.h => include/fe_utils/archive.h

Is it technically a problem though?  fe_archive.c is listed as a
frontend-only file with OBJS_FRONTEND in src/common/Makefile.  Anyway,
for this one I would not mind to do the move so please see the
attached, but I am not completely sure either why src/fe_utils/ had
better be chosen than src/common/.

>> It actually defines functions that clash with functions in the backend,
>> so this seems doubly wrong. 
> 
> Let's have frontend version of RestoreArchivedFile() renamed as well.
> What about RestoreArchivedFileFrontend()?

-1 from me for the renaming, which was intentional to ease grepping
with the backend counterpart.  We have other cases like that, say
palloc(), fsync_fname(), etc.

Perhaps we have more things that are frontend-only in src/common/ that
could be moved to src/fe_utils/?  I am looking at restricted_token.c,
fe_memutils.c, logging.c and file_utils.c here, but that would mean
breaking a couple of declarations, something never free for plugin
developers.
--
Michael