repmgrd: ensure standby_nodes list is up-to-date

This commit is contained in:
Ian Barwick
2017-07-03 20:22:48 +09:00
parent 890b88d644
commit cc46058a8e

View File

@@ -620,6 +620,14 @@ monitor_streaming_standby(void)
log_info("I am the candidate but did not get all votes; will now determine the best candidate");
/* reset node list */
clear_node_info_list(&standby_nodes);
get_active_sibling_node_records(local_conn,
local_node_info.node_id,
upstream_node_info.node_id,
&standby_nodes);
best_candidate = poll_best_candidate(&standby_nodes);
/* this can occur in a tie-break situation, after we establish this node has priority*/
@@ -886,6 +894,8 @@ poll_best_candidate(NodeInfoList *standby_nodes)
NodeInfoListCell *cell;
t_node_info *best_candidate = &local_node_info;
// XXX ensure standby_nodes is set correctly
/*
* we need to definitively decide the best candidate, as in some corner
* cases we could end up with two candidate nodes, so they should each