Migrating bajillions of database records at Stripe
robertheaton.com
robertheaton.com
https://matthew.mceachen.us/blog/how-to-make-breaking-change...
Pretty much the perfect checklist for ensuring your migration strategy is safe.
Over the last 12 months we've migrated our entire system handling hundreds of millions of requests a day through 2 different database systems. Just requires testing and good release management.
Also it would be nice to have real numbers other than "bajillions"... what's that even mean? Doesn't sound like much more than a few gigs of data, in which case this transition could take seconds by just using an in-memory system.
Also, how many merchants can they have? I have a database of all US businesses on a desktop machine and a server. It's a few gigabytes. There are about 20 million business entities in the US, and some of them may not be Stripe customers.
Example from my past: setting a default column value on a huge table undergoing hundreds of writes per second. Oops.
Under heavy read/write loads and/or with large tables, this can blow up in your face.
- http://www.estelnetcomputing.com/index.php?/archives/12-Lock...
So, altering a column (e.g. adding a default) will trigger the problem. Adding a new column or table will not.
I thought the same thing, how many can they be? Even considering Stripe operates globally, I'd say it's a number in the tens of millions.
Edit: lots of typos
In the post they wrote
"Here at Stripe, we use a number of different database technologies for both internal- and external-facing services. Over time, we've found ourselves with growing amounts of data in MongoDB that we would like to be able to analyze using SQL. [...] MoSQL does an initial import of your MongoDB collections into a PostgreSQL database, and then continues running, applying any changes to the MongoDB server in near-real-time to the PostgreSQL mirror".
So they could have been run that migration on MongoDB.
I've had to do similar when migrating password schemes. When users login they would validate against their current password, and then generate a new password hash to use next login. Although these types of migrations usually take quite a while, as a user has to login for the migration to happen.
http://robertheaton.com/2014/03/07/lessons-from-a-silicon-va...
http://robertheaton.com/2014/07/14/getting-nothing-done-a-mi...
[1] http://johannesbrodwall.com/2010/10/13/database-refactoring-...
Nobody would lose their houses, but their IT staff would lose man-years of sleep, and people in many departments would probably be fired after the smoke settled.
How many users does your company have?