CAP Failure Modes and Edge Cases
PREVENTING SPLIT BRAIN
CP implementations use term numbers (epoch counters). Each leader election increments the term. Nodes reject requests from stale terms. Quorum math prevents split brain: in a 5 node cluster, both sides cannot have 3 nodes, so only one can accept writes.
SLOW NETWORKS AS PARTITIONS
CAP assumes binary state: working or partitioned. If RTT spikes to 500ms or a GC pause blocks for 3 seconds, this looks like a partition to algorithms with 300ms timeouts. Production sees RTT spikes above 100ms daily in large clusters.
Solution: adaptive timeouts using recent p99 RTT. Partial connectivity (can reach 2 of 3 nodes) needs different handling than total isolation.
EVENTUAL CONSISTENCY CONFLICTS
Last-write-wins has a bug. Two clients update the same cart in partitioned zones. Zone A writes at timestamp 1000, Zone B at 1001 but its clock is 200ms behind (records 801). On reconciliation, 1001 wins and 801 is lost silently.
Better: version vectors. Each write includes which replicas have seen which versions. Conflicts detected and merged with application logic rather than dropped.