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

From: Alexey Kondratov <a(dot)kondratov(at)postgrespro(dot)ru>
To: Michael Paquier <michael(at)paquier(dot)xyz>
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-05 16:52:24
Message-ID: c77a8726-5878-e733-e962-7de5a6847aee@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 05.03.2020 09:24, Michael Paquier wrote:
> On Wed, Mar 04, 2020 at 08:14:20PM +0300, Alexey Kondratov wrote:
>>> - 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.
>> Believe me or not, but I put 'false' there intentionally. The idea was that
>> if the reason is a signal, then maybe user tired of waiting and killed that
>> restore_command process theirself or something like that, so it is better to
>> exit immediately. If it was a missing command, then there is no hurry, so we
>> can go further and complain that attempt of recovering WAL segment has
>> failed.
>>
>> Actually, I guess that there is no big difference if we include missing
>> command here or not. There is no complicated logic further compared to real
>> recovery process in Postgres, where we cannot simply return false in that
>> case.
> On the contrary, it seems to me that the difference is very important.
> Imagine for example a frontend tool which calls RestoreArchivedWALFile
> in a loop, and that this one fails because the command called is
> missing. This tool would keep looping for nothing. So checking for a
> missing command and leaving immediately would be more helpful for the
> user. Can you think about scenarios where it would make sense to be
> able to loop in this case instead of failing?

OK, I was still having in mind pg_rewind as the only one user of this
routine. Now it is a part of the common and I could imagine a
hypothetical tool that is polling the archive and waiting for a specific
WAL segment to become available. In this case 'command not found' is
definitely the end of game, while the absence of segment is expected
error, so we can continue looping.

Regards

--
Alexey Kondratov

Postgres Professional https://www.postgrespro.com
Russian Postgres Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2020-03-05 16:55:39 Re: backup manifests
Previous Message Justin Pryzby 2020-03-05 16:18:38 Re: pg_ls_tmpdir to show directories and shared filesets