mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
repmgrd: additional location check
If only one promotion candidate is available, check it is in the same location as the primary.
This commit is contained in:
18
repmgrd.c
18
repmgrd.c
@@ -1204,7 +1204,7 @@ do_primary_failover(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// should never reach here
|
/* should never reach here */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1889,8 +1889,20 @@ do_election(void)
|
|||||||
|
|
||||||
if (standby_nodes.node_count == 0)
|
if (standby_nodes.node_count == 0)
|
||||||
{
|
{
|
||||||
log_debug("no other nodes - we win by default");
|
if (strncmp(upstream_node_info.location, local_node_info.location, MAXLEN) == 0)
|
||||||
return ELECTION_WON;
|
{
|
||||||
|
log_debug("no other nodes - we win by default");
|
||||||
|
return ELECTION_WON;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log_debug("no other nodes, but primary and standby locations differ");
|
||||||
|
|
||||||
|
monitoring_state = MS_DEGRADED;
|
||||||
|
INSTR_TIME_SET_CURRENT(degraded_monitoring_start);
|
||||||
|
|
||||||
|
return ELECTION_NOT_CANDIDATE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (cell = standby_nodes.head; cell; cell = cell->next)
|
for (cell = standby_nodes.head; cell; cell = cell->next)
|
||||||
|
|||||||
Reference in New Issue
Block a user