How databases are upgraded in production? ⚡ an over-simplified version 🤟
Minor version upgrades of the database are simple but major version upgrades are a big pain, typically a multi-month project. Here are a few things to be taken care of while doing it
understanding the changes
- going through the release doc of DB to understand the changes
- going through your source and identify the changes required
updating the code and testing it
- updating the codebase and putting it in a different branch
- spinup the database with the new version and push old data to it
- test the changes on the new database, using integration tests
- verify 100% correctness of your system on a new version of DB
rolling the new database
- setup a parallel replication from the current DB to this new DB
- wait for the new database to catch-up
- flip the connection to the new database with a config change
- run a quick application-level sanity check
This is an over-simplified view of what happens, but if you ever get a chance to do this, grab it with both hands. It is scary but worth it.
ps: youtube.com/c/ArpitBhayani