From fd1e0f1c1bf5bcf8067a8bb4db253c6a9fdb9d41 Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Fri, 29 Oct 2021 12:09:38 +0200 Subject: [PATCH] BUGFIX: use_unix_socket_repl didn't work is some cases (#2103) Specifically, if `postgresql.unix_socket_directories` is not set. In this case Patroni is supposed to use only the port in the connection string, but the `get_replication_connection_cursor()` method defaulted to host='localhost' --- patroni/postgresql/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patroni/postgresql/__init__.py b/patroni/postgresql/__init__.py index 38cd5f89..ad48501d 100644 --- a/patroni/postgresql/__init__.py +++ b/patroni/postgresql/__init__.py @@ -831,7 +831,7 @@ class Postgresql(object): return None, None @contextmanager - def get_replication_connection_cursor(self, host='localhost', port=5432, **kwargs): + def get_replication_connection_cursor(self, host=None, port=5432, **kwargs): conn_kwargs = self.config.replication.copy() conn_kwargs.update(host=host, port=int(port) if port else None, user=conn_kwargs.pop('username'), connect_timeout=3, replication=1, options='-c statement_timeout=2000')