Interview Prep/Real-World Interview/Data loss and corruption

A network partition between data centres lasted 4 minutes; afterwards you find both sites accepted writes as primary, and the same order IDs exist with different contents.

AdvancedTroubleshootingData loss and corruption
Answer

Likely causes → Split brain. The failover mechanism promoted the standby without a quorum or fencing, while the old primary kept accepting writes from local clients. Two divergent histories now exist.

Diagnose → Stop writes to one side immediately. Find the divergence point (the last replicated LSN or GTID) and list every row written on each side after it.

Fix → Pick one side as the source of truth (usually the one that served most traffic), take a full backup of both, then rebuild the other side from the winner. Reconcile the conflicting writes from the loser's backup by hand or with scripts, with the business owners deciding on conflicts (refunds, duplicate orders).

Prevent → Use a consensus-based failover (Patroni with etcd, or a managed service) with fencing (STONITH or revoking the old primary's network access), require a majority quorum (three sites, or a witness), and never auto-promote without being able to demote the old primary.

All Real-World Interview questions Roadmap: Interview readiness

More on Data loss and corruption