It is rewarding to work on software that people care about and use all around the clock. This constant usage means we can't simply take the system off

Robin's blog – Careful with That Lock, Eugene

submited by
Style Pass
2024-04-13 19:00:02

It is rewarding to work on software that people care about and use all around the clock. This constant usage means we can't simply take the system offline for maintenance without upsetting users. Therefore, techniques that allow us to update the software seamlessly without downtime or compromising service quality are incredibly valuable.

Most projects I've worked on use a relational database for persistence, and have some sort of migration tool like flyway or liquibase to make changes to the database schema. This post is about a particular kind of migration situation that, in my experience, most developers who work on such projects will encounter at some point in their career. They will want to apply a simple, and seemingly innocent migration, like adding a column to a table and it'll cause some number of requests to fail, or maybe even a small outage. There are some tricks we can use here to reduce risk and automatically detect some patterns that cause this problem.

A is now holding an AccessExclusiveLock on documents, and all subsequent transactions that attempt to do anything with that table must wait:

Leave a Comment