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?
- 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.Cevap
- BPerform 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.
- CStore 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.
- DAssign 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.
Cevap
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.
Adım Adım Çözüm
Anahtar Kavram
Expand-and-contract deployment pattern for database-backed application releases