-
Notifications
You must be signed in to change notification settings - Fork 17.4k
Reduce task success asset registration lock contention #66854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hkc-8010
wants to merge
1
commit into
apache:main
Choose a base branch
from
hkc-8010:fix/asset-event-lock-contention
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+722
−102
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| Asset events from successful tasks are registered asynchronously | ||
|
|
||
| When a task succeeds, its asset events (and the resulting scheduling of downstream | ||
| asset-triggered Dags) are no longer written synchronously inside the task state-update | ||
| request. The execution API now records the events as a durable marker in a new | ||
| ``asset_event_queue`` table, committed in the same transaction as the task state, and the | ||
| scheduler drains that queue and registers the events. This removes the asset registration | ||
| work from the task-completion request path, which previously held the ``task_instance`` row | ||
| lock while it ran and could pile up requests and exhaust the API server under high fan-out. | ||
|
|
||
| As a result there can be a short delay between a task succeeding and its asset events being | ||
| visible (typically one scheduler loop, longer under sustained load). A queued registration is | ||
| retried up to ``[scheduler] asset_event_queue_max_attempts`` times; a row that still fails | ||
| after that is parked in ``asset_event_queue`` and surfaced via the ``asset.event_queue.failures`` | ||
| metric rather than retried forever. ``dag.test`` runs without a scheduler, so it drains the queue | ||
| itself after each task, keeping asset events visible during a test run. The drain cadence and | ||
| batch size are tunable via ``[scheduler] asset_event_queue_drain_interval``, | ||
| ``asset_event_queue_batch_size`` and ``asset_event_queue_max_attempts``. | ||
|
|
||
| * Types of change | ||
|
|
||
| * [ ] Dag changes | ||
| * [x] Config changes | ||
| * [ ] API changes | ||
| * [ ] CLI changes | ||
| * [x] Behaviour changes | ||
| * [ ] Plugin changes | ||
| * [ ] Dependency changes | ||
| * [ ] Code interface changes | ||
|
|
||
| * Migration rules needed | ||
|
|
||
| * None - a new ``asset_event_queue`` table is created by the schema migration; no user | ||
| action is required. |
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.