From 74c0acf36d40b0424c177e0cffe3dc5348f14730 Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Wed, 16 Oct 2024 11:00:29 +0200 Subject: [PATCH] Fix issue with mixed setups: primary on pre-v4 and replicas on v4+ (#3181) Reported in #3171 --- patroni/dcs/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/patroni/dcs/__init__.py b/patroni/dcs/__init__.py index 7eb67373..db776b78 100644 --- a/patroni/dcs/__init__.py +++ b/patroni/dcs/__init__.py @@ -1199,12 +1199,13 @@ class Cluster(NamedTuple('Cluster', else: members = [m for m in members if expected_active(m)] + leader_patroni_version = self.leader and self.leader.member.patroni_version slots: Dict[str, int] = self.slots ret: Dict[str, Dict[str, Any]] = {} for member in members: slot_name = slot_name_from_member_name(member.name) lsn = slots.get(slot_name, 0) - if member.replicatefrom: + if member.replicatefrom or leader_patroni_version and leader_patroni_version < (4, 0, 0): # `/status` key is maintained by the leader, but `member` may be connected to some other node. # In that case, the slot in the leader is inactive and doesn't advance, so we use the LSN # reported by the member to advance replication slot LSN.