seanghaeli opened a new issue, #77755:
URL: https://github.com/apache/airflow/issues/77755

   A watcher trigger keeps its state in the asset state store of the assets it 
watches, and tasks keep theirs in the same per-asset keys. So a task that 
writes a key the trigger uses changes what the trigger does next. That's the 
same for a single-asset trigger, but with a shared trigger (#75521) the result 
also depends on the order of the asset names, because the trigger writes every 
watched asset and reads the first one by name that has the key.
   
   @jroachgolf84's case on #75521: trigger X watches assets 1, 2 and 3 and 
keeps a `watermark`. A task sets asset 1's `watermark` to `2026-12-31`. The 
trigger's next `get` reads that value and its next `set` copies it to assets 2 
and 3.
   
   I ran this in Breeze with one trigger shared by `e2e_x` and `e2e_y` that 
stores a file's version and fires when the file changes:
   
   - a task writing the key on `e2e_y` (second by name) was ignored, and the 
trigger's next `set` overwrote it,
   - a task writing the key on `e2e_x` (first by name) was picked up, so the 
trigger fired again for a file that hadn't changed and wrote the old value back 
to both assets, wiping the task's value on `e2e_y`.
   
   Suggestion: give each trigger its own store, kept apart from tasks' 
per-asset state, as @vincbeck raised on #75352. A trigger's state would then 
only change when the trigger changes it, whatever the asset names are.
   
   It still has to let a task reset or rewind a trigger's state on purpose, for 
example moving a watermark back to reprocess data. Today a task does that by 
writing the asset's key.
   
   Rough cost: a new model and a migration that moves existing watcher state 
from the asset rows into it. For a shared trigger that move is ambiguous: when 
the copies differ, it's not clear which asset's value to keep.
   
   Until then, the docs say to include what the trigger watches in the key 
name, and that a task that does want to change a shared trigger's state should 
write every watched asset. #75521 also logs a warning on the triggerer when the 
copies differ, naming the key and the assets.
   
   Done when: a trigger's state can't be changed by a task writing an asset's 
key by accident, a task can still change it deliberately, and existing watcher 
state carries over on upgrade, with tests for each.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to