Skip to content

Explicitly rollback on task state update exception - #71076

Merged
uranusjr merged 1 commit into
apache:mainfrom
astronomer:task-state-tighten
Aug 4, 2026
Merged

Explicitly rollback on task state update exception#71076
uranusjr merged 1 commit into
apache:mainfrom
astronomer:task-state-tighten

Conversation

@uranusjr

@uranusjr uranusjr commented Aug 4, 2026

Copy link
Copy Markdown
Member

One small gap discovered when analyzing #70951.

This ensures everything is reset when something fails, including asset registration db calls previously made.

@Lee-W Lee-W left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should we add unit test to it?

@Lee-W Lee-W added the backport-to-v3-3-test Backport to v3-3-test label Aug 4, 2026
This ensures everything is reset when something fails, including asset
registration db calls previously made.
@uranusjr
uranusjr force-pushed the task-state-tighten branch from c12e418 to 2482b71 Compare August 4, 2026 09:57
@uranusjr

uranusjr commented Aug 4, 2026

Copy link
Copy Markdown
Member Author

Test added

@uranusjr
uranusjr merged commit 64002a4 into apache:main Aug 4, 2026
79 checks passed
@uranusjr
uranusjr deleted the task-state-tighten branch August 4, 2026 11:17
@github-actions github-actions Bot added this to the Airflow 3.3.2 milestone Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.3.2 based on: backport label targeting v3-3-test
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Backport failed to create: v3-3-test. View the failure log Run details

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-3-test Commit Link

You can attempt to backport this manually by running:

cherry_picker 64002a4 v3-3-test

This should apply the commit to the v3-3-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

If you don't have cherry-picker installed, see the installation guide.

@uranusjr

uranusjr commented Aug 4, 2026

Copy link
Copy Markdown
Member Author

I’ll simply add this to #71065.

vatsrahul1001 pushed a commit that referenced this pull request Aug 4, 2026
…71065)

* [v3-3-test] Release TI lock before asset listener callbacks (#70951)

* Release TI lock before asset listener callbacks

Asset registration on the task-success path (ti_update_state) ran the
listener hooks synchronously inside the transaction holding a row lock
on the task_instance table. A slow listener, multiplied across a large
fan-out of asset events, could hold that lock for minutes, causing
statement timeouts.

The listener hooks are now deferred until the end of the endpoint
instead of executed inline during asset event creation. Registration
writes to the database still happen under the caller's transaction, so
durability is unchanged; this only moves the best-effort listener hooks
off the lock.

* Optimize asset alias assoc insert

* Fix exhausted iterator reuse bug

* Test asset reg callback cases
(cherry picked from commit 79db995)

Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>

* [v3-3-test] Explicitly rollback on task state update exception (#71076)

---------

Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
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.

3 participants