Kannappan
Kannappan

Reputation: 13

Achieving Zero Down Time During Code Deployment

Need to achieve zero down time during deployment. Scenario is i have totally 6 production boxes where my code will be deployed. First code will be deployed in 3 boxes. At this point of time i will have both my old and new code up and running. i am applying a encryption logic in my one of my table in DB which will be handled only by my new code. My application will fail when user hits my old code base. What are the possible solutions. My application is java application and i user oracle 10g.

Upvotes: 1

Views: 137

Answers (2)

Brian
Brian

Reputation: 7299

The failure state is old code + new data so the transition stage needs to be new code + old data. Your new code needs to be able to tell the difference between old and new data and work with both. Then once all the old code is gone you can transition to the new data format.

  1. old code + old data
  2. new code + old data
  3. new code + new data

Upvotes: 0

JB Nizet
JB Nizet

Reputation: 691933

The solution is to have a sequence of releases that allows that. Suppose that the code, before the update, uses a plain-text column named A.

  • Add another column A_ENCRYPTED to the database. The old code still uses A and ignores A_ENCRYPTED, so everything is fine
  • Release a first update on three boxes which reads from A, writes to A and also encrypts the value and writes the result in A_ENCRYPTED. The old code and the new code both read and write from A, so everything is fine
  • Release this first update to the other three boxes. Now everybody writes to A and A_ENCRYPTED
  • Execute a script that encrypts everything in A and stores the result in A_ENCRYPTED. Now A and A_ENCRYPTED are coherent for all the rows, and continue being coherent since all the boxes write to both columns.
  • Now release a second update to three boxes which reads from A_ENCRYPTED, and still writes to A and A_ENCRYPTED. The other 3 boxes still work fine since A is always kept coherent with A_ENCRYPTED.
  • Do the same release on the 3 other boxes. Now all the boxes read and write from/to A_ENCRYPTED.
  • Now release a third update to 3 boxes that read and writes only from/to A_ENCRYPTED
  • Do the same release on the 3 other boxes. Now nobody uses the column A anymore.
  • Execute a script which removes the column A.

Upvotes: 3

Related Questions