2

In continuous deployment you sometimes gradually upgrade your servers, e.g 2 out of 20 will use the new code until we are convinced everything is ok. What would happen if the new code requires a database schema migration, e.g. field phone is now table Phones. Unless I'm upgrading all 20 servers something is going to break.

2 Answers 2

1

Check out the expand/contract database pattern: http://exortech.com/blog/2009/02/01/weekly-release-blog-11-zero-downtime-database-deployment/

You temporarily duplicate data such that things are in both the old and new locations. Old queries must work, and new ones as well. You can have automated tests in your test environments verify this. Once all servers move to the newer version, you execute the "contract" removing the "old" style data.

3
  • who duplicates the data? an old application server does not know nothing about the new tables Jul 23, 2012 at 16:26
  • Your update scripts. So the data is both left in place where the old application servers are expecting it, and moved to its new location where the new application servers are expecting it. It's not a trivial approach, but can help in this scenario.
    – EricMinick
    Jul 25, 2012 at 17:27
  • the update script runs once. after that "old" app servers will store new data in its old location. Not sure who will copy the data then. Jul 25, 2012 at 17:30
0

We do this all the time in our application. What we do is have the application check which "version" of the database it's working with and then make methods that work conditional. Basically the application will work correctly with both old and new scenarios.

1
  • but there is only one database for both "old" and "new" servers. so a new server can insert a new "phone" value in table Phones, while old servers (which know nothing on the change) will look for it in the regular phone field and not find it. Jul 23, 2012 at 10:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.