pgsql: pg_upgrade: Move all the files generated internally to a subdire - Mailing list pgsql-committers

From Michael Paquier
Subject pgsql: pg_upgrade: Move all the files generated internally to a subdire
Date
Msg-id E1nGYDK-0000y7-JY@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
pg_upgrade: Move all the files generated internally to a subdirectory

Historically, the location of any files generated by pg_upgrade, as of
the per-database logs and internal dumps, has been the current working
directory, leaving all those files behind when using --retain or on a
failure.

Putting all those contents in a targeted subdirectory makes the whole
easier to debug, and simplifies the code in charge of cleaning up the
logs.  Note that another reason is that this facilitates the move of
pg_upgrade to TAP with a fixed location for all the logs to grab if the
test fails repeatedly.

Initially, we thought about being able to specify the output directory
with a new option, but we have settled on using a subdirectory located
at the root of the new cluster's data folder, "pg_upgrade_output.d",
instead, as at the end the new data directory is the location of all the
data generated by pg_upgrade.  There is a take with group permissions
here though: if the new data folder has been initialized with this
option, we need to create all the files and paths with the correct
permissions or a base backup taken after a pg_upgrade --retain would
fail, meaning that GetDataDirectoryCreatePerm() has to be called before
creating the log paths, before a couple of sanity checks on the clusters
and before getting the socket directory for the cluster's host settings.
The idea of the new location is based on a suggestion from Peter
Eisentraut.

Also thanks to Andrew Dunstan, Peter Eisentraut, Daniel Gustafsson, Tom
Lane and Bruce Momjian for the discussion (in alphabetical order).

Author: Justin Pryzby
Discussion: https://postgr.es/m/20211212025017.GN17618@telsasoft.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/38bfae36526636ef55daf7cf2a3282403587cb5b

Modified Files
--------------
doc/src/sgml/ref/pgupgrade.sgml |   4 +-
src/bin/pg_upgrade/.gitignore   |   2 -
src/bin/pg_upgrade/Makefile     |   4 +-
src/bin/pg_upgrade/check.c      |  12 +++--
src/bin/pg_upgrade/dump.c       |   6 ++-
src/bin/pg_upgrade/exec.c       |   5 +-
src/bin/pg_upgrade/function.c   |   3 +-
src/bin/pg_upgrade/option.c     |  22 --------
src/bin/pg_upgrade/pg_upgrade.c | 110 +++++++++++++++++++++++++++-------------
src/bin/pg_upgrade/pg_upgrade.h |  12 +++++
src/bin/pg_upgrade/server.c     |   6 ++-
11 files changed, 113 insertions(+), 73 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Doc: be clearer that foreign-table partitions need user-added co
Next
From: Tom Lane
Date:
Subject: pgsql: Release notes for 14.2, 13.6, 12.10, 11.15, 10.20.