This set practises the SMR argument, the broadcast-versus-update table, the two reductions between consensus and total order broadcast, and the safety/liveness reading of FLP and the majority bound.
Problem 1
Problem 4.1 (Safety or liveness).Classify each property as safety or liveness (Definition 4.14) and say whether a correct Raft or Paxos implementation may need timing assumptions to guarantee it.
- No two nodes decide different values.
- Every request submitted by a client to a correct node is eventually applied.
- At most one leader exists per term.
- A replica never applies log entry 7 before log entry 6.
- If a leader is elected, it eventually commits a new entry.
Solution
- Safety (agreement); guaranteed without any timing assumption.
- Liveness; needs partial synchrony (after GST), by Theorem 4.16 it cannot be guaranteed in every asynchronous execution.
- Safety; follows from majority votes, independent of timing.
- Safety: a violation is a finite event that no continuation undoes; no timing needed.
- Liveness: in every finite prefix the leader may still commit later. It needs the leader to stay up and connected with a majority for long enough, which holds only after GST.
Problem 2
Problem 4.2 (Which updates may use causal broadcast).Replicas hold an integer
, initially . Updates are , , and .
- Which pairs among
commute? Give a counterexample for each pair that does not. - Client P broadcasts
; client Q, concurrently, broadcasts . Using causal broadcast, replica R1 delivers then , replica R2 delivers then . Compute both final states. Which assumption of Theorem 4.8 fails? - Repeat part 2 with
and instead. Do the replicas converge, and why? - Replace causal broadcast by best-effort broadcast in part 3, and suppose R2 receives
twice because of a retry. What happens, and which property from the table is missing?
Solution
and commute (both add constants). : , . : , . : , . : , . : , . So only commutes (and each update commutes with itself). - R1:
. R2: . The replicas diverge because the concurrent updates and do not commute, violating the hypothesis of Theorem 4.8. - R1:
, R2: . They converge, by Theorem 4.8, since the only concurrent pair commutes. - R2 computes
while R1 has 9. Adding a constant is not idempotent, and best-effort broadcast requires updates that are commutative and idempotent and tolerate loss. Commutativity alone does not handle duplicates (the exam trap in Module 4).
Problem 3
Problem 4.3 (Running the TOB-from-consensus construction).Three nodes A, B, C run algorithm (2) of Theorem 4.11. Ids sort by sender (A before B before C) and then by sequence number.
Before instance 1, A has received
, B has , C has . Instance 1 decides C’s proposal. Before instance 2, A has received
, B has , C has . Instance 2 decides C’s proposal.
- Give each node’s proposal in both instances and the common delivered sequence after instance 2.
- Node A received
before , but delivers first. Does this violate any property of total order broadcast? Of FIFO-total order broadcast? - Using algorithm (1) on top of this TOB, each node proposed its first message as its consensus value. What does every node decide?
- Could instance 2 decide
, given these received sets? Could it decide ?
Solution
- Instance 1: A proposes
, B proposes , C proposes . Decided ; everyone delivers . Instance 2: pending sets are received minus : A , B , C . Decided C’s set; sorted by id: . Common sequence . - No. Total order requires the same order everywhere, not the reception order. FIFO-total order is also respected: each sender’s messages (
before ) are delivered in sending order; messages of different senders may be ordered arbitrarily. - The first delivered message is
at every node, so every node decides C’s value (Theorem 4.11, part 1). : no, it is not any node’s proposal, and validity of consensus requires the decided value to be a proposed value. : no, for the same reason (also is already delivered, so no node proposes it).
Problem 4
Problem 4.4 (The majority bound for four nodes).Consider
nodes A, B, C, D in the partially synchronous model.
- Carry out the proof of Theorem 4.18 for
, : name the groups and the three executions, and say exactly which nodes decide what in the final one. - Why does the same argument fail for
, ? - A designer proposes: “With
, let any 2 nodes form a quorum, but break ties by node id: the group containing A wins.” Explain why this does not escape the theorem. (Hint: what is now?)
Solution
, , each of size . : everyone proposes 0, C and D crash at the start; A and B must decide (termination) and decide 0 (validity), by time . : everyone proposes 1, A and B crash; C and D decide 1 by . : A, B propose 0, C, D propose 1, nobody crashes, all messages between the groups are delayed beyond (GST later). A and B see exactly what they see in up to and decide 0; C and D see what they see in and decide 1. Agreement is violated with zero crashes. - With
any split has a group of size at least 3 . The execution in which that group crashes is not allowed, so that group is not obliged to decide on its own, and the indistinguishability argument breaks. - The rule lets a pair containing A decide alone, but a pair without A (such as
) may not. Then the crash of A and B leaves C and D unable to decide, so termination fails with 2 crashes: the algorithm tolerates only , and agrees with the theorem. Any rule that lets both halves of some split decide on their own is exactly what the proof refutes; a rule that does not let both decide gives up tolerance of one half crashing.
Problem 5
Problem 4.5 (Is this sequencer failover correct).A system implements total order broadcast with a sequencer (Module 2) and automatic failover: if the followers do not hear from the sequencer for 2 seconds, the follower with the lowest id becomes the new sequencer and continues numbering from the highest sequence number it has delivered.
Nodes: sequencer S, followers A, B. S sequences
(number 1) and (number 2). reaches A and B. reaches B only; then S is cut off by a network fault for 3 seconds (it is not crashed).
- A becomes the new sequencer. Which number does A give to the next message
? What do A and B deliver as message number 2? - Which property of Definition 4.3 is violated, and which property of consensus would have prevented it?
- After the fault heals, S is still running and believes it is the sequencer. What further problem appears, and how do terms (Module 5) address it?
- Does the 2-second timeout itself cause the safety violation? Relate your answer to the key point of Module 4.
Solution
- A has delivered only
, so it numbers as 2. A delivers as number 2. B already delivered as number 2, and will either deliver as number 2 as well (a second “number 2”) or reject it. Either way A’s sequence and B’s sequence are not prefixes of one another. - The total order (prefix) property is violated. The choice “what is message number 2” is a consensus instance; agreement of consensus would force A to learn that B already delivered
before choosing. Real protocols ensure this by requiring the new leader to collect state from a majority (Paxos Phase 1) or by electing only an up-to-date node (Raft’s voting restriction). - Two sequencers (split brain): S keeps numbering 3, 4, … while A also numbers. Terms give every leadership a number, each node votes at most once per term, and a node rejects messages from a lower term; S learns of the higher term and steps down.
- No. A timeout can always fire wrongly (S was slow, not crashed). The bug is that safety depended on the timeout being accurate. Correct consensus algorithms keep safety in every execution and use timeouts only for liveness (Module 4, the key point on timing).