From c5fd74f02e9a05de95f6d6a7dfd5a62ea2152b3a Mon Sep 17 00:00:00 2001 From: Vratislav Podzimek Date: Tue, 10 Mar 2020 14:04:42 +0100 Subject: [PATCH] Preserve state/pg/data/pg_arch directory on upgrades This directory is used by HA setups for speeding up recovery and re-synchronizations. If it existed before the upgrade, it should be recreated after it. Ticket: ENT-5352 Changelog: None (cherry picked from commit 2a04956fda7dfb608734b3ae03e8de5fccfdc49b) --- packaging/common/cfengine-hub/postinstall.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packaging/common/cfengine-hub/postinstall.sh b/packaging/common/cfengine-hub/postinstall.sh index 88775fe70..7e2d00e92 100644 --- a/packaging/common/cfengine-hub/postinstall.sh +++ b/packaging/common/cfengine-hub/postinstall.sh @@ -363,6 +363,14 @@ init_postgres_dir() cp -a "$BACKUP_DIR/data/recovery.conf" "$PREFIX/state/pg/data/recovery.conf" chown cfpostgres "$PREFIX/state/pg/data/recovery.conf" fi + + # Make sure the 'pg_arch' directory exists if it existed before the + # upgrade. This directory is used in HA setups. Files from the directory + # should be discarded so we can just recreate the directory if needed. + if [ -d "$BACKUP_DIR/data/pg_arch" ]; then + mkdir "$PREFIX/state/pg/data/pg_arch" + chown cfpostgres:cfpostgres "$PREFIX/state/pg/data/pg_arch" + fi fi }