Questions: Distributed Databases: Replication Models and Consistency
5 questions to test your understanding
Score: 0 / 5
Question 1 Multiple Choice
A distributed database has N=3 replicas, configured with write quorum W=2 and read quorum R=2. Which of the following best explains why this guarantees that reads always see the most recent write?
ABecause W and R are both greater than 1, every replica is contacted for both reads and writes
BBecause W+R=4 > N=3, the write and read quorums must share at least one replica, and that replica has the latest write
CBecause reads outnumber writes (R=W=2, so they balance), consistency is maintained by majority voting
DThe W+R>N condition ensures that all 3 replicas confirm every write before it completes
The W+R>N condition is a pigeonhole argument. If 2 replicas confirmed the last write (W=2) and 2 replicas must respond to a read (R=2), and there are only 3 replicas total, then at least one replica must appear in both groups — it confirmed the write AND responded to the read. That overlapping replica has the latest data. If W+R were ≤ N, it would be possible for the write and read quorums to be completely disjoint, allowing stale data to be returned. Option D confuses quorum with synchronous full replication.
Question 2 Multiple Choice
An e-commerce platform uses asynchronous replication for inventory updates. During a peak sale, the primary replica fails immediately after processing a purchase that reduced inventory from 1 to 0. What is the most likely consequence?
AThe transaction is rolled back because asynchronous replication detected the inconsistency
BThe inventory update is permanently lost if it had not yet been replicated; replicas may show inventory = 1, allowing another customer to purchase the last item
CThe system pauses all reads until the primary recovers, preventing any inconsistency
DAsynchronous replication automatically falls back to synchronous mode during failures to prevent data loss
Asynchronous replication acknowledges writes to the client as soon as the primary stores them, before replicas have confirmed receipt. If the primary crashes in the window between the write and replication, that write is lost — replicas never received it. In this inventory scenario, replicas still show inventory = 1, and a new primary elected from a replica would allow another sale, causing overselling. This is the fundamental risk of asynchronous replication: data loss on primary failure. It is an acceptable tradeoff when consistency is less critical than availability, but not for inventory management.
Question 3 True / False
Synchronous replication provides higher availability than asynchronous replication because it guarantees most replicas are generally up to date.
TTrue
FFalse
Answer: False
Synchronous replication provides *consistency*, not higher availability — in fact, it reduces availability. Because synchronous replication waits for every replica to confirm a write before acknowledging it to the client, any slow or unreachable replica causes writes to block or fail. If a network partition or replica failure occurs, the system may become unavailable for writes until the partition heals. Asynchronous replication commits locally and continues operating even if replicas are lagging or temporarily unreachable, providing higher availability at the cost of potential inconsistency.
Question 4 True / False
In a quorum-based system, increasing the write quorum W (while keeping N and R fixed) improves write durability but reduces write availability.
TTrue
FFalse
Answer: True
Higher W means more replicas must confirm a write before it is acknowledged. More confirmations means the data is stored on more nodes, reducing the risk of losing the write if some nodes fail (better durability). However, writes now require more replicas to be reachable and responsive, so fewer simultaneous failures can be tolerated before writes start failing (reduced availability). This tradeoff is why quorum systems like Cassandra expose W and R as configurable per-operation parameters — different operations have different durability vs. availability requirements.
Question 5 Short Answer
Explain why the condition W + R > N guarantees that a read will always see the most recent write in a quorum-based replication system.
Think about your answer, then reveal below.
Model answer: If W replicas confirmed the latest write and R replicas must respond to a read, and W + R > N, then by the pigeonhole principle at least one replica must belong to both the write quorum and the read quorum — it both stored the latest write and responded to the read. Since this overlap node has the most recent data, and the system returns the freshest value among all read quorum responses, the read is guaranteed to see the latest write. If W + R ≤ N, the write and read quorums could be completely disjoint sets of replicas, allowing the read to return stale data from nodes that never received the latest write.
The overlap guarantee is the mathematical foundation of quorum consistency. Tuning W and R shifts where the overlap happens and how tolerant the system is to node failures, but as long as W + R > N, the overlap is guaranteed by counting alone.