* debian/patches/reclone-unable-pg_rewind.patch: New patch, reclones from the

primary if use_pg_rewind and remove_data_directory_on_rewind_failure are
    set, but the postgres password is empty.
This commit is contained in:
Michael Banck 2019-02-08 17:40:16 +01:00
parent bb564a258d
commit ec96dc075d
3 changed files with 26 additions and 0 deletions

3
debian/changelog vendored
View file

@ -8,6 +8,9 @@ patroni (1.5.4-8) UNRELEASED; urgency=medium
* debian/patches/behave_failure_logging.patch: Likewise.
* debian/patches/acceptance_tests_postgres_port.patch: Refreshed.
* debian/patches/acceptance_tests_system_patroni.patch: Likewise.
* debian/patches/reclone-unable-pg_rewind.patch: New patch, reclones from the
primary if use_pg_rewind and remove_data_directory_on_rewind_failure are
set, but the postgres password is empty.
-- Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org> Thu, 07 Feb 2019 18:13:20 +0100

View file

@ -0,0 +1,22 @@
diff --git a/patroni/postgresql.py b/patroni/postgresql.py
index d031d84..a006660 100644
--- a/patroni/postgresql.py
+++ b/patroni/postgresql.py
@@ -1400,7 +1400,16 @@ class Postgresql(object):
# make it store the new timeline (5540277D.8020309@iki.fi)
leader_status = self.checkpoint(r)
if leader_status:
- return logger.warning('Can not use %s for rewind: %s', leader.name, leader_status)
+ logger.warning('Can not use %s for rewind: %s', leader.name, leader_status)
+ for name in ('remove_data_directory_on_rewind_failure', 'remove_data_directory_on_diverged_timelines'):
+ if self.config.get(name):
+ logger.warning('%s is set. removing...', name)
+ self.remove_data_directory()
+ self._rewind_state = REWIND_STATUS.INITIAL
+ break
+ else:
+ self._rewind_state = REWIND_STATUS.FAILED
+ return False
if self.pg_rewind(r):
self._rewind_state = REWIND_STATUS.SUCCESS

View file

@ -8,3 +8,4 @@ automatic_primary_reinit.patch
patronictl_timeline_info.patch
acceptance_tests_postgres_port.patch
fix_replication_connection.patch
reclone-unable-pg_rewind.patch