repmgrd: catch cases where more than one node has initiated voting

The node(s) with higher ID will "yield", leaving the decision making
up to the node with the lower ID.

This happens very rarely, usually when the random delay is close
enough on two or mode nodes that vote initiation is simultaneous.
This commit is contained in:
Ian Barwick
2017-07-18 17:04:24 +09:00
parent 248525ccba
commit 6e270b2faf
4 changed files with 93 additions and 29 deletions

View File

@@ -206,13 +206,11 @@ request_vote(PG_FUNCTION_ARGS)
initStringInfo(&query);
#if (PG_VERSION_NUM >= 100000)
appendStringInfo(
&query,
#if (PG_VERSION_NUM >= 100000)
"SELECT pg_catalog.pg_last_wal_receive_lsn()");
#else
appendStringInfo(
&query,
"SELECT pg_catalog.pg_last_xlog_receive_location()");
#endif