* debian/patches/avoid_overwriting_configuration_during_boostrap.patch: New

patch, avoids streaming a backup of the primary's postgresql.conf file
    during bootstrap, overwriting the standby's postgresql.base.conf and
    possible preventing PostgreSQL to start up.
This commit is contained in:
Michael Banck 2022-07-29 15:02:46 +02:00
parent cefbea9eb6
commit bb19fd1462
3 changed files with 47 additions and 0 deletions

5
debian/changelog vendored
View file

@ -1,5 +1,10 @@
patroni (2.1.4-2) UNRELEASED; urgency=medium
[ Michael Banck ]
* debian/patches/avoid_overwriting_configuration_during_boostrap.patch: New
patch, avoids streaming a backup of the primary's postgresql.conf file
during bootstrap, overwriting the standby's postgresql.base.conf and
possible preventing PostgreSQL to start up.
-- Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org> Thu, 02 Jun 2022 16:59:30 +0200

View file

@ -0,0 +1,41 @@
commit a3776e0dfb2f0c5a9e5174f948122b8fb33ceebc
Author: Michael Banck <michael.banck@credativ.de>
Date: Fri Jul 29 14:55:15 2022 +0200
Make backup copies of configuration files in config_dir.
Before, the .backup files were always done in the data directory. However, if
there is a distinct configuration directory, it seems logical to put them
there. If config_dir is not configured, it defaults back to the data directory,
so this will not change things for setups where postgresql.conf is in the data
directory.
On the other hand, it will help with setups where postgresql.conf is outside
the data directory and has local changes. In this case, those no longer get
overwritten on boostrap/clone from the primary's backup configuration file that
is streamed to the boostrapped node.
Close #2370
diff --git a/patroni/postgresql/config.py b/patroni/postgresql/config.py
index 9314315..976cf48 100644
--- a/patroni/postgresql/config.py
+++ b/patroni/postgresql/config.py
@@ -362,7 +362,7 @@ class ConfigHandler(object):
try:
for f in self._configuration_to_save:
config_file = os.path.join(self._config_dir, f)
- backup_file = os.path.join(self._postgresql.data_dir, f + '.backup')
+ backup_file = os.path.join(self._config_dir, f + '.backup')
if os.path.isfile(config_file):
shutil.copy(config_file, backup_file)
except IOError:
@@ -374,7 +374,7 @@ class ConfigHandler(object):
try:
for f in self._configuration_to_save:
config_file = os.path.join(self._config_dir, f)
- backup_file = os.path.join(self._postgresql.data_dir, f + '.backup')
+ backup_file = os.path.join(self._config_dir, f + '.backup')
if not os.path.isfile(config_file):
if os.path.isfile(backup_file):
shutil.copy(backup_file, config_file)

View file

@ -4,3 +4,4 @@ requirements_setuptools.patch
offline_intersphinx.patch
requirements_cdiff.patch
regression_tests_disable_raft_tests.py
avoid_overwriting_configuration_during_boostrap.patch