Skip to content

Commit

Permalink
Refactor creation of backup_label and backup history files
Browse files Browse the repository at this point in the history
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
  • Loading branch information
michaelpq committed Sep 26, 2022
1 parent 216f9c1 commit 7d70809
Show file tree
Hide file tree
Showing 9 changed files with 292 additions and 202 deletions.
1 change: 1 addition & 0 deletions src/backend/access/transam/Makefile
Expand Up @@ -29,6 +29,7 @@ OBJS = \
xact.o \
xlog.o \
xlogarchive.o \
xlogbackup.o \
xlogfuncs.o \
xloginsert.o \
xlogprefetcher.o \
Expand Down
1 change: 1 addition & 0 deletions src/backend/access/transam/meson.build
Expand Up @@ -15,6 +15,7 @@ backend_sources += files(
'xact.c',
'xlog.c',
'xlogarchive.c',
'xlogbackup.c',
'xlogfuncs.c',
'xloginsert.c',
'xlogprefetcher.c',
Expand Down

0 comments on commit 7d70809

Please sign in to comment.