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.
This commit is contained in:
Oleksii Kliukin
2016-02-04 19:27:26 +01:00
parent 03b56ae5b9
commit 09ecd1cbec
+3 -3
View File
@@ -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)