Fix backfill validate n plus one#66313
Draft
ColtenOuO wants to merge 2 commits into
Draft
Conversation
Signed-off-by: ColtenOuO <jun930436@gmail.com>
Signed-off-by: ColtenOuO <jun930436@gmail.com>
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.
Summary
A new helper
_fetch_latest_dag_runs_for_infospre-loads allDagRuns the loop will need into adict, replacing the per-infoSELECTinside the loop with an in-memory lookup. This collapsesNdatabase round-trips into one batchedSELECTplusNdict reads.Per @jason810496's review on #66222, a regression test (
test_create_backfill_does_not_re_query_each_info) usesassert_queries_countto lock in the post-fix query count.Impact
DagRunInfo).Verification
airflow-core/tests/unit/models/test_backfill.py.airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code following the guidelines
Important
🛠️ Maintainer triage note for @ColtenOuO · by
@potiuk· 2026-06-18 13:57 UTCPaused pending your next update — this PR has been inactive for ~43 days, so it's been moved to draft to keep the review queue clear:
main, address any new failures, and mark it Ready for review when you pick it back up — no rush.The ball is in your court — you've been assigned to this PR.
Automated triage — may be imperfect; a maintainer takes the next look.