From 09ecd1cbece954beab765c772b9628eb1d673ffe Mon Sep 17 00:00:00 2001 From: Oleksii Kliukin Date: Thu, 4 Feb 2016 19:27:26 +0100 Subject: [PATCH] Fix another issue with replication slots. Do not try to create replication slots on the replica for the member that wants to replicate from it if the member's currently holds the master role. Remove a debug message. --- patroni/postgresql.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patroni/postgresql.py b/patroni/postgresql.py index 113d8e31..44d5acc3 100644 --- a/patroni/postgresql.py +++ b/patroni/postgresql.py @@ -660,9 +660,9 @@ $$""".format(name, options), name, password, password) (m.replicatefrom is None or m.replicatefrom == self.name or not cluster.has_member(m.replicatefrom))] else: - # only manage slots for replicas that want to replicate from this one - slots = [m.name for m in cluster.members if m.replicatefrom == self.name] - logger.info("setting replication slots for members {0}".format(slots)) + # only manage slots for replicas that replicate from this one, except for the leader among them + slots = [m.name for m in cluster.members if m.replicatefrom == self.name and + m.name != cluster.leader.name] # drop unused slots for slot in set(self.replication_slots) - set(slots): self.query("""SELECT pg_drop_replication_slot(%s)