From 2a9ef418d6068c36e6f69f6e1aa33f813a671d3e Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Fri, 25 Oct 2019 14:53:05 +0200 Subject: [PATCH] Return the real member name when picking the sync standby (#1253) Before we returned it in the lower case, what was preventing such a standby from promoting due to the name comparison mismatch. Fixes https://github.com/zalando/patroni/issues/1252 --- patroni/postgresql/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patroni/postgresql/__init__.py b/patroni/postgresql/__init__.py index fc1941f8..08a2ce32 100644 --- a/patroni/postgresql/__init__.py +++ b/patroni/postgresql/__init__.py @@ -813,9 +813,9 @@ class Postgresql(object): return app_name, True if sync_state == 'potential' and app_name == current: # Prefer current even if not the best one any more to avoid indecisivness and spurious swaps. - return current, False + return cluster.sync.sync_standby, False if sync_state in ('async', 'potential'): - candidates.append(app_name) + candidates.append(member.name) if candidates: return candidates[0], False