Question

Difficulty: MediumRelease Management and Deployment Strategies

An e-commerce company hosts its backend ordering service on App Engine flexible environment connected to a Cloud SQL for PostgreSQL database. The development team needs to deploy an application update that introduces a database schema change adding a mandatory new column to the orders table. The release must maintain zero downtime, and rolling back to the previous application version if errors occur post-deployment must not cause runtime exceptions or data corruption. Which release management approach should the engineering team implement?

  1. Implement an expand-and-contract schema pattern by adding the new column as nullable first, deploying the updated application version to write to the column while maintaining backward compatibility with the active version, shifting traffic gradually via App Engine traffic splitting, and making the column non-nullable after validating the release.Answer
  2. B
    Perform an immediate blue-green deployment by cloning the Cloud SQL instance, executing the non-nullable schema update on the cloned database, pointing the new application version to the cloned database, and switching DNS records instantly to the new deployment.
  3. C
    Store the database migration state and schema deployment configurations in an unversioned local directory on the CI/CD build runner before executing a synchronous rolling upgrade across all App Engine instances.
  4. D
    Assign the primitive Owner role to the deployment service account in the CI/CD pipeline to execute destructive schema changes and force-replace App Engine instances simultaneously.

Answer

Implement an expand-and-contract schema pattern by adding the column as nullable first, deploying the backward-compatible code, shifting traffic incrementally, and finalizing the column constraint after validation.
The expand-and-contract (parallel change) pattern separates schema changes into phased steps. Making the new column nullable first guarantees that both the old version (which does not populate the column) and the new version (which populates it) can run concurrently during App Engine traffic splitting. If an issue occurs, traffic can be routed back to the old version without database errors.

Step-by-Step Solution

1
Expand database schema
Database updated with a nullable new column that existing application versions can safely ignore.
Allows older code to continue reading/writing without breaking on unexpected non-nullable constraints.
2
Deploy new version and split traffic incrementally
New App Engine version receives traffic gradually while monitoring metrics and error rates.
Ensures real-time verification and allows instant rollback to the old version without database errors.
3
Contract database schema post-validation
Data backfilled and column set to non-nullable once all traffic runs on the new version.
Completes the schema migration safely after confirming release stability.

Key Concept

Expand-and-contract deployment pattern for database-backed application releases
Rate this question