These problems use the dictionary of Module 10 in both directions and the lemma “intersecting quorums carry memory”. For Multi-Paxos we use the PMMC names of Module 9. Unless stated otherwise, each server runs a colocated replica, leader and acceptor.
Problem 1
Problem 10.1 (Translate the event).For each event, name the corresponding event in the other protocol, or explain why there is none.
- Raft: a follower rejects an AppendEntries because its
is 7 and the request carries term 6. - PMMC: a scout of ballot
receives a p1b that contains . - Raft: a follower rejects an AppendEntries because it has no entry at
. - PMMC: a leader receives adopted and updates its proposals with pmax.
- Raft: a server denies its vote because the candidate’s last entry has a lower term than its own.
Solution
- A commander’s p2a meets an acceptor whose
is higher; the p2b carries that ballot and the commander reports preempted, after which the leader becomes inactive. In Raft the old leader steps down to follower. - There is no event that transfers an entry from voter to candidate in Raft. The closest analogue is a RequestVote reaching a voter that stores an entry of term 4 at index 9: the voter does not send it, but it refuses the candidate unless the candidate’s log is at least as up-to-date. The information is used as a filter instead of being transferred.
- None. Slots in PMMC are independent; an acceptor accepts a pvalue for slot
whether or not it has anything for earlier slots. The consistency check exists only to maintain Log Matching, which PMMC does not need. - Winning the election in Raft (votes from a majority) followed by nothing: a Raft leader has nothing to merge, because the up-to-date rule already guarantees it holds every committed entry. The pmax update is the step that Raft moves into the voting rule.
- Again none directly: a Paxos acceptor never refuses a p1a with a higher ballot because of its accepted values. Raft’s refusal and Paxos’s pmax are the two answers to the same need (Module 10, “Filter versus transfer”).
Problem 2
Problem 10.2 (One leader change, traced twice).Five servers S1 to S5. Positions 1 to 3 are decided everywhere. S1 is leader (term 3, ballot
). It replicates command for position 4 to S2 and S3, and both acknowledge, so is committed (decided). It replicates command for position 5 to S2 only. Then S1 crashes.
- Raft: write the logs from index 4 on. Which of S2 to S5 can win term 4? For each possible winner, what happens to
and to ? - PMMC: S4 starts a scout with ballot
and gets p1b from S3, S4 and S5. What does pmax return for slots 4 and 5, and what does S4 propose there? What changes if the p1b come from S2, S4 and S5 instead? - In PMMC, could slot 5 have been decided as
before the crash while slot 4 was still undecided? Could the analogous thing happen in Raft?
Solution
- Logs (terms) from index 4: S1
, S2 , S3 , S4 and S5 empty beyond index 3, with last entries of some term at index 3. Last (term, index): S2 , S3 , S4 and S5 with . In every case
- S2 gets votes from S3, S4, S5: wins. It holds
and ; after its term-4 no-op reaches a majority, both are committed. - S3 gets votes from S4 and S5 (S2 refuses): 3 of 5, wins. It holds
but not . Its AppendEntries make S2 delete ; position 5 gets S3’s next entry. This is allowed: was never committed. - S4 or S5: S2 and S3 refuse, so at most 2 votes; cannot win.
survives, as Leader Completeness requires. - Only S3 has accepted anything for slots 4 and 5:
. pmax maps slot 4 to and has no entry for slot 5. S4 proposes and, for slot 5, whatever its replica proposes (or a no-op if it needs slot 5 filled). Command is not lost for the client: the replica that proposed it will re-propose it in a later slot. With p1b from S2, S4, S5, pmax maps slot 4 to and slot 5 to (both from S2), and S4 re-proposes both. Either way survives: every majority of contains S2 or S3, an instance of the quorum lemma. - Yes in PMMC: commanders for slots 4 and 5 run independently, and if
‘s p2a had reached two acceptors other than S1 while ‘s were delayed, slot 5 could be decided first. Replicas would still execute slot 4 first, once it is decided. In Raft no: an AppendEntries for index 5 succeeds only on a follower that matches at index 4, so every follower holding index 5 holds index 4, and the leader’s commit index covers 4 whenever it covers 5.
Problem 3
Problem 10.3 (Counting messages and delays).A cluster of
servers. Count the messages and the one-way message delays from the moment a client sends a write until it receives the reply. Messages from a server to itself are free and instantaneous; ignore heartbeats and retransmissions.
- Raft with a stable leader. The leader replies to the client after applying the entry.
- Raft, first write after a leader change: the candidate has just timed out when the request arrives, and the client already knows who it is.
- PMMC with colocated processes and a stable active leader; the client sends its request to the leader’s server only, and decisions go to all replicas.
- Single-decree Paxos run per command, with the same proposer every time.
Which counts match, and why is the comparison between 1 and 4 not fair?
Solution
- Request 1, AppendEntries 4, replies 4, response 1: 10 messages. Delays: client to leader, leader to followers, followers back, leader to client: 4 (the leader waits only for the two fastest followers). The commit is announced in the next AppendEntries, which is not on the client’s path.
- Add an election: RequestVote 4 and replies 4, two more delays, and in practice the no-op of the new term rides in the same AppendEntries as the client’s entry. Total 18 messages, 6 delays.
- Request 1, p2a 4, p2b 4, decisions 4, response 1: 14 messages, 4 delays (the decision to the other replicas is off the critical path, like Raft’s commit announcement). The difference from Raft (14 against 10) is only that PMMC sends the decision as its own message instead of piggybacking it.
- Phase 1 every time: p1a 4, p1b 4, p2a 4, p2b 4, plus request, response and decision messages: 22 messages, 6 delays.
Item 1 and item 3 match in delays, and in messages up to piggybacking; item 2 and item 4 match too. Comparing 1 with 4 compares a protocol that amortizes its first round trip with one that does not; the fair partner of Raft is Multi-Paxos.
Problem 4
Problem 10.4 (Quorums that are not majorities).Let
. Raft uses a vote quorum of size and a commit quorum of size ; Paxos uses a Phase-1 quorum of size and a Phase-2 quorum of size .
- Using the lemma “intersecting quorums carry memory”, show that Paxos with
and still satisfies C2: a value chosen at ballot is proposed by every commander of a higher ballot. - Show that Paxos with
and is also safe, but that Raft with and is not. Which Raft property fails, and why does Paxos not need it? - Show by an execution that
is unsafe for Paxos. - Show that the lemma fails if acceptors may forget
on restart, even with majorities: give an execution with in which two different values are chosen for one slot.
Solution
- Any set of 4 and any set of 3 out of 6 intersect, since
(Module 3, quorum intersection). The proof of C2 uses only that the scout’s quorum meets the quorum that accepted the chosen value: by the lemma some acceptor in the scout’s quorum accepted before replying, and the induction over intermediate ballots proceeds unchanged. Nothing in the proof uses that two Phase-1 quorums or two Phase-2 quorums intersect. - Paxos:
, so the argument of part 1 applies again. Two Phase-1 quorums of size 3 can be disjoint, so two leaders can be adopted concurrently, but they have different ballots (a ballot contains its leader’s id), so C1 still holds and the higher ballot wins as usual. Raft: two vote quorums of size 3 can be disjoint, so two candidates can both win the same term, violating Election Safety; the two leaders of one term can then create different entries with the same (index, term), and Log Matching and everything after it fails. Raft needs vote quorums to intersect because its terms do not name a leader; Paxos’s ballots do. - Acceptors A1 to A6. Leader
with ballot 1 runs Phase 1 with A1, A2, A3 and Phase 2 with A1, A2, A3: value is chosen. Leader with ballot 2 runs Phase 1 with A4, A5, A6, which have accepted nothing, so pmax is empty, and proposes in Phase 2 to A4, A5, A6: is chosen. Two values for one slot. - Acceptors A1, A2, A3. Leader
has been adopted with ballot 1 (Phase 1 with A1 and A2). Leader with ballot 2 now runs Phase 1 with A2 and A3; both set and report nothing, so is adopted with an empty pmax. A2 crashes and restarts with forgotten (reset to 0). ’s p2a reaches A1 and A2, and both accept: is chosen at ballot 1. proposes to A2 and A3, and both accept: is chosen at ballot 2. The lemma’s only step fails at A2: it replied to the read with number 2 and afterwards accepted a write with number 1, because the restart removed the fence.
Problem 5
Problem 10.5 (True or false).Decide each claim and justify your answer in two or three sentences.
- “Paxos is leaderless, so it never needs an election.”
- “A new Raft leader never receives log entries from its followers; a new PMMC leader always receives the accepted pvalues of a majority.”
- “Because Paxos renumbers adopted values under its own ballot, it does not need Raft’s current-term commit rule.”
- “A Multi-Paxos replica may execute slot 7 before slot 6 is decided, because slots are independent.”
- “Raft and Multi-Paxos both implement total order broadcast, and both deliver the commands of one client in the order the client sent them.”
Solution
- False. Each ballot has exactly one proposer, and Multi-Paxos keeps an active leader for many slots; the scout’s Phase 1 plays the role of the election, and competing leaders preempt each other just as Raft candidates split votes. Only single-decree Paxos run once per value lacks a long-lived leader.
- True. Raft’s RequestVote replies carry only a term and a yes or no; the leader’s log is complete by the up-to-date rule and it never copies entries from followers. In PMMC every p1b carries the acceptor’s accepted set (possibly empty), and adoption requires a majority of p1b.
- True. Raft’s problem is that an old-term entry copied to a majority keeps its old term and can lose to a candidate with a higher last term. A Paxos leader proposes adopted values under its own ballot, so a majority that accepts them records the new ballot, and pmax of any later scout prefers it.
- False. Decisions may arrive out of order, but a replica executes only
, then increments it; slot 7 waits until slot 6 is decided and executed (R3 and the execution loop). The independence of slots applies to deciding, not to executing. - The first half is true. The second half is false for PMMC even without failures: a command that loses its slot is re-proposed in a later slot and can land after the client’s next command (Module 10, the example of PMMC reordering). Raft keeps the arrival order at one leader, but a command lost at a leader change and resent later can also be reordered; both need client sequence numbers for FIFO across failures.