mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
repmgrd: handle case where upstream is no longer primary
If the upstream comes back on line (e.g. after a switchover), and its status is no longer primary, restart monitoring to ensure the correct primary (potentially the current node) is being monitored.
This commit is contained in:
@@ -778,6 +778,16 @@ monitor_streaming_standby(void)
|
||||
if (upstream_node_info.type == PRIMARY)
|
||||
{
|
||||
primary_conn = upstream_conn;
|
||||
|
||||
if (get_recovery_type(primary_conn) != RECTYPE_PRIMARY)
|
||||
{
|
||||
log_notice(_("current upstream node \"%s\" (node ID: %i) is not primary, restarting monitoring"),
|
||||
upstream_node_info.node_name, upstream_node_info.node_id);
|
||||
PQfinish(upstream_conn);
|
||||
upstream_conn = NULL;
|
||||
termPQExpBuffer(&event_details);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
initPQExpBuffer(&event_details);
|
||||
|
||||
Reference in New Issue
Block a user