mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 00:46:29 +00:00
repmgrd: log details of nodes which can see primary
If a failover is cancelled because other nodes can still see the primary, log the identies of those nodes.
This commit is contained in:
@@ -3092,6 +3092,9 @@ do_election(void)
|
|||||||
|
|
||||||
ReplInfo local_replication_info;
|
ReplInfo local_replication_info;
|
||||||
|
|
||||||
|
/* To collate details of nodes with primary visible for logging purposes */
|
||||||
|
PQExpBufferData nodes_with_primary_visible;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if at least one server in the primary's location is visible; if
|
* Check if at least one server in the primary's location is visible; if
|
||||||
* not we'll assume a network split between this node and the primary
|
* not we'll assume a network split between this node and the primary
|
||||||
@@ -3233,6 +3236,8 @@ do_election(void)
|
|||||||
/* pointer to "winning" node, initially self */
|
/* pointer to "winning" node, initially self */
|
||||||
candidate_node = &local_node_info;
|
candidate_node = &local_node_info;
|
||||||
|
|
||||||
|
initPQExpBuffer(&nodes_with_primary_visible);
|
||||||
|
|
||||||
for (cell = sibling_nodes.head; cell; cell = cell->next)
|
for (cell = sibling_nodes.head; cell; cell = cell->next)
|
||||||
{
|
{
|
||||||
ReplInfo sibling_replication_info;
|
ReplInfo sibling_replication_info;
|
||||||
@@ -3332,6 +3337,11 @@ do_election(void)
|
|||||||
nodes_with_primary_still_visible++;
|
nodes_with_primary_still_visible++;
|
||||||
log_notice(_("node %i last saw primary node %i second(s) ago, considering primary still visible"),
|
log_notice(_("node %i last saw primary node %i second(s) ago, considering primary still visible"),
|
||||||
cell->node_info->node_id, sibling_replication_info.primary_last_seen);
|
cell->node_info->node_id, sibling_replication_info.primary_last_seen);
|
||||||
|
appendPQExpBuffer(&nodes_with_primary_visible,
|
||||||
|
" - node \"%s\" (ID: %i): %i second(s) ago\n",
|
||||||
|
cell->node_info->node_name,
|
||||||
|
cell->node_info->node_id,
|
||||||
|
sibling_replication_info.primary_last_seen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -3421,17 +3431,24 @@ do_election(void)
|
|||||||
|
|
||||||
if (nodes_with_primary_still_visible > 0)
|
if (nodes_with_primary_still_visible > 0)
|
||||||
{
|
{
|
||||||
log_notice(_("%i nodes can seen the primary"), nodes_with_primary_still_visible);
|
log_notice(_("%i nodes can see the primary"),
|
||||||
// XXX list nodes as detail
|
nodes_with_primary_still_visible);
|
||||||
|
|
||||||
|
log_detail(_("following nodes can see the primary:\n%s"),
|
||||||
|
nodes_with_primary_visible.data);
|
||||||
|
|
||||||
monitoring_state = MS_DEGRADED;
|
monitoring_state = MS_DEGRADED;
|
||||||
INSTR_TIME_SET_CURRENT(degraded_monitoring_start);
|
INSTR_TIME_SET_CURRENT(degraded_monitoring_start);
|
||||||
|
|
||||||
reset_node_voting_status();
|
reset_node_voting_status();
|
||||||
|
|
||||||
|
termPQExpBuffer(&nodes_with_primary_visible);
|
||||||
|
|
||||||
return ELECTION_CANCELLED;
|
return ELECTION_CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
termPQExpBuffer(&nodes_with_primary_visible);
|
||||||
|
|
||||||
log_info(_("visible nodes: %i; total nodes: %i; no nodes have seen the primary within the last %i seconds"),
|
log_info(_("visible nodes: %i; total nodes: %i; no nodes have seen the primary within the last %i seconds"),
|
||||||
visible_nodes,
|
visible_nodes,
|
||||||
total_nodes,
|
total_nodes,
|
||||||
|
|||||||
Reference in New Issue
Block a user