Skip to content

Restore atomicity of asset-event registration #70970

Description

@uranusjr

PR #62501 made AssetManager._create_asset_event commit each AssetEvent in a short-lived independent session, so events no longer commit atomically. A failure/crash after the event commits, but before the caller's transaction commits, now leaves an orphaned event (no ADRQ to consume it) or a duplicate event (on task retry). #62501's own description acknowledges this tradeoff.

We should drop the side session (single atomic commit for event + ADRQ + TI state), and make _create_dag_runs_asset_triggered tolerant of commit ordering.

The main idea is to make ADQR reference the asset event that generated it directly with a fk, instead of implicitly by asset_id + timestamp as introduced in #62501. This would remove the need for short-lived sessions. However, not using a timestamp range has some blast radius we’ll need to address, similar to when we changed the DagRun references from using execution_date to a concrete fk. It should be doable though.

References

Activity

  1. added this to the Airflow 3.4.0 milestone on Aug 3, 2026
  2. self-assigned this
    on Aug 3, 2026
  3. HarnageaGabriel commented on Aug 18, 2026

    @HarnageaGabriel

    Hi @uranusjr, I see this is assigned to you. I'd be happy to take this on if you haven't started work on it yet — the proposed fix (drop the side session in _create_asset_event, single atomic commit, and add an FK from AssetDagRunQueue to the AssetEvent instead of relying on timestamp matching) makes sense to me after reading through #62501's diff.

    Could you let me know whether this is open for a community contribution, or if you're already working on it yourself? If it's open, feel free to unassign/reassign and I'll get started; if you're already on it, I'll leave it to you.

  4. shahar1 commented on Nov 6, 2026

    @shahar1
    Contributor

    Closing as solved by #70972 (please re-open if I got it wrong)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:corekind:feature

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions