Skip to content

Commit

Permalink
Adjust max_replication_slots and max_wal_senders in case of failover.
Browse files Browse the repository at this point in the history
Adjust max_replication_slots and max_wal_senders to accommodate
known and unknown replication slots, preventing slot drops during
failovers.
  • Loading branch information
Ibrar Ahmed committed Feb 8, 2024
1 parent 7086c0c commit 736bf84
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions patroni/postgresql/slots.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,15 +335,7 @@ def _drop_incorrect_slots(self, cluster: Cluster, slots: Dict[str, Any], paused:
# drop old replication slots which are not presented in desired slots.
for name in set(self._replication_slots) - set(slots):
if not paused and not self.ignore_replication_slot(cluster, name):
active, dropped = self.drop_replication_slot(name)
if dropped:
logger.info("Dropped unknown replication slot '%s'", name)
else:
self._schedule_load_slots = True
if active:
logger.debug("Unable to drop unknown replication slot '%s', slot is still active", name)
else:
logger.error("Failed to drop replication slot '%s'", name)
logger.info("Ignored unknown replication slot '%s'", name)

# drop slots with matching names but attributes that do not match, e.g. `plugin` or `database`.
for name, value in slots.items():
Expand Down

0 comments on commit 736bf84

Please sign in to comment.