Your organization is executing a zero-downtime canary deployment for a critical payment-processing microservice on Google Kubernetes Engine (GKE) backed by Cloud SQL for PostgreSQL. The deployment requires adding a mandatory database column without causing application downtime or transaction failures for live users. Sequence the operational steps in the correct order to safely complete this deployment strategy.
- 1Apply an additive DDL migration (Expand phase) to add the new database column as optional (nullable) without default value enforcement.
- 2Deploy the updated microservice build using Google Cloud Deploy and configure a canary strategy to route 10% of user traffic to the new revision.
- 3Promote the updated microservice revision to receive 100% of production traffic in Google Cloud Deploy following successful canary verification.
- 4Apply a destructive/restrictive DDL migration (Contract phase) to alter the new column to NOT NULL and remove any obsolete columns.
Cevap
The proper sequence follows the expand-contract deployment pattern: first, perform an additive database migration to add the column as nullable; second, initiate a canary deployment with partial traffic shifting; third, promote the release to 100% traffic upon validation; and fourth, finalize the contract phase by applying the NOT NULL constraint to the database column.
Safely deploying application updates dependent on database schema changes requires decoupled, backward-compatible steps. The additive schema migration (Expand) must precede canary traffic shifting. Once the canary release is validated and promoted to 100% traffic across all instances, restrictive schema changes (Contract) can be safely applied.
Adım Adım Çözüm
Anahtar Kavram
Expand-Contract (Parallel Change) Pattern for Database Zero-Downtime Releases