8.11 Self-test
Self-test34 questions
Why would "abortability" be a better name than "atomicity"? What is atomicity explicitly not about?
Give all five meanings of "consistency" in this book. Which one is the C in ACID, and why is it "not a property of the database alone"?
Name four reasons
fsync-based durability is weaker than it sounds.Why do storage engines universally provide atomicity and isolation for single objects? Give the three failure questions that motivate it.
Give three data-model situations that force you to need multi-object transactions.
What is the whole point of rolling back a transaction, and why do popular ORMs defeat it?
List the five caveats on retrying an aborted transaction. Which one can cause a double charge?
Define dirty read and dirty write. Which does read-committed prevent, and which race condition does it not prevent?
Why don't databases use read locks to prevent dirty reads? What do they do instead?
Walk through the read-skew example. Why is it "acceptable" under read-committed, and where is it not tolerable?
State the MVCC visibility rule for a row in one sentence with two clauses. Why are writes by aborted transactions convenient to ignore?
Why does PostgreSQL call snapshot isolation "repeatable read"? Give two other databases that use that name for something different.
Give five ways to prevent lost updates. Which two stop working under multi-leader/leaderless replication, and why?
Define write skew. Why is it a generalization of lost update?
Why can't
SELECT FOR UPDATEfix the meeting-room-booking case, but it can fix the doctors case?What is a phantom? Why does snapshot isolation prevent phantoms in read-only queries but not in read/write ones?
What is materializing conflicts, and why is it a last resort?
Why do serial-execution systems forbid interactive multistatement transactions? What replaces them?
Give the four constraints under which serial execution is viable, and the cross-shard throughput number.
State the 2PL rule for readers and writers, and contrast it with snapshot isolation's mantra. Which phase is "growing" and which is "shrinking"?
Why don't predicate locks perform well? Why is it safe to approximate a predicate with a broader one?
What happens under 2PL when there is no suitable index for a range lock?
Explain SSI's two detection mechanisms. Why does SSI wait until commit rather than aborting on a stale read?
Why is a "tripwire" different from a lock, and why does that make SSI's latency more predictable than 2PL's?
Why isn't sending commit to every node sufficient? Give the concrete reason a committed node can't retract.
List the six steps of 2PC and name the two points of no return.
A participant voted yes and the coordinator crashed. Enumerate what the participant may and may not do, and why a timeout doesn't help.
Why does 3PC not solve this in practice?
Give the four fundamental problems with XA. Which one survives even a replicated coordinator?
What is a "heuristic decision" a euphemism for?
List the four fixes that make database-internal distributed transactions work where XA doesn't.
Reproduce the four-step idempotency protocol for exactly-once processing, and show that no crash window produces a duplicate side effect.
Fill in the anomaly table from memory. Which cell is "depends," and on what?
- Design question
you run a ticketing system. Invariants: (a) a seat is sold at most once, (b) a customer's balance never goes negative, (c) an event never oversells past capacity even across 200 concurrent purchase requests. The data is sharded by event ID; balances live in a separate service. Choose isolation levels, concurrency-control mechanisms, and a strategy for the cross-service part. State exactly which anomaly each choice prevents, and where you're relying on idempotency rather than atomicity.