From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Refactor creation of backup_label and backup history files
Date: Mon, 26 Sep 2022 02:19:52 +0000
Message-ID: <E1ocdip-0021sH-Ve@gemulon.postgresql.org> (raw)
Refactor creation of backup_label and backup history files
This change simplifies some of the logic related to the generation and
creation of the backup_label and backup history files, which has become
unnecessarily complicated since the removal of the exclusive backup mode
in commit 39969e2. The code was previously generating the contents of
these files as a string (start phase for the backup_label and stop phase
for the backup history file), one problem being that the contents of the
backup_label string were scanned to grab some of its internal contents
at the stop phase.
This commit changes the logic so as we store the data required to build
these files in an intermediate structure named BackupState. The
backup_label file and backup history file strings are generated when
they are ready to be sent back to the client. Both files are now
generated with the same code path. While on it, this commit renames
some variables for clarity.
Two new files named xlogbackup.{c,h} are introduced in this commit, to
remove from xlog.c some of the logic around base backups. Note that
more could be moved to this new set of files.
Author: Bharath Rupireddy, Michael Paquier
Reviewed-by: Fujii Masao
Discussion: https://postgr.es/m/CALj2ACXWwTDgJqCjdaPyfR7djwm6SrybGcrZyrvojzcsmt4FFw@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/7d708093b7400327658a30d1aa1d5e284d37622c
Modified Files
--------------
src/backend/access/transam/Makefile | 1 +
src/backend/access/transam/meson.build | 1 +
src/backend/access/transam/xlog.c | 221 +++++++++++---------------------
src/backend/access/transam/xlogbackup.c | 80 ++++++++++++
src/backend/access/transam/xlogfuncs.c | 96 ++++++++------
src/backend/backup/basebackup.c | 42 ++++--
src/include/access/xlog.h | 10 +-
src/include/access/xlogbackup.h | 42 ++++++
src/tools/pgindent/typedefs.list | 1 +
9 files changed, 292 insertions(+), 202 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 creation of backup_label and backup history files
In-Reply-To: <E1ocdip-0021sH-Ve@gemulon.postgresql.org>
References: <E1ocdip-0021sH-Ve@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