repmgrd: skip LSN checks of 0 priority node

The node will never become a candidate so we can save the round trip
to fetch its LSN.
This commit is contained in:
Ian Barwick
2019-02-06 14:25:57 +09:00
parent 984ce7420b
commit b9cd321aed

View File

@@ -3072,6 +3072,8 @@ _print_election_result(ElectionResult result)
/*
* Failover decision for nodes attached to the current primary.
*
* NB: this function sets standby_nodes; caller (do_primary_failover)
* expects to be able to read this list
*/
@@ -3221,10 +3223,15 @@ do_election(void)
log_debug("node %i is witness, not querying state", cell->node_info->node_id);
continue;
}
/* XXX don't check 0-priority nodes */
/* get node's LSN - if "higher" than current winner, current node is candidate */
/* don't check 0-priority nodes */
if (cell->node_info->priority == 0)
{
log_debug("node %i has priority of 0, skipping",
cell->node_info->node_id);
}
else
{
/* get node's last receive LSN - if "higher" than current winner, current node is candidate */
cell->node_info->last_wal_receive_lsn = get_last_wal_receive_location(cell->node_info->conn);
log_verbose(LOG_DEBUG, "node %i's last receive LSN is: %X/%X",
@@ -3275,7 +3282,7 @@ do_election(void)
candidate_node->priority);
}
}
}
}
if (primary_location_seen == false)