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
Expert 4 minTroubleshooting

The ledger database failed over mid-transaction. How do you prove nothing was lost or applied twice?

Scenario

An Indian UPI payments app processes about 4,000 transactions per second on a festival evening. Its ledger runs on PostgreSQL 16 with Patroni, one primary and two streaming replicas. At 20:41:07 IST the primary's host failed, Patroni promoted a replica in 31 seconds, and the apps reconnected. During the window, clients saw timeouts and some retried.

The interviewer asks

“The primary ledger database just failed over while payments were in flight. Services are back up. How do you prove to me, the CFO and the bank partners that no transaction was lost and none was applied twice?”

The 30-second answer

I start from what the replication mode guaranteed: with async replication, acknowledged commits after the promoted replica's last replayed LSN may be gone, so I fence the old primary and preserve its WAL before anyone rewinds it. I compute the in-flight window from the timeline switch point, decode the old primary's WAL past that point, and diff it against the new primary. Then I reconcile three sources for every transaction in the window: our ledger, our outbox of NPCI requests, and NPCI's own status via transaction status check. Idempotency keys catch retries whose first attempt survived; the dangerous case is a retry whose first attempt was lost but reached NPCI, so I match on the UPI transaction ID and RRN, not just our keys. Finally I run invariant checks, like every transaction's ledger legs summing to zero, and only then close the incident.

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 8 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?
  • The database failed over, but the application keeps talking to the old primary. What do you do?
  • 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?
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