Do not drop active replication slots

This commit is contained in:
Murat Kabilov
2016-08-23 17:30:24 +02:00
parent c50f072b31
commit 97f7576fab
2 changed files with 4 additions and 1 deletions
+3
View File
@@ -346,6 +346,9 @@ class Ha(object):
self.dcs.manual_failover('', '', index=self.cluster.failover.index)
def process_unhealthy_cluster(self):
if self.is_paused():
return "No action due to paused state"
if self.is_healthiest_node():
if self.acquire_lock():
if self.cluster.failover:
+1 -1
View File
@@ -900,7 +900,7 @@ $$""".format(name, ' '.join(options)), name, password, password)
for slot in set(self._replication_slots) - set(slots):
self.query("""SELECT pg_drop_replication_slot(%s)
WHERE EXISTS(SELECT 1 FROM pg_replication_slots
WHERE slot_name = %s)""", slot, slot)
WHERE slot_name = %s AND NOT active)""", slot, slot)
# create new slots
for slot in set(slots) - set(self._replication_slots):