Avoid duplicate Iceberg asset runs after a triggerer restart - #71751
Closed
1fanwang wants to merge 2 commits into
Closed
Avoid duplicate Iceberg asset runs after a triggerer restart#717511fanwang wants to merge 2 commits into
1fanwang wants to merge 2 commits into
Conversation
Triggers are deduplicated by hash(classpath, kwargs) while asset_watcher is many-to-many, so several assets can watch one trigger. The trigger detected that by matching the text of a ValueError raised by a private helper, then gave up on the watermark, leaving a restart free to re-emit the current head. apache#71460 makes the accessors iterable, so address each asset directly: write the snapshot to all of them and resume from the oldest, which makes a write that reached only some assets repeat a snapshot rather than skip one. A state store failure now propagates instead of being read as the several-assets case. Signed-off-by: 1fanwang <1fannnw@gmail.com>
Contributor
Author
The fallback treated the whole accessors object as one accessor, so on an Airflow that predates the iterable accessors a trigger watched by several assets raised ValueError out of run() rather than polling on without a watermark. That version cannot report how many assets watch the trigger, so read once and drop the watermark if it refuses to guess. Signed-off-by: 1fanwang <1fannnw@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.
Rationale for this change
Two assets watch one Iceberg table through one trigger. Restart the triggerer for a deploy and both fire again for a commit already reported, so every DAG watching that table gets a duplicate run.
The watermark stops that, and the trigger drops it here. It also detects the case by matching an exception's text against
"concrete inlets and outlets", wording from a private helper that nobody promised, so a reword turns the guard into a re-raise. #71460 makes the accessors iterable, so the trigger writes to each asset.What changes are included in this PR?
One cursor per asset, not one or none:
A state store failure now propagates, no longer read as the several-assets case. Before #71460 the accessors are neither iterable nor countable, so the trigger reads once to see if it can address them, polling unwatermarked if not.
Are these changes tested?
Live, on Postgres with a real Iceberg catalog and two assets on one trigger row.
Restart with no new commit, before and after
That last
prevproves the watermark survived. A stand-in for the pre-#71460 accessors covers the older path.Are there any user-facing changes?
A table watched by several assets keeps its watermark, so restarting the triggerer no longer fires a duplicate run for a handled commit. One asset behaves as before. Stacked on #71460.