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: Refactor code for restoring files via shell commands
Date: Wed, 18 Jan 2023 02:17:19 +0000
Message-ID: <E1pHy0t-004DV6-I3@gemulon.postgresql.org> (raw)

Refactor code for restoring files via shell commands

Presently, restore_command uses a different code path than
archive_cleanup_command and recovery_end_command.  These code paths
are similar and can be easily combined, as long as it is possible to
identify if a command should:
- Issue a FATAL on signal.
- Exit immediately on SIGTERM.

While on it, this removes src/common/archive.c and its associated
header.  Since the introduction of c96de2c, BuildRestoreCommand() has
become a simple wrapper of replace_percent_placeholders() able to call
make_native_path().  This simplifies shell_restore.c as long as
RestoreArchivedFile() includes a call to make_native_path().

Author: Nathan Bossart
Reviewed-by: Andres Freund, Michael Paquier
Discussion: https://postgr.es/m/20221227192449.GA3672473@nathanxps13

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/14bdb3f13de16523609d838b725540af5e23ddd3

Modified Files
--------------
src/backend/access/transam/shell_restore.c | 98 ++++++++++++++----------------
src/backend/access/transam/xlogarchive.c   |  1 -
src/common/Makefile                        |  1 -
src/common/archive.c                       | 60 ------------------
src/common/meson.build                     |  1 -
src/fe_utils/archive.c                     | 11 +++-
src/include/common/archive.h               | 21 -------
src/tools/msvc/Mkvcbuild.pm                |  2 +-
8 files changed, 56 insertions(+), 139 deletions(-)



Message-ID: <E1pHy0t-004DV6-I3@gemulon.postgresql.org>
Permalink:  ../E1pHy0t-004DV6-I3@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pHy0t-004DV6-I3@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: Refactor code for restoring files via shell commands
  In-Reply-To: <E1pHy0t-004DV6-I3@gemulon.postgresql.org>
  References: <E1pHy0t-004DV6-I3@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