Relational databases: collection tree

Relational databases

Regional placement and survival

Deep diveAbout 9 minutes AI-generated

Regional placement decides where a shard’s copies live and where its requests run. Put its voting replicas close together and they can agree quickly. Spread them across regions and a regional outage can leave enough voters to continue, but agreement may have to cross the network between regions.

The number of copies alone does not tell you either result. Three voters in one region can survive a machine failure and all disappear in one regional failure. A customer’s order can sit near the application while its purchase still waits for stock owned elsewhere.

This article gives the shop from Sharding and distributed SQL a separate regional layout. North, West and East are invented regions. Mina’s customer shard A has its leader in North; the shared product shard P has its leader in West. We first place the voters for one shard, then follow the work that purchase 103 needs. The placements and network times are illustrative models, not observations from a running cluster.

Regions and failure domains

A failure domain is a set of resources that one incident can remove together. A failed machine removes the replicas on that machine. A zone outage can remove several machines sharing power or connectivity. A region outage can remove several zones. Placing copies on different machines helps only against failures that leave those machines independent.

These names describe the failures you intend to tolerate. Check the actual dependencies behind them: separate zone labels do not make a shared network or power supply independent. The same applies to the application. Surviving database voters are little use to a request if its only application server has disappeared.

Keep three locations distinct. The request origin is where the application sends the request. The owner’s leader handles the authoritative work for a shard in this model. Its voting replicas participate in agreement on that shard’s history. Moving the request origin does not move either the leader or its voters.

Counting the surviving voters

The parent article established a fixed group of three Raft voters whose majority is two. Here we ask which failures leave that majority. Placing all three in separate North zones differs from placing two in North and one in West: a zone failure and a regional failure remove different sets of voters.

Figure 1 Remove a domain, then count the voters
North
Zone 1N1 · voter
Zone 2N2 · voter
Zone 3N3 · voter
West
East

3 surviving voters · majority 2 of 3

All three voters can communicate. The group can form its required majority of two.

Each voter occupies a different machine in its own zone. Empty zones are omitted when the layout changes. “North isolated” leaves North separate from a communicating West–East side. Counts assume the remaining voters and storage work, and allow any necessary election; they do not promise immediate service.

All layouts and region-loss counts as text
Communicating voters remaining after one whole region is lost
LayoutMajorityNorth lostWest lostEast lost
Three in North20 · no majority3 · passes3 · passes
Two North, one West21 · no majority2 · passes3 · passes
One per region22 · passes2 · passes2 · passes
Five: two, two, one33 · passes3 · passes4 · passes

Losing North zone 1 removes one voter in every layout. North isolated: three in North can continue only on North’s side; two in North can continue only on North’s side; one per region can continue only on West–East’s side; five placed two–two–one can continue only on West–East’s side. The application must reach the side with a majority.

Three voters in separate North zones leave two after one zone fails, but none after North fails. Two in North and one in West leave two after West fails and only one after North fails. The surviving West copy still holds data; it cannot make itself a majority by treating the missing voters as removed.

With one voter per region, any one region’s loss leaves two of the configured three. With five voters placed two in North, two in West and one in East, the majority is three. Losing North or West leaves three; losing East leaves four. All three single-region failures pass the count.

For a fixed group of N voters, the majority is floor(N / 2) + 1. If an incident removes F of them, the first test is whether N − F still reaches that majority. Count voters per shard, not machines across the whole cluster. Five healthy machines holding other shards cannot complete P’s majority.

The survivors must also communicate. Isolating North in the one-per-region layout leaves West and East able to form a majority together, while North alone cannot. If West and East cannot communicate either, there is no majority anywhere. An election, working storage and enough capacity remain necessary even when the count passes; the majority count establishes a possible path to progress, not a deadline for recovery.

Retaining history and accepting new writes are different promises. A group without a quorum may retain every earlier committed change and still stop new writes. A non-voting replica can add a copy, and may support qualified reads, but it does not add a vote to this calculation. A backup is another way to retain recoverable data; it does not answer a live agreement request.

What a regional write waits for

Spreading voters changes the healthy path too. Give P one voter per region, with West already its leader. To form a majority of two, West needs its own durable record and one other voter’s acknowledgement. That other voter must be remote.

Use the separate catalogue change from the parent: P7’s price rises from 20.00 to 22.00. Stock stays at its post-purchase value 0, and order 103 keeps its agreed line prices and total 29.00. Assume the command has reached West, with a West–North network round trip of 40 ms and a West–East round trip of 90 ms. North’s availability determines which remote acknowledgement can complete the majority.

The remote reply completes the majority
Figure 2. The stated round trips are network contributions, not predicted SQL latency.
Figure as text

West is leader with one voter per region. It needs a durable acknowledgement from North or East in addition to its own record. North’s assumed round trip is 40 ms; if North is unavailable, East’s is 90 ms. Followers need not have applied the command before acknowledging it.

In the healthy case, North’s acknowledgement completes West’s majority. The agreement path includes at least the assumed 40 ms network round trip. East need not answer first. With North unavailable, West needs East, so that network contribution becomes at least 90 ms. The group survives North’s loss, and the route that lets it survive is slower.

These are network contributions to one established leader’s agreement round. They are not predicted SQL commit latencies. Storage must make the required records durable; the leader must establish commitment and apply the command before replying under this model. Client routing, queues, execution and any transaction protocol add work. After a leader failure, detection and election add a different wait. The protocol’s event order alone gives no elapsed time.

A five-voter group placed two–two–one illustrates the same trade. A leader in a two-voter region can count both local voters and still needs a third vote from elsewhere. A larger group changes the required set of acknowledgements; it does not make distant agreement disappear. If the nearest useful voter is slow, a faster alternative may complete the majority instead.

The model follows Raft with fixed membership, an established leader and a new command from that leader’s current term. It inherits the parent’s election and log rules, and assumes non-malicious failures and storage that preserves acknowledged durable state. Merely counting stored copies of an older command is not a substitute for those rules.

A local order can need remote stock

Now return to before purchase 103. The North application handles Mina’s request. A must create her pending order and its two lines. P must guard the stock changes: P7 from 1 to 0 and P3 from 12 to 10. Both product rows belong to P in this layout, so there are two data owners.

Give both A and P one voter in every region, keeping A’s leader in North and P’s in West. Their leaders are where the purchase’s authoritative order and stock work runs; their other voters preserve each owner’s history.

Local orders, remote stock
Figure 3. These are dependencies, not a commit-time calculation or a complete message trace.
Figure as text

The application in North reaches Orders in North and Stock in West. Each owner has its own three-region group and needs its own majority. Adding a hypothetical globally unique order-ID owner in East adds another required owner. All participants still need one recoverable atomic outcome.

The application reaches A locally, but A’s local order work is only part of the purchase. P’s stock authority is in West. Coordination between A and P crosses a regional boundary; agreement among A’s copies and among P’s copies can cross regional boundaries as well. The first is work between different owners. The second keeps copies of one owner on one history.

Those waits can overlap or require several rounds, depending on the database’s transaction protocol. Counting the dependencies does not produce a commit time: a purchase cannot safely claim success while a required owner is unable to complete its work or learn the joint outcome.

A and P agreeing separately does not establish one purchase outcome. Both need to participate in a recoverable atomic decision. Transactions across partitions follows that decision and its recovery. Here its consequence is placement: include every required participant when deciding which failures and network trips the purchase depends on.

Global constraints have a location

The shop’s order_id identifies one order globally. A unique check beside Mina’s rows can reject a second 103 on A. An independent check beside Tariq’s rows can reject a second 103 on B. Without a mechanism joining those checks, each can accept its first 103.

One variation adds a separate owner G to govern the globally unique number and its association with the order. G’s leader is in East, and G has its own three-region voting group. Its work must belong to the complete purchase protocol. Creating an unrelated reservation in East and then hoping the order write succeeds is not enough.

The extra owner is one possible design, not a claim about how every distributed database implements uniqueness. An engine might maintain a distributed unique index, use a specialised regional check, or reject a constraint whose scope it cannot enforce. A global index also has keys and replica placement, so inspect its work alongside the base rows. A duplicate-resistant ID generator reduces accidental collisions; by itself it does not reject an explicit duplicate supplied by another writer.

Changing the key to (region, order_id) changes the rule. It distinguishes (North, 103) from (West, 103), allowing the number 103 twice. That is regional uniqueness, and references must carry enough information to identify the intended order. It does not preserve the shop’s original ID-only identity.

References add work too. A new order line names P7, whose product identity belongs to P; a maintained local copy may or may not be sufficient for a particular engine’s reference checks. Include foreign-key enforcement and maintained secondary indexes before calling a write local. Copying catalogue details near A may save a read trip under a freshness contract. It does not allocate A an independent last blue mug. A different inventory-allocation protocol would have to preserve the total allowance across regions.

Reading near the application

A nearby copy can shorten a read without shortening the path that agrees a write. The read first needs a contract: must it reflect current authority, include a particular earlier write, or show an explicitly permitted past state?

Return to the independent price change. P’s West leader has replied successfully after West and East made the command durable, but North’s nearby copy has not applied it and still reads 20.00. That local answer must be judged against the particular read’s freshness requirement.

Figure 4 A nearby value needs a history contract
West · leaderU durable and committed22.00 appliedSuccessful reply already sent
East · voterU durableApplication not establishedSupplied the other acknowledgement
North · nearby copyU not yet applied20.00 appliedAvailable to the North application
North’s 20.00 → needs authority and freshness evidence

Proximity is not proof of current state. Use the engine’s qualified authority path; remote communication may be needed.

A separate illustrative state after the P7 price change, with West and East forming the durable majority. Durable, applied and safe to read are different tests. Order 103 still has agreed total 29.00; this catalogue illustration does not alter stock.

Read requirements as text
  • Current authoritative state: the nearby 20.00 alone supplies no proof of freshness or authority.
  • Include the acknowledged change: North must first qualify a target and snapshot that include applied U, or route elsewhere or return unavailable under the chosen contract.
  • Permitted history before U: 20.00 can be the right answer if the engine proves the requested history safe to serve. It remains unsuitable as authority for a new stock decrement.

A read claiming current state cannot infer freshness from being close to the application. It needs the engine’s authority and freshness evidence, which may require remote work. Some protocols let a qualified replica serve it locally using previously established evidence; current reads do not universally require a new network round trip for every request.

A read required to include the acknowledged price change must use a target and snapshot qualified for that history. Waiting until a local copy has received a record is insufficient if it has not applied the change. Replicas, lag and read routing develops that distinction and the routing choices when a target is behind.

A historical catalogue view may permit 20.00, provided the engine can safely serve the requested past history. Permission to show an older price does not grant permission to sell against older stock. The purchase still checks and changes stock at its authority. A report joining regional owners also needs a compatible observation across them; Time, snapshots and distributed reads develops the common-snapshot machinery.

Choosing and checking a placement

Start with a request and a failure promise. For Mina’s purchase, “continue after any one region is lost” requires more than P retaining a majority. A, P and any required G must each retain a communicating majority. The surviving application must reach them, and the remaining machines must have capacity for their work.

Check the complete request, including its required owners
CaseWhat to establish
Healthy operationWhere the application, leaders, voters, constraints and indexes run; which remote waits the request needs.
One zone lostRemove all affected replicas together. Count each owner’s survivors and check the application route.
North, West or East lostTest each region separately. Include leader replacement and the workload concentrated on survivors.
Network splitIdentify which voters can communicate with one another and which side the application can reach.
A slow required ownerMeasure the whole request under representative load, including queues, retries and changed acknowledgement paths.

State the latency target separately for healthy and degraded operation, and measure both. A majority count establishes structural survival under the stated failure model. It does not establish how quickly an election completes, how long transactions wait or how much throughput survives. For example, the one-per-region layout survives North’s loss while changing the assumed network contribution to P’s agreement from 40 to 90 ms.

Place copies for the failure you must survive, then place leaders and request work to make the remaining coordination acceptable. Check the actual constraints and replica assignments after configuration. CockroachDB table locality and region survival takes that reasoning into native settings and verification. Rebalancing and cluster change explains how to reach a new layout safely while copies catch up and membership changes.

Sources and further reading

Checked on 25 October 2026. The layouts, network times and request paths are illustrative. No distributed cluster was run and no commit, election or recovery time was measured. The fixed-group counts describe the stated majority model, rather than a complete database availability guarantee.

  • Diego Ongaro and John Ousterhout, In Search of an Understandable Consensus Algorithm, sections 2, 5.3–5.4 and 8: communicating majorities, replicated-log commitment, election restrictions and read authority. The regional counts and assumed network arithmetic here are worked examples.
  • CockroachDB, Multi-Region Survival Goals: the distinction between zone and region failure, and the regional write-latency trade.
  • CockroachDB, Replication Layer: non-voting replicas: copied history without participation in the voting quorum.
  • CockroachDB, Follower Reads: qualified strong and historical reads, including the requirement that applications tolerate the history they request.
  • CockroachDB, Unique Constraint: engine-specific enforcement, indexes and regional qualifications. Owner G is hypothetical, rather than an asserted part of CockroachDB’s implementation.