Skip to content

Commit db82a83

Browse files
authored
Fix bug in member slots retention feature (patroni#3142)
If `name` contains upper case or special characters the node was creating unused replication slot for itself.
1 parent 3ecdf01 commit db82a83

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

docs/releases.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
Release notes
44
=============
55

6+
Version 4.0.1
7+
-------------
8+
9+
Released 2024-08-30
10+
11+
**Bugfix**
12+
13+
- Patroni was creating unnecessary replication slots for itself (Alexander Kukushkin)
14+
15+
It was happening if ``name`` contains upper-case or special characters.
16+
17+
618
Version 4.0.0
719
-------------
820

patroni/dcs/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,8 +1170,9 @@ def _get_members_slots(self, name: str, role: str, nofailover: bool,
11701170
# `max` is only a fallback so we take the LSN from the slot when there is no feedback from the member.
11711171
lsn = max(member.lsn or 0, lsn)
11721172
ret[slot_name] = {'type': 'physical', 'lsn': lsn}
1173+
slot_name = slot_name_from_member_name(name)
11731174
ret.update({slot: {'type': 'physical'} for slot in self.status.retain_slots
1174-
if slot not in ret and slot != name})
1175+
if slot not in ret and slot != slot_name})
11751176

11761177
if len(ret) < len(members):
11771178
# Find which names are conflicting for a nicer error message

patroni/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
33
:var __version__: the current Patroni version.
44
"""
5-
__version__ = '4.0.0'
5+
__version__ = '4.0.1'

0 commit comments

Comments
 (0)