From ff4cc64a67d4d615e600d9dc8d2a02e5e33ca633 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Wed, 5 Jul 2017 13:23:42 +0900 Subject: [PATCH] repmgrd: refresh upstream node record from upstream itself --- repmgrd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/repmgrd.c b/repmgrd.c index 0206b0c0..407dbe88 100644 --- a/repmgrd.c +++ b/repmgrd.c @@ -662,11 +662,14 @@ monitor_streaming_standby(void) // handle failure - do we want to loop here? upstream_conn = establish_db_connection(upstream_node_info.conninfo, false); + /* refresh upstream node record from upstream node, so it's as up-to-date as possible */ + record_status = get_node_record(upstream_conn, upstream_node_info.node_id, &upstream_node_info); + if (upstream_node_info.type == STANDBY) { // XXX check result, we'll require primary connection for now // poss. later add limited connection mode - primary_conn = establish_primary_db_connection(local_conn, false); + primary_conn = establish_primary_db_connection(upstream_conn, false); if (PQstatus(primary_conn) != CONNECTION_OK) { @@ -674,6 +677,8 @@ monitor_streaming_standby(void) log_hint(_("ensure the primary node is reachable from this node")); exit(ERR_DB_CONN); } + + log_verbose(LOG_DEBUG, "connected to primary"); } else {