Hypothetical scenario. Dev combines Northwind’s partition map and replicas into a distributed key-value drawing. Priya asks which answer wins when copies disagree. Maya asks who may still accept a change after the caller times out. The boxes locate data, but do not yet settle either operation.
Dev: “We can contact enough copies for the operation.”
Priya: “Enough copies under which ownership, version and completion rules?”
Compose the mechanisms under a small per-key contract. Follow routing, replica choice and version handling together, then inspect what the quorum count establishes and what it leaves unresolved. Category selection remains a separate responsibility from retrieving one representation.
What does this key-value operation promise?
For this teaching design, a key identifies one public product representation for a market and currency. A value includes the representation’s version and price-age evidence. The store does not directly implement the category query; membership and ordered selection remain separate responsibilities from the previous access sheet.
Choose a deliberately restricted update model: changes to one key are serialized by its currently authorized owner. Versions increase within that owner’s valid history. If the system cannot establish who may write, it refuses to claim a successful new update. This avoids assuming that arbitrary concurrent values can always be merged by selecting a larger timestamp.
The exercise does not yet supply a complete leader-election or membership-change protocol. Those mechanisms appear later. Record that limitation instead of hiding it behind the word “distributed.” A design can explain the contract a protocol must preserve before teaching the protocol that establishes it.
Locate the key, then coordinate its operation
A client presents the full key to a routing layer. The partition map identifies the owner group, and a coordinator manages communication with the selected replicas. The owner group is not a random sample of all machines: the replicas must belong to the key’s declared placement and membership configuration.
Inside each node, a local storage engine handles records and its persistence rules. Across nodes, the replication protocol determines which versions are retained and which replies satisfy the operation. A fast in-memory lookup at one replica is therefore only one part of the end-to-end operation.
Inspect versions inside a quorum reply
Hypothetical scenario. For one fixed replica set A, B and C, let writes wait for two replicas and reads contact two. The arithmetic 2 + 2 > 3 guarantees set intersection within that membership. It does not specify which returned version wins, how concurrent writers are ordered or whether an incomplete write becomes visible.
| Replica | Stored example | Meaning |
|---|---|---|
| A | Q7, version 12, live | New acknowledged version |
| B | Q7, version 12, live | Intersection candidate |
| C | Q7, version 11, live | Repair needed after comparison |
Store a value together with its version evidence and deletion state. If A and B accepted version 12 while C retains 11, a read from B and C must apply the declared version-selection rule. Concurrent versions may require reconciliation; choosing the physically newest timestamp is a policy with clock assumptions, not a proof of causal order.
A sloppy quorum can acknowledge substitutes outside the normal owner set, so the ordinary intersection argument no longer applies unchanged. Hinted handoff later forwards an obligation; anti-entropy compares replicas beyond requests that happen to be read. A tombstone must survive long enough to prevent an older value returning from an offline replica, under the chosen repair and retention assumptions.
Work through one completed write and later read
Hypothetical worked example. Choose three replicas, A, B and C. A serialized update to version 2 is durably stored at A and B before the coordinator acknowledges it. C still holds version 1. A later read obtains replies from B and C and chooses version 2 under the selected valid-history comparison rule.
The write set has two members and the read set has two. Within one fixed three-member configuration, minimum set intersection is 2 + 2 − 3 = 1 member. That explains why any such read set intersects the completed write set. It does not prove that a real implementation returns the desired value merely because it waits for two replies.
The reader still needs the relevant stored state in those replies, a correct version comparison and a defined treatment of incomplete or concurrent writes. Membership changes can invalidate the fixed-set assumption. A read observing a version from an unfinished write also requires a protocol decision; simply choosing the largest observed label is not a universal consistency theorem.
This is why the familiar condition R + W > N is an intersection argument rather than a complete linearizability proof. Linearizability will receive its own treatment using histories. For now, preserve the narrower conclusion that these particular sets overlap under these particular assumptions.
Connect the replica reply to local recovery
Hypothetical scenario. Refine the serialized-owner exercise with a put request carrying operation K, key Q7, expected version 11 and replacement version 12. The current owner checks the expectation and retains K’s outcome with the mutation under its declared serialization rule. A repeated K returns that outcome; it does not create version 13. This is a teaching contract, not Cassandra’s native conditional-write protocol.
Inside each chosen LSM-style replica, a write enters a recovery log and a sorted in-memory table. For this exercise, require the mutation’s log record to be synchronized to stable storage before that replica sends a durable acknowledgement. A later flush creates an immutable sorted table; reads reconcile the relevant in-memory and on-disk versions, including deletion markers. Background compaction combines tables but must retain versions and tombstones still required by recovery and repair.
If A and B have synchronized version 12 while C has not, their two replies satisfy the selected durable-write threshold. A crash before a memory-table flush can recover from the surviving log records. A lost coordinator reply still leaves K uncertain to the caller, so retry through the same owner and operation identity rather than inferring failure.
Cassandra’s storage-engine documentation explains commit logs, memtables and immutable SSTables, including synchronization settings that change crash-loss exposure. This exercise chooses a stronger acknowledgement rule explicitly; the mere presence of a log does not establish it. Local replay restores one replica’s state, while anti-entropy repairs disagreement between replicas. Neither mechanism supplies the missing owner-election protocol.
Derive the work introduced by copies
Keep Page 15’s selected component workload of fifteen single-key reads per second. This is distinct from the catalogue HTTP request rate and its multi-record listings. If each illustrative key read contacts two replicas once, it generates 15 × 2 = 30 replica-read requests per second. At the selected two changes per second, sending each change to three replicas produces 2 × 3 = 6 replica-update requests per second before retries or repair.
The combined selected count is 30 + 6 = 36 replica requests per second. This is not equivalent to thirty-six HTTP requests or thirty-six physical disk operations. The coordinator, storage engine and network each see different units of work. The earlier workload lesson’s separation of user demand and component operations still applies.
For a separate payload-only storage estimate, choose 100,000 values of 2,000 bytes each. One copy holds 100,000 × 2,000 = 200,000,000 bytes. Three copies hold 3 × 200,000,000 = 600,000,000 bytes before keys, versions, indexes, logs and free space. These selected values are a store-sizing exercise, not a claim that every catalogue response or record actually occupies that amount.
Disagreement needs repair with a defined meaning
A repair process can bring an older copy toward the selected authoritative history. It might happen during reads or through background comparison, depending on the implementation. Repair consumes resources and can lag behind changes. The existence of a repair mechanism does not make every immediate read current.
Deletion needs representation too. If absence is treated as older than any stored value, a disconnected replica can later reintroduce data that another node deleted. Systems may retain deletion markers and impose repair or retention rules. Those rules belong to the selected product’s contract; inventing an arbitrary cleanup interval would conceal the failure risk.
Cassandra’s documented architecture provides a real example of partitioned, versioned replication and reconciliation choices. Its conflict semantics are not identical to the restricted serialized-owner exercise here. That difference matters: borrow an explained mechanism, not an unsupported guarantee from a product label.
A timeout leaves a question about the operation
A coordinator can lose replies after replicas store a value. The caller then cannot infer from its timeout alone whether the update took effect. Repeating a change may be safe for one operation and unsafe for another; operation identity and reconciliation will be developed in the correctness module.
Do not turn that uncertainty into two authorized writers. If the former owner is merely delayed, assigning a new one without excluding the old can produce incompatible histories. Refusing a new write during an unresolved authority transition may be the honest behavior under the selected contract.
When quorum counts refer to different groups
Hypothetical failure scenario. A rebalance changes a key’s replica group. An old coordinator counts two replies from the former group while a new coordinator counts two from a new group. Both report a quorum, but their acknowledgements do not necessarily have the intersection assumed for one fixed group.
The repair is a membership-transition protocol that preserves the intended history and authority rules. Increasing an integer called “quorum” is insufficient without naming the set to which it applies. The later consensus lesson will show why configuration and authority need a deliberate protocol.
Use key-value access for a declared operation
This composition is useful for explaining known-key retrieval and per-key replication. It does not implement general category ranking, cross-key transactions or arbitrary query composition. Those operations need additional structures or coordination, with their costs made explicit.
Northwind now has a bounded account of a distributed value: identity, placement, copies, version comparison and unresolved authority transitions. The next lesson changes the size and lifecycle of what is stored. Large images should not be treated as just another small price value; object bytes and searchable metadata need different responsibilities.
Challenge the proposed mechanism
A deleted key reappears after an offline replica rejoins. Which missing evidence should be investigated?
Reveal the design reasoning
Check tombstone retention, replica repair completion, membership and the version conflict rule. Deleting the deletion marker before every relevant old value is excluded can resurrect data. Quorum counts alone do not establish safe garbage collection.
Decision and reconsideration: Publish the membership, version and repair contracts alongside R and W. Reconsider retention when outage or repair horizons change.
Inspect the complete contract
Two read replies and two write replies are chosen from three fixed replicas. What does that prove?
State the set-intersection conclusion
They overlap in at least one member. It does not alone prove linearizability, correct version comparison or safe membership changes. Those require protocol assumptions beyond the count.
Fifteen reads contact two replicas each. Is the selected replica read demand fifteen?
Count component fan-out
No. It is thirty replica-read requests per second before retries and repair. That count remains distinct from user-facing request rate and physical storage I/O.
Both old and new owner groups return two replies during a rebalance. Is the fixed-group overlap argument sufficient?
Name the membership being counted
No. The original argument assumed one fixed three-member configuration. A transition must preserve the history and authority contract across the changing groups.
The store now has an explicit small-record contract. Page 17 adds product images and examines a different boundary: publishing metadata must not claim that independently stored object bytes are ready before they have been verified.
Northwind decision log
Name the key’s placement, membership and version comparison rules.
Use quorum arithmetic only for the conclusion its assumptions support.
Keep owner transition and uncertain effects explicit rather than claiming a complete protocol.
Go deeper: replicas as a protocol
- Book chapter: Cassandra: The Definitive Guide, revised third edition, chapter 6: The Cassandra Architecture — Jeff Carpenter and Eben Hewitt. Study membership, placement and replica behavior together.
- Book chapter: The same book, chapter 9: Writing and Reading Data — the same authors. Inspect the concrete paths behind operation settings.
- Video lecture: F2023 #22 — Distributed Transaction Processing Databases — Andy Pavlo / CMU Database Group. Compare replica coordination with wider transaction responsibilities.
- Primary document: Dynamo — Apache Cassandra project. Read its actual version and replication semantics.