{"messages": [{"role": "user", "content": "Create a database connection failover system that detects primary failures and automatically switches to replicas. Implement connection draining during failover, handle split-brain scenarios with quorum-based decision making, support read/write splitting with automatic routing, and provide connection state recovery after failover completion."}, {"role": "assistant", "content": "