From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Refactor code in charge of running shell-based recovery commands
Date: Mon, 16 Jan 2023 07:32:47 +0000
Message-ID: <E1pHJz4-003urB-TM@gemulon.postgresql.org> (raw)
Refactor code in charge of running shell-based recovery commands
The code specific to the execution of archive_cleanup_command,
recovery_end_command and restore_command is moved to a new file named
shell_restore.c. The code is split into three functions:
- shell_restore(), that attempts the execution of a shell-based
restore_command.
- shell_archive_cleanup(), for archive_cleanup_command.
- shell_recovery_end(), for recovery_end_command.
This introduces no functional changes, with failure patterns and logs
generated in consequence being the same as before (one case actually
generates one less DEBUG2 message "could not restore" when a restore
command succeeds but the follow-up stat() to check the size fails, but
that only matters with a elevel high enough).
This is preparatory work for allowing recovery modules, a facility
similar to archive modules, with callbacks shaped similarly to the
functions introduced here.
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/9a740f81eb02e04179d78f3df2ce671276c27b07
Modified Files
--------------
src/backend/access/transam/Makefile | 1 +
src/backend/access/transam/meson.build | 1 +
src/backend/access/transam/shell_restore.c | 175 +++++++++++++++++++++++++++++
src/backend/access/transam/xlog.c | 37 ++++--
src/backend/access/transam/xlogarchive.c | 120 +-------------------
src/include/access/xlogarchive.h | 7 +-
6 files changed, 214 insertions(+), 127 deletions(-)
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 in charge of running shell-based recovery commands
In-Reply-To: <E1pHJz4-003urB-TM@gemulon.postgresql.org>
References: <E1pHJz4-003urB-TM@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