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

Alvaro Herrera <alvherre@2ndquadrant.com>

From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Alexander Korotkov <a.korotkov@postgrespro.ru>, Alexey Kondratov <a.kondratov@postgrespro.ru>, 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-01-19T21:08:37Z
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 2020-Jan-19, Michael Paquier wrote:

> So using WAL to tell about a WAL segment file is wrong, WALs is not a
> term that actually exists.

I agree.

> So, in my opinion, it is fine to use "WAL file", "WAL segment" or even
> "WAL segment file".

Agreed with these three terms -- "WAL file" seems to be the most common,
but the other two terms you suggest are just as good.

> +use File::Glob ':bsd_glob';
> +use File::Path qw(remove_tree make_path);
> +use File::Spec::Functions qw(catdir catfile);
> Is this compatible with our minimum perl requirements for the TAP
> tests?

By and large, we just join elements with a slash "foo/bar" to create
path names; no need for catdir or catfile, ISTM.

I *think* :bsd_glob should be available in all the Perl versions we
support, but I'm not sure that we really need it.  We seem to do just
fine with regular glob elsewhere.

PostgresNode already uses File::Path's rmtree.  Looking at its manual,
maybe the safest bet is to change all that to remove_tree.

Not sure about make_path.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services