From 091541619d8859115f99e3bb302419592191d6a1 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Wed, 6 Jul 2016 09:27:31 +0900 Subject: [PATCH] Fix repmgrd monitoring calculation when in archive recovery --- repmgrd.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/repmgrd.c b/repmgrd.c index 27d612bb..4982ae71 100644 --- a/repmgrd.c +++ b/repmgrd.c @@ -961,7 +961,7 @@ standby_monitor(void) if (active_master_id != master_options.node) { - log_notice(_("connecting to active master (node %i)...\n"), active_master_id); \ + log_notice(_("connecting to active master (node %i)...\n"), active_master_id); if (master_conn != NULL) { PQfinish(master_conn); @@ -1057,11 +1057,8 @@ standby_monitor(void) strncpy(last_wal_primary_location, PQgetvalue(res, 0, 0), MAXLEN); PQclear(res); - lsn_master_current_xlog_location = lsn_to_xlogrecptr(last_wal_primary_location, NULL); lsn_last_xlog_replay_location = lsn_to_xlogrecptr(last_xlog_replay_location, NULL); - lsn_last_xlog_receive_location = lsn_to_xlogrecptr(last_xlog_receive_location, NULL); - /* Calculate apply lag */ if (last_xlog_receive_location_gte_replayed == false) @@ -1072,10 +1069,12 @@ standby_monitor(void) */ apply_lag = 0; strncpy(last_xlog_receive_location, last_xlog_replay_location, MAXLEN); + lsn_last_xlog_receive_location = lsn_to_xlogrecptr(last_xlog_replay_location, NULL); } else { apply_lag = (long long unsigned int)lsn_last_xlog_receive_location - lsn_last_xlog_replay_location; + lsn_last_xlog_receive_location = lsn_to_xlogrecptr(last_xlog_receive_location, NULL); } /* Calculate replication lag */