From aaea24b58b9c8ee6298bdc0f069dbc3c055102cf Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Fri, 22 May 2020 14:21:17 +0900 Subject: [PATCH] repmgrd: log reconnection of paired connection --- repmgrd.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/repmgrd.c b/repmgrd.c index 4d9d1e9f..da7abe2c 100644 --- a/repmgrd.c +++ b/repmgrd.c @@ -884,6 +884,12 @@ check_upstream_connection(PGconn **conn, const char *conninfo, PGconn **paired_c /* reconnect */ PQfinish(*conn); *conn = PQconnectdb(conninfo); + + if (paired_conn != NULL) + { + log_debug("resetting paired connection"); + *paired_conn = *conn; + } twice = true; } else @@ -916,16 +922,16 @@ check_upstream_connection(PGconn **conn, const char *conninfo, PGconn **paired_c log_debug("check_upstream_connection(): upstream connection not available, resetting"); PQfinish(*conn); *conn = PQconnectdb(conninfo); + + if (paired_conn != NULL) + { + log_debug("resetting paired connection"); + *paired_conn = *conn; + } twice = true; } } - if (paired_conn != NULL) - { - log_debug("resetting paired connection"); - *paired_conn = *conn; - } - return true; }