CrackOps
Interview PrepTracksLinuxAWS LabSoonInterview RoomSoon
Sign inStart free
CrackOps

Interview prep for the people who keep production up.

[email protected]
ProductInterview PrepTracksDashboardInterview Room
RolesDevOpsSREPlatformCloud
CompanyAboutContactPrivacyTerms
© CrackOps
Tracks/Production Incidents
Advanced 4 minTroubleshooting

The database failed over, but the application keeps talking to the old primary. What do you do?

Scenario

A trading platform's order-history and allocations services are Spring Boot apps using HikariCP, connecting through a PgBouncer pair to a PostgreSQL 15 cluster managed by Patroni, addressed by a DNS name with a 300-second TTL that a failover hook updates. At 10:42 during market hours the primary's storage stalled and Patroni promoted the replica in the second rack. Since then about a third of order-history writes fail with 'cannot execute INSERT in a read-only transaction', and the allocations team says a few of their writes 'succeeded' at 10:43.

The interviewer asks

“Patroni promoted the replica 40 seconds after the primary's host stalled, but twenty minutes later the order-history service is still failing writes and some instances seem to be connected to the old primary. Walk me through what you check, in what order, and how you fix it now and for good.”

The 30-second answer

First I rule out split brain, because writes 'succeeding' after promotion means the old primary may still be accepting them: I check pg_is_in_recovery on both nodes and fence the old one immediately if it's writable. Then I follow the address through each layer: the DNS record and its 300-second TTL, the JVM's own DNS cache, PgBouncer's existing server connections, and HikariCP's pooled connections, which can live up to 30 minutes and pass validation on a demoted read-only node. I drain them in order with PgBouncer RECONNECT and Hikari soft eviction or a rolling restart, and reconcile any writes that landed on the old timeline before it's rewound. The permanent fix is routing through an endpoint that follows the Patroni leader, like HAProxy checking the /primary endpoint and killing sessions when a node is marked down, plus shorter pool lifetimes, fencing via watchdog, and regular failover drills.

Sign in to finish this question

A free account unlocks the rest of it, and saves your progress across every track.

  • The voiced mock interview (4 min)
  • The full senior answer, step by step
  • Animated architecture diagrams
  • The whole conversation, 12 turns
  • Deep dive: how it works, mistakes, risks and trade-offs
  • 3 copy-ready command snippets
  • 5 follow-up questions they'll ask next
  • A self-check of 7 things interviewers listen for
Create a free accountSign in

More Production Incidents interview questions

  • The end-of-day settlement batch used to finish by 06:00 and now ends at 09:00. How do you find out why?
  • Playback failures spike for 3% of APAC viewers while CPU, memory and pods look fine. How do you triage it?
  • Kafka lag hits two minutes during a surge, but the consumers are idle. Where do you look?
  • p99 latency on the Redis session store jumps 40x mid-match while p50 is fine. How do you find the cause?
  • Payment success rate has dropped for one bank only. How do you find out whose problem it is and protect users?
  • A payment partner slows down and your own retries turn it into an outage. How do you stop the storm?
All Production Incidents questions

Linux commands for this track

  • strace Trace the system calls a process makes
  • ltrace Trace the library calls a program makes
  • lsof List open files, sockets and the processes holding them
  • dmesg Read the kernel's message log
  • perf Profile where CPU time goes, kernel and user space
  • gdb Debug crashes, core dumps and hung processes
  • coredumpctl Find and open core dumps captured by systemd
  • sar Collect and replay system activity history