Re: PATCH: add "--config-file=" option to pg_rewind - Mailing list pgsql-hackers

From Gunnar \"Nick\" Bluth
Subject Re: PATCH: add "--config-file=" option to pg_rewind
Date
Msg-id 635d61d3-a1de-95e5-50fb-7225066ff12f@pro-open.de
Whole thread Raw
In response to Re: PATCH: add "--config-file=" option to pg_rewind  (Michael Paquier <michael@paquier.xyz>)
Responses Re: PATCH: add "--config-file=" option to pg_rewind  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
Am 26.02.22 um 06:51 schrieb Michael Paquier:
> On Fri, Feb 25, 2022 at 10:35:49AM +0100, Gunnar "Nick" Bluth wrote:
>> Am 24.02.22 um 14:46 schrieb Daniel Gustafsson:
>>> Actually, I think this looks like a saner approach.  Putting a config setting
>>> in two place (postgresql.conf and on the commandline for pg_rewind) is a recipe
>>> for them diverging.
> 
> FWIW, I have a bad feeling about passing down directly a command
> through an option itself part of a command, so what's discussed on
> this thread is refreshing.

Ta.

> 
> +       } else {
> +               snprintf(postgres_cmd, sizeof(postgres_cmd),
> +                        "\"%s\" -D \"%s\" --config_file=\"%s\" -C restore_command",
> +                        postgres_exec_path, datadir_target, config_file);
> +       }
> 
> Shouldn't this one use appendShellString() on config_file?

It probably should, yes. I don't fancy this repetitive code myself.
But then, pg_rewind as a whole could use an overhaul. I don't see any 
use of PQExpBuffer in it, but a lot of char* ...

I myself am not a C hacker (as you can probably tell already) and don't 
really feel fit (enough) to rewrite pg_rewind.c to use 
fe_utils/string_utils.h :/

I might give it a try anyhow, but that may be a bit... heavy,,, just to 
add one option?

While we're at it (I'm really good at opening cans of worms):
09:47 $ grep -r -l --include \*.c fe_utils/string_utils.h src/bin/ | wc -l
28
09:48 $ grep -r -L --include \*.c fe_utils/string_utils.h src/bin/ | wc -l
66

GSOC project? ;-)

Best,
-- 
Gunnar "Nick" Bluth

Eimermacherweg 106
D-48159 Münster

Mobil +49 172 8853339
Email: gunnar.bluth@pro-open.de
__________________________________________________________________________
"Ceterum censeo SystemD esse delendam" - Cato



pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Re: Allow async standbys wait for sync replication (was: Disallow quorum uncommitted (with synchronous standbys) txns in logical replication subscribers)
Next
From: Bharath Rupireddy
Date:
Subject: Re: Allow async standbys wait for sync replication (was: Disallow quorum uncommitted (with synchronous standbys) txns in logical replication subscribers)