Replication and high availability
25 questions in 7 subtopics.
Synchronous vs asynchronous replication
Explain the difference between synchronous and asynchronous replication in PostgreSQL streaming replication. What does a commit wait for in each case, and what can be lost if the primary crashes?Compare MySQL 8.4 asynchronous replication, semi-synchronous replication and Group Replication in terms of durability on failover and write latency.You run a payments database on PostgreSQL with one primary and two standbys in different availability zones of one region. Decide on synchronous settings and explain the latency and availability trade-offs.A team proposes using PostgreSQL logical replication to feed analytics, search and a new microservice from the monolith database. What are the operational risks, and how would you set it up safely?Replication lag and read-your-writes
After a user updates their address, the profile page sometimes shows the old address. The service reads from a PostgreSQL replica. How do you confirm replication lag is the cause, and what quick fixes exist?A PostgreSQL hot standby used for reports shows replay lag growing to 40 minutes every afternoon, and some report queries are cancelled with 'canceling statement due to conflict with recovery'. Explain both and what settings you would review.Design read-your-writes consistency for a Spring Boot service using a primary and three replicas, without sending all reads to the primary.Teams across your company each implemented their own replica routing and lag handling, with different bugs. How would you standardise read scaling and consistency guarantees?Failover and leader election
What happens during a database failover, from the primary failing to the application writing again? Name the steps and what the Java application must do to survive it.How do Patroni-managed PostgreSQL clusters elect a leader, and why do they depend on etcd, Consul or ZooKeeper instead of the nodes voting among themselves?A managed cloud database failed over during peak traffic. The database was back in 60 seconds, but your Spring Boot services returned errors for 12 minutes. Walk through what likely went wrong and how you would fix it.Multi-region databases
Your service runs in two regions, us-east and eu-west, with a single PostgreSQL primary in us-east. EU users see 150 ms extra latency on writes. What options exist, and what does each cost?Leadership wants the product to survive the loss of an entire cloud region with under 5 minutes of downtime and no lost payments. Design the database layer and explain where you would push back.Your board asks whether the company should go active-active across three regions for all products. As the senior technical leader, how do you frame the decision in terms of cost, risk and organisation?Backups and point-in-time recovery
Explain how point-in-time recovery works in PostgreSQL. What must you keep, and how would you restore the database to 14:32 yesterday just before a bad DELETE?An audit finds that your nightly backups have never been restored, and nobody knows how long a restore of the 4 TB database takes. What do you set up?After a ransomware incident at a peer company, your CISO asks whether your database backups would survive an attacker with admin access to your cloud account. How do you assess and improve this across 200 databases?Retention rules require keeping database backups for 7 years in some jurisdictions and erasing personal data within 30 days on request in others. As the senior technical leader, how do you reconcile backups, PITR and privacy obligations?RPO and RTO
Define RPO and RTO and give realistic values for these three setups: nightly pg_dump only; base backups with WAL archiving; synchronous standby with automated failover.Product says the order service needs 'zero data loss and zero downtime'. How do you turn this into concrete RPO and RTO targets and a design you can actually deliver?As the senior technical leader, how would you set company-wide RPO and RTO tiers for hundreds of systems and make sure they are real rather than slideware?Split brain
What is split brain in a replicated database, how can it happen during a network partition, and why is it worse than downtime?After a network blip, monitoring shows two PostgreSQL nodes reportingpg_is_in_recovery() = false, and both received writes for 4 minutes. How do you respond and recover?Your team runs its own failover scripts for MySQL using a two-node setup with a health check from a third server. Explain why this design is prone to split brain and propose a safer architecture.Over 20 years, database HA has moved from shared-disk clusters to asynchronous replicas, to consensus-based systems and managed cloud databases. What has this taught you about building versus buying HA, and what would you decide for a new platform today?No question matches these choices.