mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 00:46:29 +00:00
poke it around until it works less badly
This commit is contained in:
16
repmgrd.c
16
repmgrd.c
@@ -576,7 +576,8 @@ monitor_streaming_standby(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// store lsndiffs, in the event we're not the best node,
|
||||
// i.e. don't get all the votes, we pass the baton to the best node
|
||||
static NodeVotingStatus
|
||||
do_election(void)
|
||||
{
|
||||
@@ -598,6 +599,8 @@ do_election(void)
|
||||
|
||||
long unsigned rand_wait = (long) ((rand() % 50) + 10) * 10000;
|
||||
|
||||
bool other_node_is_candidate = false;
|
||||
|
||||
log_debug("do_election(): sleeping %li", rand_wait);
|
||||
|
||||
pg_usleep(rand_wait);
|
||||
@@ -646,10 +649,21 @@ do_election(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (announce_candidature(cell->node_info->conn, &local_node_info, cell->node_info) == false)
|
||||
{
|
||||
log_debug("node %i is candidate", cell->node_info->node_id);
|
||||
other_node_is_candidate = true;
|
||||
}
|
||||
|
||||
cell->node_info->is_visible = true;
|
||||
visible_nodes ++;
|
||||
}
|
||||
|
||||
if (other_node_is_candidate == true)
|
||||
{
|
||||
return VS_NO_VOTE;
|
||||
}
|
||||
|
||||
// XXX check if > 50% visible
|
||||
|
||||
/* check again if we've been asked to vote */
|
||||
|
||||
Reference in New Issue
Block a user