Back to Module 9 notes

This set practises the leader’s adoption step, the replica’s slot bookkeeping, and the invariants of Paxos Made Moderately Complex: what each says, which line of code enforces it, and how the safety proof chains them together.

Problem 1

Problem 9.1 (pmax and the update operator).

Ballots are written and compared lexicographically. Let

and let a leader’s proposals be .

  1. Compute .
  2. Compute and list the commanders the leader spawns after adoption.
  3. Is the same set? Which order does the leader use, and why is the other order unsafe?

Problem 2

Problem 9.2 (Adoption trace).

Three acceptors A1, A2, A3 are in the following state (pvalues in accepted):

  • A1: ballot_num , accepted ;
  • A2: ballot_num , accepted ;
  • A3: ballot_num , accepted .

Leader L2 is inactive with ballot_num and proposals .

  1. Which commands can already be chosen, in which slots? Justify.
  2. L2’s scout for sends p1a to all acceptors. Give each reply and say what the scout does.
  3. L2 then uses ballot and its scout hears from A2 and A3 first. Give pvals, the new proposals, and the commanders spawned.
  4. Same as part 3 but the scout hears from A1 and A2. What changes? Explain why both outcomes are consistent with part 1.

Problem 3

Problem 9.3 (A replica with WINDOW = 2).

A replica starts with slot_in = slot_out = 1, empty sets and . The following events happen in order:

  1. request ; 2. request ; 3. request ; 4. decision; 5. decision; 6. decision; 7. decision.

After each event, give slot_in, slot_out, requests, proposals, and the commands applied so far. Assume propose picks requests in index order. Which invariant explains why the replica does not propose at event 3? What happens to at event 7?

Problem 4

Problem 9.4 (Which invariant is violated?).

Each scenario describes a buggy implementation. Name the invariant it violates first (from A1-A5, C1, C2, R1-R5) and describe an execution in which the bug leads to two replicas deciding different commands for the same slot, or explain why it cannot.

  1. An acceptor that receives a p2a with accepts it anyway and replies p2b(self, b).
  2. A leader, on propose while active, spawns a commander even if proposals already has a different command for slot .
  3. A replica that restarts sets slot_out := 1 and re-applies all decisions to a fresh state.
  4. On adopted, the leader sets proposals := pmax(pvals) <| proposals.
  5. To save memory, an acceptor deletes from accepted every pvalue for slots it has already seen decided.

Problem 5

Problem 9.5 (From C2 to R1).

Assume C1 and C2 as proved in the module.

  1. Prove A5: if a majority has in accepted and some acceptor has with , then .
  2. Prove that if a replica receives decision, then for some ballot a majority of acceptors have in accepted. Point to the exact lines of the acceptor and commander code you use.
  3. Conclude R1.
  4. Where exactly would the proof of part 3 fail if acceptors used “any two” instead of “a majority” with five acceptors?