Back to Module 5 notes

This set practises the voting rules, the term rules, and the quorum argument behind Election Safety.

Problem 1

Problem 5.1 (Majorities and failure detectors).
  1. For servers, give the number of votes a candidate needs and the largest number of crashed servers with which an election can still succeed.
  2. A cluster is configured with 10 servers and 2 of them are down for maintenance (lecture 07.02). How many votes does a candidate need? Explain in two sentences why “a majority of the 8 live servers” would be unsafe.
  3. Why does a 4-server cluster tolerate no more crashed servers than a 3-server cluster?
  4. A follower suspects the leader after hearing nothing for 200 ms. Is this failure detector perfect, eventually perfect, or neither, in a partially synchronous system? Justify in one or two sentences.

Problem 2

Problem 5.2 (Tracing two elections).

Five servers A to E start as followers in term 0 with no vote. Logs are empty, so the up-to-date check always passes.

  1. A and E time out at the same moment and both start an election. A’s RequestVote reaches B and C before E’s does; E’s reaches D before A’s. Afterwards all remaining requests and replies are delivered. Give the final (role, currentTerm, votedFor) of every server, and say who leads which term.
  2. Next, A’s heartbeats to D are lost for a while, so D times out. Its RequestVote reaches every server, including A. Give the new (role, currentTerm, votedFor) of every server after all requests and replies are delivered. What happens to A, and why?
  3. Much later a delayed reply VoteReply(term 1, granted) from C to E arrives. What does E do with it, and which line of the pseudocode decides?

Problem 3

Problem 5.3 (A stale leader across two partitions).

Five servers A to E; C is leader of term 2 and every server is in term 2. The network splits into {A, C} and {B, D, E}.

  1. Can {B, D, E} elect a leader? If yes, in which term at the earliest, and with which votes?
  2. Meanwhile C asks its side to acknowledge a request of term 2. Which acknowledgements can it collect, and can it reach a majority?
  3. Suppose B was elected leader of term 3 by B, D, E. The partition now changes to {A, C, D} and {B, E}. C sends a term-2 request to A and D. What does each reply, and what does C do next?
  4. Can B still collect a majority of term-3 acknowledgements? Can {A, C, D} elect a new leader, and in which term at the earliest?

Problem 4

Problem 5.4 (Is this execution allowed?).

For each statement about a run of the protocol of Module 5 (5 servers, correct implementation), say whether it can happen. If not, name the rule or result it contradicts.

  1. At the same instant, A is leader of term 3 and B is leader of term 4.
  2. A is leader of term 4 at 10:00, and B is leader of term 4 at 10:05 (A crashed in between).
  3. After a restart, C’s currentTerm is 3; before the crash it was 5.
  4. C votes for B in term 4 and for D in term 5.
  5. C votes for B in term 4, crashes, restarts, and votes for D in term 4.
  6. D is elected leader of term 4 by C, D, E. Afterwards, A, leader of term 3, receives acknowledgements of a term-3 request from A, B and C, all sent after D’s election.
  7. With D and E crashed, C becomes leader with the votes of A, B and C.

Problem 5

Problem 5.5 (Election Safety for general quorum systems).

Replace “majority” in voting rule 3 by “a set in ”, where is a fixed family of subsets of the servers (a quorum system). The other rules are unchanged.

  1. Prove: if every two sets in intersect, then at most one server becomes leader in each term.
  2. Prove: if contains two disjoint sets and , then there is an execution in which two different servers become leader in the same term.
  3. Let the servers be A, B, C, D and let consist of and all sets of three or more servers. Show that every two sets in intersect. Which sets of two crashed servers can this system survive, compared with majorities of 4?