repmgrd: improve monitoring statistics logging

Add more granular logging to help diagnose issues, and also keep track
of when the last monitoring statistics update was set and emit that
as DETAIL every time we emit a log status update.
This commit is contained in:
Ian Barwick
2018-08-29 14:48:30 +09:00
parent 9681708b1a
commit ceeb6d7130
2 changed files with 45 additions and 13 deletions

View File

@@ -4146,13 +4146,12 @@ add_monitoring_record(PGconn *primary_conn,
}
else
{
PGresult *res = NULL;
res = PQexec(local_conn, "SELECT repmgr.standby_set_last_updated()");
PGresult *res = PQexec(local_conn, "SELECT repmgr.standby_set_last_updated()");
/* not critical if the above query fails */
if (PQresultStatus(res) != PGRES_TUPLES_OK)
log_warning(_("unable to set last_updated:\n %s"), PQerrorMessage(local_conn));
log_warning(_("add_monitoring_record(): unable to set last_updated:\n %s"),
PQerrorMessage(local_conn));
PQclear(res);
}