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: Alexey Kondratov <a.kondratov@postgrespro.ru>
Cc: Alexander Korotkov <a.korotkov@postgrespro.ru>, Alvaro Herrera <alvherre@2ndquadrant.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-03-04T07:45:55Z
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 →
-
Move frontend-side archive APIs from src/common/ to src/fe_utils/
- 8d8b89266ca0 13.0 landed
- a3b2bf1fe7ce 14.0 landed
-
Add -c/--restore-target-wal to pg_rewind
- a7e8ece41cf7 13.0 landed
-
Move routine definitions of xlogarchive.c to a new header file
- 616ae3d2b056 13.0 landed
-
Move routine building restore_command to src/common/
- e09ad07b21a2 13.0 landed
-
Integrate recovery.conf into postgresql.conf
- 2dedf4d9a899 12.0 cited
Attachments
- v21-0001-pg_rewind-Add-options-to-restore-WAL-files.patch (text/x-diff) patch v21-0001
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 src/common/.. - Used long options in the tests for readability, reworked the comments. 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. -- Michael