Arc 2 Recap โ Choose the Right Consistency Semantics (Chapters 5โ9)
Arc 2 establishes a collection-selection process based on business invariants, failure windows, and validation methods.
What this arc established
- A Register retains one current logical value per key, viewed locally.
- Concurrent Register candidates converge through a deterministic total order or a commutative resolver.
- A Lease uses TTL and a fencing token for time-bounded ownership and depends on the external system rejecting old tokens.
- A CRDT permits local updates while its merge remains commutative, associative, and idempotent.
- State that cannot be repaired or rebuilt stays outside DSM despite convenient APIs.
Capability matrix
| Business invariant | Collection | During a partition | After recovery | Validation focus |
|---|---|---|---|---|
| one current hint | Register | nodes may see different values | deterministic winner | reversed order agrees; stale fallback |
| time-bounded exclusive right to act | Lease | old holder may still run | new token identifies the valid owner | external resource rejects old token |
| multi-node local updates merge safely | CRDT | local state is incomplete | states converge after merge | commutativity, associativity, idempotence |
| transactional fact or reliable history | keep outside DSM as primary storage | local success may be irreversible | convergence cannot compensate effects | transaction, idempotency, audit, replay |
How this arc realizes DSM's value
Register, Lease, and CRDT provide reusable coordination semantics for three recurring problem shapes. The value appears only when a collection matches the business invariant. The service team still records partition consequences, fencing responsibilities, and the authoritative source.
Five review questions
- Which system owns the authoritative state?
- Can lost state be recovered from a peer or rebuilt from that authority?
- May both nodes succeed during a partition?
- How do fencing, idempotency, or transactions protect external effects?
- Which executable command proves the selected semantics rather than compilation alone?
Common mistakes
| Mistake | Correction |
|---|---|
| model a Lease with a Register | include TTL, transfer, and external fencing in the contract |
| wrap any object in a CRDT | establish algebraic properties for the business merge first |
| read time or randomness in a resolver | keep it pure and deterministic; reverse inputs to check commutativity |
| test only the happy path | inject an old token, duplicate delta, changed order, and partition candidates |
Migration exercise
Choose storage semantics for remaining coupon quantity, batch-worker ownership, and page-view counts. For each DSM choice, record the failure window. For each rejection, name the needed transaction or history guarantee. Selecting DSM for all three earns no special credit.
Next
Arc 3 decomposes "eventual consistency" into member views, online propagation, missed-update detection, and repair.