Repository navigation
Conversation
The asset orphanage cleanup in the scheduler loop built its reference-count query as a CTE and passed it to a DELETE statement, producing `WITH ... DELETE FROM asset_active ...`. MySQL-compatible backends whose query planner does not support CTEs in DML (e.g. Vitess/PlanetScale, error VT12001) reject this statement, crashing the scheduler every parsing_cleanup_interval (60s by default). The CTE is not semantically required here: each query is consumed by a single statement, so a plain derived-table subquery is equivalent. The DELETE target (asset_active) is not referenced inside the subquery, so MySQL's self-reference restriction does not apply either.
|
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
|
Contributor
|
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. |
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes: #72187
The asset orphanage cleanup in the scheduler loop (
_update_asset_orphanage) built its reference-count query as a CTE and passed it to a DELETE, producingWITH ... DELETE FROM asset_active .... MySQL-compatible backends whose planner does not support CTEs in DML (e.g. Vitess / PlanetScale —VT12001: unsupported: WITH expression in DELETE statement) reject the statement at plan time, and since this runs on theparsing_cleanup_intervaltimer (default 60s) the scheduler crash-loops.The CTE is not semantically required:
orphan_queryandactivate_queryare each consumed by a single statement, so a plain derived-table subquery is equivalent..cte()→.subquery()for both queries; behavior is unchanged (Subqueryexposes the same.cinterface used by both consumers).DELETE FROM asset_active WHERE EXISTS (SELECT * FROM (...) AS anon_1 WHERE ...)— noWITH. The DELETE targetasset_activeis not referenced inside the subquery, so MySQL's self-reference restriction does not apply.CTE→Subquery); the now-unusedCTEimport removed.Dialect-compat precedent for this same method: #40349. Airflow 2.x is unaffected.
Existing asset-orphanage tests cover the behavior (including the #58303 regression tests); this change only alters the SQL construct, not semantics.