From db82a83eb4a3f2ec8f2489e1a01f8ad94deaecd1 Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Fri, 30 Aug 2024 16:36:05 +0200 Subject: [PATCH] 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. --- docs/releases.rst | 12 ++++++++++++ patroni/dcs/__init__.py | 3 ++- patroni/version.py | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/releases.rst b/docs/releases.rst index 7fab424..2c42ea9 100644 --- a/docs/releases.rst +++ b/docs/releases.rst @@ -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 ------------- diff --git a/patroni/dcs/__init__.py b/patroni/dcs/__init__.py index b13d91a..1185367 100644 --- a/patroni/dcs/__init__.py +++ b/patroni/dcs/__init__.py @@ -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 diff --git a/patroni/version.py b/patroni/version.py index ceb3b22..d716e60 100644 --- a/patroni/version.py +++ b/patroni/version.py @@ -2,4 +2,4 @@ :var __version__: the current Patroni version. """ -__version__ = '4.0.0' +__version__ = '4.0.1'