pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Rework internal command generation of pg_rewind
Date: Tue, 01 Mar 2022 03:52:53 +0000
Message-ID: <E1nOtZE-000NzJ-Fk@gemulon.postgresql.org> (raw)

Rework internal command generation of pg_rewind

pg_rewind generates and executes internally up to two commands to work
on the target cluster, depending on the options given by its caller:
- postgres -C to retrieve the value of restore_command, when using
-c/--restore-target-wal.
- postgres --single to enforce recovery once and get the target cluster
in a clean shutdown state.

Both commands have been applying incorrect quoting rules, which could
lead to failures when for example using a target data directory with
unexpected characters like CRLFs.  Those commands are now generated with
PQExpBuffer, making use of string_utils.h to quote those commands as
they should.  We may extend those commands in the future with more
options, so this makes any upcoming additions easier.

This is arguably a bug fix, but nobody has complained about the existing
code being a problem either, so no backpatch is done.

Extracted from a larger patch by the same author.

Author: Gunnar "Nick" Bluth
Discussion: https://postgr.es/m/7c59265d-ac50-b0aa-ca1e-65e8bd27642a@pro-open.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a33e17f210547226ada52d2b8af851c3553bb4fa

Modified Files
--------------
src/bin/pg_rewind/pg_rewind.c | 43 +++++++++++++++++++++++++++++++++----------
1 file changed, 33 insertions(+), 10 deletions(-)



Message-ID: <E1nOtZE-000NzJ-Fk@gemulon.postgresql.org>
Permalink:  ../E1nOtZE-000NzJ-Fk@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nOtZE-000NzJ-Fk@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Rework internal command generation of pg_rewind
  In-Reply-To: <E1nOtZE-000NzJ-Fk@gemulon.postgresql.org>
  References: <E1nOtZE-000NzJ-Fk@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox