repmgrd: prevent standby connection handle from going stale

If monitoring history not in use, there's no activity on the standby's
connection handle, so if e.g. the standby is restarted, PQstatus()
never returns CONNECTION_BAD and repmgrd never notices the connection
is stale. Therefore execute a throw-away statement at "monitor_interval_secs".
This commit is contained in:
Ian Barwick
2018-04-23 23:51:03 +09:00
committed by Ian Barwick
parent fd0b850f41
commit 4455ded935
3 changed files with 22 additions and 0 deletions

View File

@@ -3847,6 +3847,21 @@ is_server_available_params(t_conninfo_param_list *param_list)
}
/*
* Simple throw-away query to stop a connection handle going stale
*/
void
connection_ping(PGconn *conn)
{
PGresult *res = PQexec(conn, "SELECT TRUE");
PQclear(res);
return;
}
/* ==================== */
/* monitoring functions */
/* ==================== */