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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
Cc: Alexey Kondratov <a(dot)kondratov(at)postgrespro(dot)ru>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Liudmila Mantrova <l(dot)mantrova(at)postgrespro(dot)ru>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, David Steele <david(at)pgmasters(dot)net>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, vladimirlesk(at)yandex-team(dot)ru, dsarafan(at)yandex-team(dot)ru
Subject: Re: [Patch] pg_rewind: options to use restore_command from recovery.conf or command line
Date: 2020-01-19 10:24:16
Message-ID: 20200119102416.GB7464@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jan 18, 2020 at 06:21:22PM +0300, Alexander Korotkov wrote:
> I made some minor cleanup. In particular, I've to fix usage of terms
> "WAL" and "WALs". This patch sometimes use term "WAL" to specify
> single WAL file and term "WALs" to specify multiple WAL files. But
> WAL stands for Write Ahead Log. So, "WALs" literally stands to
> multiple logs. And we don't use term "WALs" to describe multiple WAL
> files anywhere else. Usage of term "WAL" to describe single file is
> not clear as well.

WAL is a method to ensure data integrity, as the docs mention:
https://www.postgresql.org/docs/11/wal-intro.html

So using WAL to tell about a WAL segment file is wrong, WALs is not a
term that actually exists. So, in my opinion, it is fine to use "WAL
file", "WAL segment" or even "WAL segment file".

I have read through the patch, while on it..

+static int
+RestoreArchivedWALFile(const char *path, const char *xlogfname,
+ off_t expectedSize, const char *restoreCommand)
Not a fan of putting that to pg_rewind/parsexlog.c. It has nothing to
do with WAL parsing, and it seems to me that we could have an argument
for making this available as a frontend-only API in src/common/.

Do we actually need --target-restore-command at all? It seems to me
that we have all we need with --restore-target-wal, and that's not
really instinctive to pass down a command via another command..

+ printf(_(" -c, --restore-target-wal use restore_command in the postgresql.conf\n"));
+ printf(_(" to retrieve WAL
files from archive\n"));
The command could be part of a different configuration file, included
by postgresql.conf.

+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?

+ # Add restore_command to postgresql.conf of target cluster.
+ open(my $conf_fd, ">>", $master_conf_path) or die;
+ print $conf_fd "\nrestore_command='$restore_command'";
+ close $conf_fd;
We have append_conf() for that.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2020-01-19 11:58:23 Re: remove separate postgres.(sh)description files
Previous Message Richard Guo 2020-01-19 08:52:40 Re: Parallel grouping sets