3 ms·
This is just the natural solution that falls out if you want to change a schema with no downtime. I always just called it “dual writing”.
by sarchertech 1y ago
This is just the natural solution that falls out if you want to change a schema with no downtime. I always just called it “dual writing”.
- evancordell 1y agoWe always called these "four-phase migrations". An old Stripe article used similar naming[0]. [0]: https://stripe.com/blog/online-migrations https://stripe.com/blog/online-migrations
- sarchertech 1y agoI’ve heard that one too. I think the key insight is that you need to “stop the bleeding” (stop creating more old data that needs to be migrated) before you do any backfilling. That’s why I always called it dual writing because that’s the stop the bleeding step.
- manmal 1y agoIn the step where writes are added, from the client to the new schema instance, how does this work when writes depend on existing data, when the existing data hasn’t even been copied? Constrains like foreign keys will prevent this from working, no?
- sarchertech 1y agoYou wouldn’t enable foreign key constraints until you finish backfilling the old data in that case. Or you do it in phases where you do all of these steps and migrate the dependency first.