Incident: A two-millisecond migration stalled the API
Module 11 · Incident file · About 35 minutes
What happened
In May 2015 Chris Sinjakli of GoCardless, a payments company, published "Zero-downtime Postgres migrations - the hard parts". It opens: "A few months ago, we took around 15 seconds of unexpected API downtime during a planned database migration." For a payments API that matters: "if we're not accepting requests, our merchants are losing money."
In late January the team was building invoicing. They renamed some tables that were empty and unused in production, then dropped and recreated their foreign key constraints to fix the names. "Just after the schema migration started, we started getting alerts about API requests timing out. These lasted for around 15 seconds, at which point the migration went through and our API came back up." Rerun against a backup from earlier that day, the same migrations "went through in a few hundred milliseconds." The slow part was not the change. It was the wait.