Learn Labs
10. Consistency and Consensus

10.9 Self-test

Self-test40 questions

—/40
  1. State the two philosophies for handling replica inconsistency and one situation where each is the only viable choice.

  2. Define linearizability in one sentence. Why is it called a recency guarantee?

  3. In the sports example, why does the violation depend on Aaliyah speaking? What is that channel called in general?

  4. Given a write concurrent with three reads, which reads must return the old value, which must return the new, and which may return either?

  5. State the extra constraint beyond "concurrent reads may return either." What would go wrong without it?

  6. Distinguish linearizability from serializability on three axes. What is the combination called?

  7. Give three categories of situation that genuinely require linearizability, and one type of constraint that does not.

  8. Draw the video-transcoder race. Why does linearizable storage fix it, and what is the alternative if you control the queue?

  9. For each replication method, say whether it can be linearizable and what breaks it.

  10. Reproduce the quorum counterexample. What two changes would make Dynamo-style quorums linearizable, and what can never be made linearizable that way?

  11. State the CAP trade-off properly. Why is "pick two of three" misleading?

  12. Give three specific criticisms the book makes of CAP as a design tool.

  13. Why is RAM on a multi-core CPU not linearizable? What does that tell you about why systems drop linearizability?

  14. State the Attiya–Welch result and its practical consequence.

  15. Give four distributed ID schemes and say precisely what ordering property each loses.

  16. State the three requirements of a logical clock. Which one do sharded/UUID/timestamp schemes fail?

  17. Give the two Lamport clock update rules and the comparison rule. Trace the chat example.

  18. Give two limitations of Lamport clocks, and explain how HLCs fix each.

  19. Why can't you tell from two Lamport timestamps whether the events were concurrent? What data structure can, and what does it cost?

  20. Walk through the privacy-leak example. Which exact property of linearizability is violated, and why can't an HLC provide it?

  21. Describe the batched timestamp oracle. What does batching sacrifice, and what does it preserve?

  22. Why can't you shard a linearizable ID generator?

  23. Why is a linearizable ID generator still insufficient for fault-tolerant locking?

  24. What does the FLP result actually prove? Name the two ways real systems escape it.

  25. State the four properties of single-value consensus. Which is the liveness property, and what is the minimum-node requirement it imposes?

  26. Show both directions of the CAS ⟺ consensus equivalence.

  27. State the five properties of a shared log. Sketch both directions of shared-log ⟺ consensus.

  28. Why does fetch-and-add fail to solve consensus for three nodes but succeed for two? What is the term for this?

  29. What is the one crucial difference between consensus and atomic commitment?

  30. List six things you can build on top of a shared log.

  31. How do consensus algorithms escape "you need a leader to elect a leader"? Name the epoch number in three algorithms.

  32. Explain the quorum-overlap requirement between the two voting rounds. What does it prevent?

  33. Give two ways consensus voting differs from 2PC.

  34. What is unclean leader election, what does it buy, and what does it cost?

  35. Why must linearizable reads also go through a quorum?

  36. List five costs of consensus. Which one means you cannot scale throughput by adding nodes?

  37. Which coordination-service features require consensus and which don't? Why is it still convenient to get the latter from the same service?

  38. What is the architectural argument for a fixed 3–5 node coordination service in a system with thousands of shards?

  39. Why is using consensus for service discovery usually overkill? What are ZooKeeper observers for?

  40. Design question

    you're building a multi-region ticketing platform. Requirements: (a) a seat is sold at most once globally, (b) a user's "my tickets" page must show a purchase immediately after buying, (c) browsing seat availability must stay fast and available even during a region partition, (d) event IDs must be sortable by creation time. For each requirement, state which consistency guarantee you need, which mechanism provides it, what it costs in latency, and what degrades during a partition. Identify at least one requirement you would deliberately weaken and justify it.