Multi-region error scenarios
Multi-region replication is asynchronous. A replica can be behind, and failover does not recover writes that never reached a surviving region. The scenarios below use the setup from Multi-region operations: Alice’s entity has its primary in Los Angeles, and a replica marked with an asterisk (*) in London. A dashed box marks an unreachable region.
A primary move fails when the old primary is unreachable
In request-region mode, the entity has one primary region at a time. A write that arrives in another region asks the runtime to move the primary there.
Client B writes to Alice’s entity in London .
London must synchronize events with the current primary in Los Angeles before it can take over
.
Los Angeles does not respond, so synchronization cannot finish.
The runtime rejects the write
. London does not accept the event and does not become primary.
Retry the write after connectivity recovers. If the region is down, follow the failover procedure.
The first write to an Event Sourced Entity or Key Value Entity in request-region mode has the same limit: every region must respond. A Workflow selects its local region when its first event is persisted.
A local read can lag behind a successful write
A write reply confirms the write in the primary region. Replication to other regions is asynchronous, so the reply does not mean every replica has the new state.
Client A writes to Alice’s entity in Los Angeles .
The primary persists the change and replies without waiting for London
.
Before replication catches up, client B reads from London
.
London replies with its local state, which does not include the write
.
If the read must observe the write, run it in the primary region. For replicated Event Sourced Entities and Key Value Entities, return Effect from the handler so the request runs at the primary.
Use ReadOnlyEffect for local reads that can accept stale state.
See the component replication documentation linked from Multi-region operations.
A surviving region may not have the latest writes
If the primary region fails before a change reaches another region, the surviving region has no copy of that change. Failover changes which region accepts writes. It cannot reconstruct a write that was never replicated.
Client A writes to Alice’s entity in Los Angeles .
The primary persists the change and replies
.
Los Angeles becomes unreachable before replication delivers the change to London.
After the operator marks Los Angeles as down, client B reads from London .
London replies with the state it already received, which does not include the write
.
The write can be recovered if the original region returns with its data intact. During the outage, no surviving replica holds it. Replication status in Control Tower shows lag and errors. It does not make a write durable in another region.
A recovered region can contain conflicting changes
After failover, the surviving region accepts writes. When the failed region returns, it sends its previously unreplicated events. If both regions accepted writes for the same entity without seeing each other’s events, the histories conflict.
The operator downs Los Angeles. Client B writes to Alice’s entity in London , and London replies
.
These events are the authoritative history for writes after failover.
The operator then brings Los Angeles back. Los Angeles sends its unreplicated events to London .
Events that do not conflict are applied normally.
The runtime detects conflicting events with version vectors. Conflicting events stay in the event journal but are not applied to the entity state.
The entity’s primary in the region that was not downed replays the history, applies the events selected by the conflict rules, and persists the resolved state.
Conflicting events from the previously downed region are discarded. The resolved state replicates to the other regions .
Follow Bring up region for disaster recovery. Do not restore client traffic to the recovered region before the procedure is complete.
Writes to an unavailable pinned primary fail
In pinned-region mode, the project’s primary region is the write primary for all entities. A request that arrives in another region does not move the primary.
Client B sends a write to the service in London .
The runtime forwards the command to the primary in Los Angeles
.
Los Angeles is unreachable, so the runtime cannot handle the command and the write fails
.
Retry after recovery. During a regional outage, the operator must perform failover and change the project primary. Routing traffic to London does not move the entity’s primary. See Downing of region for disaster recovery.
Next steps
-
Multi-region operations explains primary selection and normal multi-region operation.
-
Availability and recovery compares failure scopes and recovery objectives.
-
Multi-region setup describes region configuration and failover.