From fef4e046e1ba2c2d9b9a825b9bb59bed3328a414 Mon Sep 17 00:00:00 2001 From: Oleksii Kliukin Date: Fri, 2 Sep 2016 09:00:03 +0200 Subject: [PATCH] Avoid setting the role to unknown during rewind. Previously, that was necessary in order to avoid repeating the rewind after failure. Nowadays, depending on the failure, we either want to retry (if PostgreSQL was not stopped on time or leader did not manage to acquire a master role yet), or won't retry at all if the leader is not available, assuming the replica role. In both cases, the hack with setting the role to unknown seems to be unnecessary and actually stops callbacks from running if rewind is done not from the first attempt. --- patroni/postgresql.py | 1 - 1 file changed, 1 deletion(-) diff --git a/patroni/postgresql.py b/patroni/postgresql.py index b023faf2..70df0072 100644 --- a/patroni/postgresql.py +++ b/patroni/postgresql.py @@ -782,7 +782,6 @@ class Postgresql(object): if self._need_rewind: logger.info("rewind flag is set") - self.set_role('unknown') if self.is_running() and not self.stop(): return logger.warning('Can not run pg_rewind because postgres is still running')