Repository navigation
Clarify db downgrade rollback limits - #69645
Muhtasim-Munif-Fahim wants to merge 1 commit into
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
Eason09053360
left a comment
There was a problem hiding this comment.
Thanks for the patch! This is my perspective and a few suggestion. Feel free to resolve it.
| ``db downgrade`` only reverts schema changes tracked by Alembic. It does not rewrite metadata rows | ||
| that were already written by the newer Airflow version into an older serialization format. If the | ||
| newer version has already run against the database, restoring a metadata DB backup taken before the | ||
| upgrade is the only clean rollback path. |
There was a problem hiding this comment.
"If the newer version has already run against the database" covers almost every real downgrade, so this reads as "db downgrade is never clean". It might also conflicts with the dags reserialize note at the end of this section. Making it conditional keeps both true, and naming the error helps people searching for it.
| ``db downgrade`` only reverts schema changes tracked by Alembic. It does not rewrite metadata rows | |
| that were already written by the newer Airflow version into an older serialization format. If the | |
| newer version has already run against the database, restoring a metadata DB backup taken before the | |
| upgrade is the only clean rollback path. | |
| ``db downgrade`` runs the Alembic downgrade migrations. They revert schema changes, but convert only | |
| the data they were written to convert. Anything else the newer Airflow version wrote in a format the | |
| older version cannot read stays as it is. For example, Airflow 3.1 cannot read trigger kwargs written | |
| by Airflow 3.2 and fails with ``KeyError: '__var'``. In such cases, restoring a metadata DB backup | |
| taken before the upgrade is the only clean rollback path. |
| Backups are also the only clean rollback path when a newer Airflow version has already written | ||
| metadata rows in a format that an older version cannot read. ``airflow db downgrade`` only | ||
| reverts Alembic schema migrations; it does not rewrite existing metadata row content back to an | ||
| older serialization format. |
There was a problem hiding this comment.
Same correction here, plus the concrete 3.2 → 3.1 case from the issue.
| Backups are also the only clean rollback path when a newer Airflow version has already written | |
| metadata rows in a format that an older version cannot read. ``airflow db downgrade`` only | |
| reverts Alembic schema migrations; it does not rewrite existing metadata row content back to an | |
| older serialization format. | |
| Backups are also the only clean rollback path when a newer Airflow version has already written | |
| metadata in a format that an older version cannot read. ``airflow db downgrade`` reverts schema | |
| changes, but its downgrade migrations convert only the data they were written to convert. For | |
| example, Airflow 3.1 cannot read trigger kwargs written by Airflow 3.2, even after | |
| ``airflow db downgrade`` succeeds. |
Summary
Testing
Closes #68317