mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
repmgrd: add notice about different location preventing standby promotion
Though we note this in the DEBUG output, it's not immediately obvious from the logs, especially outside of the DEBUG log level, why a node didn't promote itself if it is in a different location to the primary.
This commit is contained in:
@@ -1664,7 +1664,19 @@ do_primary_failover(void)
|
||||
}
|
||||
else if (election_result == ELECTION_LOST || election_result == ELECTION_NOT_CANDIDATE)
|
||||
{
|
||||
log_info(_("follower node awaiting notification from the candidate node"));
|
||||
/*
|
||||
* if the node couldn't be promoted as it's not in the same location as the primary,
|
||||
* add an explanatory notice
|
||||
*/
|
||||
if (election_result == ELECTION_NOT_CANDIDATE && strncmp(upstream_node_info.location, local_node_info.location, MAXLEN) != 0)
|
||||
{
|
||||
log_notice(_("this node's location (\"%s\") is not the primary node location (\"%s\"), so node cannot be promoted"),
|
||||
local_node_info.location,
|
||||
upstream_node_info.location);
|
||||
}
|
||||
|
||||
log_info(_("follower node awaiting notification from a candidate node"));
|
||||
|
||||
failover_state = FAILOVER_STATE_WAITING_NEW_PRIMARY;
|
||||
}
|
||||
|
||||
@@ -2766,7 +2778,9 @@ do_election(void)
|
||||
|
||||
total_nodes = sibling_nodes.node_count + 1;
|
||||
|
||||
log_debug("do_election(): primary location is %s", upstream_node_info.location);
|
||||
log_debug("do_election(): primary location is \"%s\", standby location is \"%s\"",
|
||||
upstream_node_info.location,
|
||||
local_node_info.location);
|
||||
|
||||
local_node_info.last_wal_receive_lsn = InvalidXLogRecPtr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user