Interview Prep/CI/CD/Release Engineering and Progressive Delivery

How do you deal with long-running database migrations in CD?

AdvancedProductionRelease Engineering and Progressive Delivery
Answer

Decouple them from the release: run them as a separate pipeline job ahead of deploys, make them online and batched (backfills in chunks with throttling, tracking progress), avoid long locks (ALTER TABLE on big tables can block writes; use online schema change tools), monitor replication lag, and make them resumable and idempotent. Application code must work before, during and after the migration, controlled by flags. Set statement and lock timeouts so a migration fails fast rather than taking the database down.

SET lock_timeout = '3s';
CREATE INDEX CONCURRENTLY idx_orders_customer ON orders (customer_id);
All CI/CD questions Roadmap: CI/CD fundamentals

More on Release Engineering and Progressive Delivery