Hi, Michael!
Thank you for your review!
The revised patch is attached.
On Sun, Jan 19, 2020 at 1:24 PM Michael Paquier <michael@paquier.xyz> wrote:
> 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/.
I've put it into src/common/fe_archive.c.
> 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..
I was going to argue that --restore-target-wal is useful. But I
didn't find convincing example for that. Naturally, if one uses
restore_command during pg_rewind then why the same restore_command
can't be used in new standby. So, I've removed --restore-target-wal
argument. If we will find convincing use case we can return it any
moment.
> + 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.
I've rephrased the comment.
> +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?
All extra dependencies have been removed.
> + # 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.
Sure, thank you for pointing!
------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company