Zero Data Loss During a Network Partition

A system design interview guide to building a distributed system that must guarantee zero data loss even when a multi-region network partition cuts the cluster in half — the consistency and consensus layer beneath a durable service.

Some data is unforgiving. A payment, a ledger entry, an order confirmation: once you tell a client “done,” that fact must survive anything short of the whole planet going dark — including the moment a fiber cut or a switch failure splits your cluster into two halves that can no longer talk to each other. That moment, the network partition, is where casual designs quietly lose writes or, worse, let two halves diverge into histories that can never be reconciled. This guide is about the layer that prevents both outcomes: how the CAP theorem forces a real choice the instant a partition happens, how consensus and quorums decide what “committed” means, how synchronous replication buys a zero recovery-point objective at a latency cost, and how fencing and epochs stop a split brain. Its companion, Multi-Datacenter Routing & Failover, covers the routing and RPO/RTO operational side — getting users to a healthy region and evacuating a dead one; this page is the consistency and consensus layer underneath it.

Contents

  1. Requirements & Scope
  2. What “Zero Data Loss” Means
  3. CP vs AP: The Partition Choice
  4. Consensus & the Replicated Log
  5. Synchronous Replication & Durability
  6. Fencing, Epochs & Split-Brain
  7. Degraded Mode & Disaster Recovery
  8. Bottlenecks & Tradeoffs
  9. Summary

1. Requirements & Scope

The problem statement is deceptively short — “zero data loss during a partition” — so the first job is to pin down exactly what must hold, and what is explicitly out of scope.

2. What “Zero Data Loss” Means

The phrase sounds absolute, but it hides a precise distinction that separates a senior answer from a hand-wave: the difference between a write that is acknowledged and a write that is committed. Zero data loss is a promise about committed writes only, and the whole design is an effort to make those two words mean the same thing.

So RPO = 0 is achievable only if acknowledgement strictly follows durable, replicated commit. The numbers below frame the cost of holding that line across regions.

QuantityAssumptionResult
Cross-region round trip~3,000 miles, fiber ~⅔ c~60–80 ms RTT
Sync commit penaltyevery write waits one quorum RTT+~70 ms per write, on the hot path
Local fsyncflush WAL to durable media~0.5–10 ms depending on device
Quorum for N = 5majority ≥ 3 must acksurvives loss of 2 nodes with RPO 0
Async alternativeack locally, replicate laterfast, but RPO = replication lag > 0
Targettier-1 critical dataRPO = 0 (sync/quorum) · some write unavailability tolerated

The load-bearing number is the ~70 ms cross-region RTT. Zero data loss means paying it on the write path; every design choice below is really a decision about where to pay it, or whether the data is critical enough to pay it at all.

3. CP vs AP: The Partition Choice

The CAP theorem is often mangled in interviews. It does not say “pick two of three” as a design-time slider. It says something narrower and sharper: when a partition happens, and only then, you must choose between consistency and availability — you cannot have both while the network is split. The rest of the time you can have both, which is why the honest framing (PACELC) adds: else, when there is no partition, you still trade latency against consistency.

A network partition splits Region A (majority) from Region B (minority); during the partition you must choose CP (minority refuses writes) or AP (both sides accept and reconcile later)
A partition forces the choice. Choose CP and the minority side refuses writes to stay consistent — correct but partly unavailable. Choose AP and both sides keep accepting writes — available but now divergent, requiring reconciliation and risking lost or conflicting updates.

Strong vs eventual consistency is the same fork seen from the read side. Strong consistency (linearizability) means every read sees the latest committed write, as if there were a single copy; it requires coordination and is what CP delivers. Eventual consistency means replicas converge given enough time and no new writes, which is what AP settles for. A zero-data-loss system for critical data lands firmly on the CP, strongly-consistent side; the art is scoping that expensive guarantee to only the data that truly needs it.

4. Consensus & the Replicated Log

How does a set of nodes agree on a single, durable history of writes — and keep agreeing even as members fail? That is the job of a consensus algorithm. Raft and Paxos are the two canonical answers; Raft is the one to explain in an interview because its structure maps cleanly to the guarantees you need. The unifying idea is a replicated log: every write is an entry appended in the same order on every node, and a write is committed once a quorum has durably stored it.

Three replicas; a write goes to two of them (W=2) and a read from two of them (R=2), so with N=3 the read and write sets always overlap on at least one replica
Quorum reads and writes with N = 3, W = 2, R = 2. Because W + R > N, the write set and read set must share at least one replica, so a read is guaranteed to see the most recent committed write.
function on_write(entry):
  require self.is_leader                      # only the leader appends
  log.append(entry, term=current_term)        # tentative, not yet committed
  replicate_to_followers(entry)               # parallel fan-out
  wait_until acks >= majority                  # W = majority durable
  commit_index = entry.index                  # now committed = safe
  ack_client(entry)                           # only now: acknowledged

5. Synchronous Replication & Durability

Consensus decides who agrees; durability decides that the agreement actually survives power loss. Zero data loss needs both, and the write path has to be synchronous end to end: a client is told “done” only after the write is durable on a quorum of nodes, not merely present in their memory.

Synchronous write path as a sequence: client write to leader, leader appends WAL and fsyncs, replicate to followers, wait for quorum ack, commit, then acknowledge client
The synchronous write path. The client is acknowledged only after the entry is fsync’d locally, replicated, and durably accepted by a quorum — so “acknowledged” and “committed” mean the same thing and RPO is zero.

The cost is explicit and unavoidable: every write pays a cross-region round trip (~70 ms) plus an fsync. That is the price of RPO = 0, and stating it out loud — rather than claiming free durability — is what signals you understand the trade.

6. Fencing, Epochs & Split-Brain

Quorum election prevents two leaders from being elected, but there is a subtler failure: an old leader that has been superseded but does not know it — it was merely partitioned away, is still alive, and keeps trying to serve writes with a stale sense of authority. If those writes are accepted anywhere, you have a split brain after all. The defense is fencing backed by monotonic epochs (Raft terms, ZooKeeper zxids, generation numbers).

function accept_write(req):
  if req.epoch < self.highest_epoch_seen:
    reject(req)                               # stale leader / stale lock holder
    return
  self.highest_epoch_seen = req.epoch         # monotonic, never decreases
  durably_apply(req)                          # fsync then apply
Interview tip. When asked to “guarantee zero data loss during a partition,” connect three claims in one breath: (1) zero loss means acknowledging only after a durable quorum commit, which costs a cross-region round trip per write; (2) during the partition you must choose CP — the minority rejects writes — because staying available (AP) means risking divergence; and (3) split brain is prevented structurally by quorum election plus fencing/epochs, not by hoping a silent node is dead. Naming all three, and admitting the latency cost, is the senior answer.

7. Degraded Mode & Disaster Recovery

A partition is not a clean win/lose; it is a state you operate in, sometimes for minutes. The design must define exactly how each side behaves while split, and how the system heals afterward.

8. Bottlenecks & Tradeoffs

The tensions here are fundamental — they come from the network and from CAP/PACELC, not from any particular implementation.

9. Summary

Guaranteeing zero data loss across a partition is one idea applied relentlessly: never call a write safe until a durable quorum agrees, and never let more than one authority exist. Everything else is placing the cost of that promise.

ConcernMechanism
What does “zero data loss” mean?Acknowledge only after a durable, replicated commit — RPO = 0.
What does a partition force?CAP: choose CP (reject minority writes) for critical data; AP only where divergence is tolerable.
How do nodes agree on one history?Consensus (Raft/Paxos): single leader per term, replicated log, majority commit.
How is a read guaranteed fresh?Quorum with W + R > N so read and write sets always overlap.
How is a write made durable?WAL + fsync on a quorum before acknowledging — committed survives region loss.
How is split brain prevented?Quorum election (one leader) plus fencing tokens / monotonic epochs rejecting stale writers.
How does the system heal?Minority replays missed log entries after the partition clears — a replay, not a merge.
What does it cost?A cross-region round trip and an fsync on every critical write — scope it to data that needs it.
The recurring theme: you cannot beat physics or CAP, so you place their cost deliberately. Make “acknowledged” equal “committed by a durable quorum,” choose CP for the data that must not lose or diverge, and prevent split brain with quorum plus fencing rather than trusting silence — then prove it in disaster drills before a real partition proves it for you.