Skip to content

Conversation

@ephraimbuddy
Copy link
Contributor

Downgrading to Airflow ≤3.0.x could leave the metadata DB with serializer v3 Dags that older versions cannot read or reserialize. This change automatically reserializes Dags to a compatible serializer version after a successful airflow db downgrade.
On downgrade, we map the target Airflow version to a serializer version and reserialize all DAGs (skipped for --show-sql-only). The mapping is derived from a new _SER_DAG_VERSIONS_MAP, resolved from either --to-version or --to-revision.

Adds db.reserialize_all_dags_to_serializer_version supporting 3→2 down-conversion. It performs a SQL fast-path for uncompressed rows across the db types and falls back to row-wise updates for compressed rows. The function does not commit and logs warnings instead of failing the CLI.

Tests cover triggering on --to-version, skipping with --show-sql-only, and the --to-revision path.

User impact: Downgrading to 3.0.x no longer results in incompatible v3-serialized Dags; the scheduler/UI can read Dags immediately after the downgrade.

Downgrading to Airflow ≤3.0.x could leave the metadata DB with
serializer v3 Dags that older versions cannot read or reserialize.
This change automatically reserializes Dags to a compatible serializer
version after a successful airflow db downgrade.
On downgrade, we map the target Airflow version to a serializer
version and reserialize all DAGs (skipped for --show-sql-only).
The mapping is derived from a new _SER_DAG_VERSIONS_MAP, resolved
from either --to-version or --to-revision.

Adds db.reserialize_all_dags_to_serializer_version supporting
3→2 down-conversion. It performs a SQL fast-path for uncompressed
rows across the db types and falls back to row-wise updates
for compressed rows. The function does not commit and logs warnings
instead of failing the CLI.

Tests cover triggering on --to-version, skipping with
--show-sql-only, and the --to-revision path.

User impact: Downgrading to 3.0.x no longer results in incompatible
v3-serialized Dags; the scheduler/UI can read Dags immediately after
the downgrade.
return None


def _get_serializer_version_for_target_version(version: str) -> str | None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did #55975 yesterday @ephraimbuddy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opps. Didn't see that. Closing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sry

@jedcunningham jedcunningham deleted the convert-serdag-3-2 branch September 23, 2025 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants