Skip to content

[v3-3-test] Fix N+1 query in bulk update for Variables and Pools (#71918) - #72160

Merged
pierrejeambrun merged 1 commit into
v3-3-testfrom
backport-562e730-v3-3-test
Aug 28, 2026
Merged

pierrejeambrun merged 1 commit into
v3-3-testfrom
backport-562e730-v3-3-test

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

BulkVariableService.handle_bulk_update and BulkPoolService.handle_bulk_update
each ran one batched existence-check query up front, then discarded the
result and re-queried every entity individually inside the loop. The
sibling handle_bulk_delete methods in the same two files, and
connections.py's handle_bulk_update, already reuse the batched-lookup
dict correctly -- this was the one spot left over from the earlier
bulk-delete N+1 fixes.

update_orm_from_pydantic in both files now takes the already-fetched
ORM object instead of a key/name string, matching the design
connections.py already uses, so the update loop no longer needs its
own per-item query.
(cherry picked from commit 562e730)

Co-authored-by: Jyun-An Chen [email protected]

)

BulkVariableService.handle_bulk_update and BulkPoolService.handle_bulk_update
each ran one batched existence-check query up front, then discarded the
result and re-queried every entity individually inside the loop. The
sibling handle_bulk_delete methods in the same two files, and
connections.py's handle_bulk_update, already reuse the batched-lookup
dict correctly -- this was the one spot left over from the earlier
bulk-delete N+1 fixes.

update_orm_from_pydantic in both files now takes the already-fetched
ORM object instead of a key/name string, matching the design
connections.py already uses, so the update loop no longer needs its
own per-item query.
(cherry picked from commit 562e730)

Co-authored-by: Jyun-An Chen <[email protected]>
@pierrejeambrun

Copy link
Copy Markdown
Member

Unrelated CI failure, merging.

@pierrejeambrun
pierrejeambrun merged commit 38e8c65 into v3-3-test Aug 28, 2026
154 of 165 checks passed
@pierrejeambrun
pierrejeambrun deleted the backport-562e730-v3-3-test branch August 28, 2026 08:35
@github-actions github-actions Bot added this to the Airflow 3.3.2 milestone Aug 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor Author

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.3.2 based on: bug fix merged to version branch
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

vatsrahul1001 pushed a commit that referenced this pull request Sep 7, 2026
) (#72160)

BulkVariableService.handle_bulk_update and BulkPoolService.handle_bulk_update
each ran one batched existence-check query up front, then discarded the
result and re-queried every entity individually inside the loop. The
sibling handle_bulk_delete methods in the same two files, and
connections.py's handle_bulk_update, already reuse the batched-lookup
dict correctly -- this was the one spot left over from the earlier
bulk-delete N+1 fixes.

update_orm_from_pydantic in both files now takes the already-fetched
ORM object instead of a key/name string, matching the design
connections.py already uses, so the update loop no longer needs its
own per-item query.
(cherry picked from commit 562e730)

Co-authored-by: Jyun-An Chen <[email protected]>
@vatsrahul1001 vatsrahul1001 added the type:bug-fix Changelog: Bug Fixes label Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants