antirez/redis — pull request #1422 by Dieken (2013-12-02 08:52:51+00:00)
Title: humbly vote sentinel with least runid instead of itself

In first failover, since there is no master sentinel yet, if all
sentinels are started at almost same time, then no voting is made
yet, all sentinels will fallback to vote themselves thus all have
not enough votes.

The sentinel timer callback is scheduled with fixed interval 100ms
and next voting happens 6min later by default after a voting failure,
the race condition above may last for very long time, such as half
an hour until some sentinel process lags a little due to OS scheduling.

The solution is to let all sentinels vote the one live sentinel with
lexicographically least runid.

Ticket: https://github.com/antirez/redis/issues/1419