Skip to content

Act II — Planned Renovations#

Year 2 · Summer. Lisbon and Porto now run separate environments, Rocco is pooling connections at the door, and a slow report is holding a table lock at 2 AM.

Year 2 · Summer. Lisbon and Porto now run separate environments, Rocco is pooling connections at the door, and a slow report is holding a table lock at 2 AM.

Management: "CODE-REVIEWED RELEASES ONLY! BACKFILL EVERY GUEST NAME! SURVIVE A POWER CUT!"

Rocco: Remember — the second a transaction finishes, I hand that connection to someone else. No session locks on my watch.

Summer, Year 2. Three chapters covering production-grade release engineering: immutable code-defined MigrationApp releases with checksums and explicit renames, RunPython zero-raw-SQL backfills with Expand → Backfill → Enforce → Contract, and surviving real-world lock contention, PgBouncer transaction pooling leases, and interrupted CONCURRENTLY index builds.

Act II renovations#

Ch. Renovation What you'll get Superpowers
3 Signed Work Orders Ship code-reviewed Python migrations with explicit renames, SHA-256 checksums, and history-divergence guards. Migration MigrationApp upgrade_schema()
4 Moving Elephants Mid-Renovation Split columns zero-downtime via Expand -> RunPython Backfill -> Enforce -> Contract and replay ops in memory. RunPython add_column() / set_not_null() Expand-Contract
5 Hard Hats, Locks & Power Cuts Survive lock queues, PgBouncer transaction pooling, and interrupted CONCURRENTLY indexes with self-healing recovery. lock_timeout / lock_retries MigrationLockError PgBouncer leases