Fix bug in member slots retention feature (#3142)

If `name` contains upper case or special characters the node was creating unused replication slot for itself.
This commit is contained in:
Alexander Kukushkin
2024-08-30 16:36:05 +02:00
committed by GitHub
parent 3ecdf01b50
commit db82a83eb4
3 changed files with 15 additions and 2 deletions

View File

@@ -3,6 +3,18 @@
Release notes
=============
Version 4.0.1
-------------
Released 2024-08-30
**Bugfix**
- Patroni was creating unnecessary replication slots for itself (Alexander Kukushkin)
It was happening if ``name`` contains upper-case or special characters.
Version 4.0.0
-------------

View File

@@ -1170,8 +1170,9 @@ class Cluster(NamedTuple('Cluster',
# `max` is only a fallback so we take the LSN from the slot when there is no feedback from the member.
lsn = max(member.lsn or 0, lsn)
ret[slot_name] = {'type': 'physical', 'lsn': lsn}
slot_name = slot_name_from_member_name(name)
ret.update({slot: {'type': 'physical'} for slot in self.status.retain_slots
if slot not in ret and slot != name})
if slot not in ret and slot != slot_name})
if len(ret) < len(members):
# Find which names are conflicting for a nicer error message

View File

@@ -2,4 +2,4 @@
:var __version__: the current Patroni version.
"""
__version__ = '4.0.0'
__version__ = '4.0.1'