Backwards incompatible changes to persistence always require at least two upgrade steps to encapsulate migration without causing downtime.
- Create a new REST service artifact "B" which creates the field and treats it as optional in read operations but required in write operations with an incremented minor version.
- Create a migration artifact (or include migration in the artifact from step 1) which populates the field. A/B deploy "B".
- Create a new REST service artifact "C" which treats the field as required with an incremented minor version.
- Wait until the migration is complete, then A/B deploy C.
The REST service dramatically changes its underlying persistence (for example from an SQL DB to a NoSQL DB)
- Create a new REST service artifact "B" which writes to both the old and the new persistence. Give it an incremented minor version.
- Create a migration artifact (or include migration in the artifact from step 1) A/B deploy "B".
- Create a new REST service artifact which updates only the new persistence format, and give it an incremented minor version.
- Wait until the migration is complete, then A/B deploy C.
REST services Purple and Green consume functionality offered by the REST service Blue. REST services Purple and Orange consume REST service Red. REST service Brown consumes Purple, Orange, and Green.
A new feature requires changes in Purple, and those changes in Purple place new requirements on Blue that can be solved with backwards compatible changes.
- Create a new version of Blue's artifact which contains the changes.
- Create a new version of Purple’s artifact which contains the changes dependent on Red’s changes.
- A/B deploy the new version of Blue.
- A/B deploy the new version of Purple.
Because the changes are backwards compatible, a new version of the remaining services is not necessary.
A new feature requires changes in Purple, and those changes in Purple place new requirements on Blue that can only be solved with backwards incompatible changes.
- Create a new minor version of Blue's artifact which contains both the old and the new API.
- Create a new version of Purple’s artifact which contains the changes dependent on Blue’s changes.
- A/B deploy the new version of Blue.
- A/B deploy the new version of Purple.
- (optionally) Create a new major version of Blue’s artifact which removes the old API, and A/B deploy that.
As long as there is no API change involved, upgrades of REST services with changed persistence can be handled exactly as though the REST service were isolated. It doesn’t matter whether they are backwards compatible or incompatible. For migrations though the sequence of versions may matter.