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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Alexey Kondratov <a(dot)kondratov(at)postgrespro(dot)ru>
Cc: Alexander Korotkov <a(dot)korotkov(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-03-04 07:45:55
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Mar 02, 2020 at 08:59:49PM +0300, Alexey Kondratov wrote:
> OK, sounds reasonable, but just to be clear. I will remove only a
> possibility to bypass this sanity check (with 0), but leave expectedSize
> argument intact. We still need it, since pg_rewind takes WalSegSz from
> ControlFile and should pass it further, am I right?

We need to keep around the argument, but I think that we give any user
of this routine a favor by making mandatory a file size.

> pg_strip_crlf fits well, but would you mind if I also make pipe_read_line
> external in this patch?

I got to look at that more, and pipe_read_line() is a nice fit.

> Actually, the verb 'construct' is used historically applied to
> archive/restore commands (see also xlogarchive.c and pgarch.c), but it
> should be 'build' in (fe_)archive.c, since we have BuildRestoreCommand there
> now.
> All other remarks look clear for me, so I fix them in the next patch
> version, thanks.

Already done as per the attached, with a new routine named
getRestoreCommand() and more done. There were a couple of extra
things I noticed on the way:
- Found some typos.
- The translation of pg_rewind --help was incorrect, with a sentence
cut in the middle (you used twice gettext).
- I did not actually get why you don't check for a missing command
when using wait_result_is_any_signal. In this case I'd think that it
is better to exit immediately as follow-up calls would just fail.
- The code was rather careless about error handling and
RestoreArchivedWALFile(), and it seemed to me that it is rather
pointless to report an extra message "could not restore file \"%s\"
from archive" on top of the other error.
- I could not resist to add more documentation for the new routines of
- Used long options in the tests for readability, reworked the

On top of that, I have spent some time testing the reliability of the
test, and tested the whole on Windows and Linux. This is in a rather
committable shape now.

Attachment Content-Type Size
v21-0001-pg_rewind-Add-options-to-restore-WAL-files.patch text/x-diff 28.3 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Prabhat Sahu 2020-03-04 07:49:13 Re: [Proposal] Global temporary tables
Previous Message Kyotaro Horiguchi 2020-03-04 07:44:25 Re: [HACKERS] WAL logging problem in 9.4.3?