1

Scenario

A clustered environment running N identical application nodes interacting with a single relational database.

Problem

Is it possible to upgrade the nodes to a new application version, which requires a new database schema and maintain data integrity in the database without any downtime in the application and without losing any data or ending up with data in an inconsistent state?

Armand
  • 6,508
  • 4
  • 37
  • 53
  • In the abstract, it seems tricky to me. – Armand Sep 13 '13 at 14:23
  • 1
    https://www.facebook.com/note.php?note_id=430801045932 talks about a script Facebook uses. Note the list of assumptions, including that the new schema is compatible. If it were not, any needed data-massaging would have to happen as well. While that data-massaging was in progress, the database would have to be unavailable. In principle you could have old code continue on old database, then cut code over, then pull in changes to old database made while new DB was prepared. This could be eventually-consistent, but consistency could not be provided by the database for this operation. – psr Sep 13 '13 at 22:56

1 Answers1

1

I guess, in general the answer is "no". However, if the new application version can work with old database OR old application version can work with the new schema - then it is possible.

For example, if the changes (to DB schema) are additive (like adding one more field), then it's possible to update database first.

If the new application senses older database and adjust to it, then it's possible to update app server instance first.

One more approach would be making a transition version of the app, which will work with both schemas, and make transition in two steps.

In other words, if changes to app AND database schema are not very big, it's possible.

Roman Susi
  • 1,763
  • 2
  • 12
  • 20