Failover to a Lagging Replica Lost 4 Minutes of Orders
Automatic RDS failover promoted a replica that was 4 minutes behind the primary, discarding all writes from that window.
Overview
The database failover worked in 62 seconds, but the application kept reading from a different replica that was 4 minutes behind, and 847 fulfilled orders were fulfilled again.
What happened
The orders database ran on RDS Multi-AZ with a synchronous standby in another availability zone, configured correctly. The analytics team had also added an asynchronous read replica for reporting. An asynchronous replica applies the primary's changes after they commit, so it can fall behind. A heavy reporting query that locked table statistics had left it 4 minutes behind. Then the evening went wrong in five steps.
- At 7:42 PM the primary hit a storage volume issue.
- RDS ran an automated failover to the Multi-AZ standby.
- The standby was promoted in 62 s.
- Meanwhile the application and a batch job kept sending their non-critical reads to the analytics replica by hostname alias, and it returned order states that were 4 minutes stale.
- Acting on those stale states, the batch job re-triggered 847 orders.
Key concepts
- Replication lag
- Read-after-write consistency
- Replica promotion
- RDS Multi-AZ vs read replica
Interview questions
- How do you design a read replica strategy that avoids serving stale data to business-critical reads?
Sign up free to read the full topic
More War Stories topics
- Backups That Were Never Actually Completing
- BGP Route Leak That Rerouted Traffic Through an Unexpected AS
- Blue-Green Deployment That Resulted in Split-Brain Sessions
- Cache Stampede on a Flash-Sale Product Page
- Connection Pool Exhaustion That Brought Down 12 Microservices
- DynamoDB Hot Partition That Throttled a Flash Sale
- Internal DNS Cache Poisoning That Redirected API Traffic
- Malicious npm Package Exfiltrated Environment Variables at Build Time
- N+1 Query Pattern That Collapsed Under Load
- NAT Gateway Port Exhaustion Under Bursty Lambda Traffic
- Node.js Memory Leak That Required Daily Restarts
- Public S3 Bucket Exposed Customer PII for 8 Months
Start free on Cariara · Coding problems · System design studio