A connected vehicle technology provider operates an API service on Google Cloud Run backed by Cloud SQL for PostgreSQL. The engineering team needs to release a new version of the microservice that introduces a schema modification adding a new column required by the application. The release must guarantee zero downtime and allow seamless immediate rollback to the previous Cloud Run revision if anomalies occur during deployment. Which deployment and database migration strategy should the Cloud Architect recommend?
- AImmediately apply the database schema update introducing the required column, then execute a blue-green traffic switch to the new Cloud Run revision.
- Apply an expand-contract schema pattern by adding the new column as optional first, deploy the new Cloud Run revision using revision traffic splitting for canary testing, backfill the data, and update the column constraint after verifying release stability.Cevap
- CMigrate the microservice deployment from Cloud Run to a Google Kubernetes Engine (GKE) cluster to use GKE Native Ingress traffic management for the release.
- DProvision a duplicate Cloud SQL instance with the new schema, perform a blue-green endpoint cutover, and submit a regional quota increase request after the cutover if resource utilization spikes.
Cevap
Apply an expand-contract schema pattern by adding the new column as optional first, deploy the new Cloud Run revision using revision traffic splitting for canary testing, backfill the data, and update the column constraint after verifying release stability.
To achieve zero downtime and maintain immediate rollback capabilities during release management, database updates must follow the expand-contract pattern. Adding new fields as optional (nullable) ensures that the currently running version of the service remains fully operational while the new revision is deployed to Cloud Run. Cloud Run natively supports splitting traffic between revisions to perform canary testing. Once the new revision is validated and receiving 100% of traffic, data backfilling and schema constraints can be finalized safely.
Adım Adım Çözüm
Anahtar Kavram
Database Backward Compatibility in Canary and Blue-Green Deployments (Expand-Contract Pattern)