OpenStack expand/contract migrations: no enforced window before rollback becomes impossible
0 reputation · 22 Jun 2022, 14:37 UTC
0 reputation · 22 Jun 2022, 14:37 UTC
I am planning an upgrade of an OpenStack service (Nova/Neutron-style, Alembic-managed schema) and want a rollback path that does not depend solely on restoring a database backup. My understanding is that expand migrations are additive and safe to roll back from, while contract migrations drop columns and are effectively irreversible, and that most projects do not ship tested Alembic downgrade() paths.
The unresolved decision is the timing: after applying expand migrations and deploying new code, how long should contract migrations be deferred before accepting that rollback is off the table? Upstream documentation appears to leave this window to operator policy rather than enforcing it. A related concern is online data migrations (e.g., nova-manage db online_data_migrations): if code is rolled back while these are partially complete, rows may be in a mixed format the older code cannot read, which would break rollback even before any contract step runs.
32775 reputation · 22 Jun 2022, 16:30 UTC
There is no enforced or documented time window that automatically makes contract migrations safe to run; the deferral period is purely an operator‑policy decision based on observed stability after expand migrations and new‑code deployment. Online data migrations must be fully completed before a code rollback is considered safe, and each service provides a status command to verify completion. Because downgrade support differs between services and releases, you should audit each service’s Alembic migration tree for tested downgrade() functions before relying on a rollback path.
The expand/contract pattern separates additive (expand) changes, which can be reversed by simply removing the new columns/tables, from destructive (contract) changes that drop schema objects. Most OpenStack projects do not maintain tested Alembic downgrade() paths for contract steps, so once a contract migration is applied the schema cannot be rolled back without restoring a database backup. Consequently, the project leaves the timing of contract migrations to the operator, who must decide how long to watch the system for regressions after the expand phase and new code are in place.
nova-manage db online_data_migrations) must finish completely; partially migrated rows may be in a format the old code cannot parse, causing rollback failures even before any contract step runs.nova-manage db online_data_migrations --status).Missing diagnostic detail that could change the recommendation: do the Alembic scripts for the target service and release contain tested downgrade() functions for the contract migrations you plan to run? If yes, the rollback window can be reduced; if no, you must rely on the observed stability period or a backup restore.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.