From f6a6df3600572d8493f0540ba86bad03f31f3d4c Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Thu, 16 Nov 2017 17:17:17 +0900 Subject: [PATCH] repmgrd: renable monitoring data recording when in archive recovery. The warning emitted gives the impression that monitoring data shouldn't be written if there's no streaming replication, but we can and should do this as long as we have a primary connection. Explictly document this in the code. Also remove an unused variable warning. --- repmgrd-physical.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/repmgrd-physical.c b/repmgrd-physical.c index a32b496c..a7617f8e 100644 --- a/repmgrd-physical.c +++ b/repmgrd-physical.c @@ -1076,6 +1076,18 @@ monitor_streaming_witness(void) */ record_status = get_node_record(primary_conn, upstream_node_info.node_id, &upstream_node_info); + /* + * This is unlikely to happen; if it does emit a warning for diagnostic + * purposes and plough on regardless. + * + * A check for the existence of the record will have already been carried out + * in main(). + */ + if (record_status != RECORD_FOUND) + { + log_warning(_("unable to retrieve node record from primary")); + } + /* Log startup event */ if (startup_event_logged == false) @@ -1587,14 +1599,14 @@ update_monitoring_history(void) } /* - * this can be the case when a standby is starting up after following - * a new primary + * This can be the case when a standby is starting up after following + * a new primary, or when it has dropped back to archive recovery. + * As long as we can connect to the primary, we can still provide lag information. */ if (replication_info.receiving_streamed_wal == false) { log_verbose(LOG_WARNING, _("standby %i not connected to streaming replication"), local_node_info.node_id); - return; } primary_last_wal_location = get_current_wal_lsn(primary_conn);