Re: Supply restore_command to pg_rewind via CLI argument

From: Alexey Kondratov <kondratov(dot)aleksey(at)gmail(dot)com>
To: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Supply restore_command to pg_rewind via CLI argument
Date: 2021-06-18 19:06:53
Message-ID: CADfU8WwA-xH9xFPnnivh-cSRSo3HK2bokHk=QTk2mBSMe-WwHA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Fri, Jun 18, 2021 at 5:42 PM Andrey Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
>
> If we run 'pg_rewind --restore-target-wal' there must be restore_command in config of target installation. But if the config is not within $PGDATA\postgresql.conf pg_rewind cannot use it.
> If we run postmaster with `-c config_file=/etc/postgresql/10/data/postgresql.conf`, we simply cannot use the feature. We solved the problem by putting config into PGDATA only during pg_rewind, but this does not seem like a very robust solution.
>

Yeah, Michael was against it, while we had no good arguments, so
Alexander removed it, IIRC. This example sounds reasonable to me. I
also recall some complaints from PostgresPro support folks, that it is
sad to not have a cli option to pass restore_command. However, I just
thought about another recent feature --- ensure clean shutdown, which
is turned on by default. So you usually run Postgres with one config,
but pg_rewind may start it with another, although in single-user mode.
Is it fine for you?

>
> Maybe we could add "-C, --target-restore-command=COMMAND target WAL restore_command\n" as was proposed within earlier versions of the patch[0]? Or instruct pg_rewind to pass config to 'postgres -C restore_command' run?

Hm, adding --target-restore-command is the simplest way, sure, but
forwarding something like '-c config_file=...' to postgres sounds
interesting too. Could it have any use case beside providing a
restore_command? I cannot imagine anything right now, but if any
exist, then it could be a more universal approach.

>
> From my POV adding --target-restore-command is simplest way, I can extract corresponding portions from original patch.
>

I will have a look, maybe I even already have this patch separately. I
remember that we were considering adding this option to PostgresPro,
when we did a backport of this feature.

--
Alexey Kondratov

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Dilger 2021-06-18 19:36:28 Re: Optionally automatically disable logical replication subscriptions on error
Previous Message Tom Lane 2021-06-18 18:51:19 Re: Failures with gcd functions with GCC snapshots GCC and -O3 (?)