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'
This commit is contained in:
Alexander Kukushkin
2021-10-29 12:09:38 +02:00
committed by GitHub
parent 14bb28c349
commit fd1e0f1c1b
+1 -1
View File
@@ -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')