Using the expand and contract pattern for schema changes
11–20 of 45 posts
Re: Using the expand and contract pattern for schema changes
#12Expand Contract from Fowler's bliki https://martinfowler.com/bliki/ParallelChange.html
Re: Using the expand and contract pattern for schema changes
#13Is there any easy way to implement this pattern in AWS RDS deployments where we need to deploy multiple times a day and need it to be done in few minutes?
Indeed, this pattern, in particular, is extremely useful in environments where you are trying to making changes to one part of a system while multiple deploys are happening across the entire system, or where you are dealing with a change that requires a large number of clients to be updated where you don't have direct control of those clients or they operate in a loosely-connected fashion.
So, regardless of AWS RDS as your underlying database technology, plan to break these steps up into individual deployment steps. I have, in fact, done this with systems deployed over AWS RDS, but also with systems deployed to on-prem SQL Server and Oracle, to nosql systems (this is especially helpful in those environments), to IoT and mobile systems, to data warehouse and analysis pipelines, and on and on.
Re: Using the expand and contract pattern for schema changes
#14I use this example when I speak about and teach devops trainings. I call it the migration sandwich. (Nothing to do with the cube rule). A piece of bread isn't a sandwich and a single migration in a tool like alembic isn't a "sandwich" either. You have a couple layers of bread with one or several layers of toppings and it's not a sandwich until it's all done. People get a laugh out of the "idiot sandwich meme" and we…
Re: Using the expand and contract pattern for schema changes
#15This 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”.
Re: Using the expand and contract pattern for schema changes
#16Like you essentially defined the steps in a temporal like workflow and then it does all the work of expanding, verifying and contracting.
Re: Using the expand and contract pattern for schema changes
#17I feel like maybe they should invest more R&D in their migrations technology? The ORM is pretty great.
Re: Using the expand and contract pattern for schema changes
#18Ok hear me out. What if this whole process was statefully managed for you as an add on to your database? Like you essentially defined the steps in a temporal like workflow and then it does all the work of expanding, verifying and contracting.
Re: Using the expand and contract pattern for schema changes
#19Ok hear me out. What if this whole process was statefully managed for you as an add on to your database? Like you essentially defined the steps in a temporal like workflow and then it does all the work of expanding, verifying and contracting.
Re: Using the expand and contract pattern for schema changes
#202) migration involves the problem of mixing a migration write with an actual live in flight mutation. Cassandra would solve this with additional per cell write time tracking or a migrated vs new mutation flag
3) and then you have deletes. So you'll need a tombstone mechanism, because if a live delete of a cell value is overwritten by a migrated value, than data that is deleted comes back to life