An enterprise fintech organization runs a core payment processing service on Cloud Run backed by a Cloud Spanner database. The engineering team is preparing to deploy a major release that includes a database schema modification requiring a mandatory new column. The architecture must maintain zero downtime during deployment and ensure immediate rollback capability without data corruption or service errors if automated metrics detect anomalies. Which release strategy should the Cloud Architect recommend?
- Apply an expand-and-contract schema migration pattern by making the new database column optional, deploy the updated Cloud Run service revision using traffic splitting for a progressive canary release, backfill data, and contract the schema after full traffic migration.Answer
- BExecute the breaking schema update directly in Cloud Spanner and immediately switch 100% of production traffic from the active Blue Cloud Run revision to the new Green Cloud Run revision using a standard Blue-Green deployment.
- CMigrate the payment microservice from Cloud Run to a dedicated regional Google Kubernetes Engine (GKE) cluster to execute Spanner DDL migrations using Kubernetes StatefulSet initContainers during pod creation.
- DGrant the primitive Project Owner IAM role to the deployment pipeline service account to execute database DDL updates and Cloud Run traffic routing simultaneously within a single script.
Answer
Apply an expand-and-contract schema migration pattern by making the new database column optional, deploy the updated Cloud Run service revision using traffic splitting for a progressive canary release, backfill data, and contract the schema after full traffic migration.
The expand-and-contract pattern decouples database updates from application code releases by ensuring all database modifications are backward-compatible. Combined with Cloud Run traffic splitting, this permits safe progressive canary rollouts and instant rollbacks.
Step-by-Step Solution
Key Concept
Expand-Contract Database Schema Migration with Canary Traffic Shifting