Separate having a copy from having the latest value
Replication propagates data to additional nodes. It can distribute read traffic and provide a candidate for recovery after a failure, but it does not imply that every copy changes simultaneously. A client can write to the primary and immediately read an older value from a replica. The existence of a replica and the freshness of a particular read are separate properties that need explicit guarantees.
Trace a stale read on a timeline
At time one, an inventory count changes from ten to nine and the primary acknowledges success. At time two, a subsequent read is routed to a replica. If that replica applies the update at time three, it may still return ten at time two. The observation does not necessarily mean the write vanished. Routing immediate verification reads to the primary or waiting for a known replication position can provide stronger read-after-write behavior when the application needs it.
Identify what an acknowledgment waits for
Asynchronous replication can acknowledge a write before a remote replica has received or applied it. This reduces waiting, but a promoted replica may lack a recently acknowledged update if the primary fails. Synchronous replication waits for a configured condition at selected replicas. Receiving bytes, durably storing them, and applying them to a readable state are different milestones. State the actual acknowledgment condition rather than treating the word synchronous as a complete description of durability and visibility.
Plan recovery and preserve independent history
Choosing a new primary requires mechanisms that prevent incompatible writers from operating simultaneously. Replication alone does not remove the need for leader selection or fencing an old primary. It is also not a substitute for backups: an accidental deletion can propagate to every active copy. Design read consistency, expected lag, recovery procedures, and retained history together. The right configuration depends on which failures must be tolerated and which latency or availability trade-offs the application can accept.
Separate recovery time from possible data loss
How long recovery takes and how much recent data might be missing are different objectives. Promoting a replica quickly does not reconstruct updates that never reached it. Conversely, strongly protecting acknowledged updates does not make failure detection and operational switching instantaneous. Evaluate both service interruption and possible data loss in recovery exercises. A description that reports only fast promotion or only the presence of multiple copies leaves an important part of the failure contract unspecified.
Trace one order across two copies
Order-7 changes inventory from ten to nine at primary position one while a replica remains at zero. A subsequent read there can return ten without the primary update disappearing. Distinguish successful acknowledgment from replica application. More copies do not alone define which applied position a read observes.
For immediate confirmation, compare required-position waiting, authoritative routing or showing the accepted result provisionally. One second of elapsed waiting does not prove catch-up. Waiting also needs an expiry result. Not every screen requires the strongest freshness, but permitted outcomes should be specified with concrete histories rather than an undefined latest label.
| Stage | Primary | Replica | Example read |
|---|---|---|---|
| Initial | Position 0, ten | Position 0, ten | Ten |
| After write response | Position 1, nine | Position 0, ten | Ten at replica |
| After application | Position 1, nine | Position 1, nine | Nine |
Inspect the stage acknowledged by synchronous replication
Receipt, durable log storage and state-machine application are different stages. A synchronous setting must identify which is awaited. Durable but unapplied information can support recovery without appearing immediately in ordinary reads. Three acknowledgments likewise need defined durability and version selection; the quorum guide separates that from set overlap.
If a primary is lost and the promotion candidate lacks the acknowledged position, this differs from ordinary display lag. Compare candidate progress with acknowledgment conditions. Faster promotion does not reconstruct missing updates. Retained history, safe next authority and user-visible result need a coherent recovery contract. These are separate goals from simply maintaining another running process.
Apply the same distinctions to projections and events
Query projections can lag authoritative updates too. CQRS separates write rules from query shape while introducing propagation, replay, ordering and rebuilding responsibilities. Stale display state must not become unchecked authority for new commands. Rebuilding another projection differs from executing the original business effect again.
Outbox joins local update with send intent; inbox joins received identity with a local effect. Neither makes every copy simultaneously current. Event sourcing adds deterministic replay and compatible interpretation of authoritative history. Draw source, derived state, intent and processed identity, then mark their actual transaction boundaries. The shared example lets the specialized patterns be compared without assigning all of them the same consistency guarantee.
A projection rebuild can populate a new generation, catch up and switch readers afterward. Reusing old processed identities can discard historical events needed by the empty destination. Rebuilding derived views is different from reapplying original business effects, and the intermediate user-visible state needs a policy.
Consider a synchronous replica acknowledging durable logging before application. Does its ordinary read necessarily return nine? Not if that read uses applied state still at ten. Retained recovery information and currently visible query state belong to different stages. Verify both storage acknowledgment and read API contracts. This makes the example useful for reading real configuration documentation rather than assuming the single word synchronous supplies every desired freshness and durability property.
Solve the stale-read versus lost-write exercise
Replica value ten alone does not prove acknowledged nine disappeared: primary nine can remain while application lags. Inspect destination, positions, acknowledgment meaning and promotion history. The lab fixes ordinary read, required-position waiting and application order, with a separately labeled old promotion candidate.
After an erroneous deletion reaches every replica, more identical copies do not necessarily restore the previous state. Recovery needs an independently retained history or backup. Explain waiting time and possible loss, freshness and recoverability as separate axes. That prepares the reader to choose the specialized replication, projection and transaction material without treating all copied data as equivalent protection.