repmgrd: fix priority/node_id tie-break check

This commit is contained in:
Ian Barwick
2017-11-09 12:39:26 +09:00
parent 4ca7e6a6bf
commit 331e982bdb

View File

@@ -1943,14 +1943,25 @@ do_election(void)
candidate_node->priority); candidate_node->priority);
candidate_node = cell->node_info; candidate_node = cell->node_info;
} }
else if (cell->node_info->node_id < candidate_node->node_id) else if (cell->node_info->priority == candidate_node->priority)
{ {
log_verbose(LOG_DEBUG, "node %i has lower node_id than current t candidate %i", if (cell->node_info->node_id < candidate_node->node_id)
{
log_verbose(LOG_DEBUG, "node %i has same priority but lower node_id than current candidate %i",
cell->node_info->node_id, cell->node_info->node_id,
candidate_node->node_id); candidate_node->node_id);
candidate_node = cell->node_info; candidate_node = cell->node_info;
} }
} }
else
{
log_verbose(LOG_DEBUG, "node %i has lower priority (%i) than current candidate %i (%i)",
cell->node_info->node_id,
cell->node_info->priority,
candidate_node->node_id,
candidate_node->priority);
}
}
/* /*
* see if the node is in the primary's location (but skip the check if * see if the node is in the primary's location (but skip the check if
* we've seen a node there already) * we've seen a node there already)