Skip to content

Add shared_stream_cohort_grace_period to reduce missed events on triggerer restart#68888

Merged
Lee-W merged 1 commit into
apache:mainfrom
astronomer:shared-stream-grace
Jun 24, 2026
Merged

Add shared_stream_cohort_grace_period to reduce missed events on triggerer restart#68888
Lee-W merged 1 commit into
apache:mainfrom
astronomer:shared-stream-grace

Conversation

@Lee-W

@Lee-W Lee-W commented Jun 23, 2026

Copy link
Copy Markdown
Member

On triggerer restart, triggers that share the same shared-stream key re-subscribe concurrently. The first to arrive creates a fresh group and polling starts immediately, so triggers that join a moment later miss events committed before they subscribed. This adds an opt-in [triggerer] shared_stream_cohort_grace_period that delays the start of polling, giving the initial cohort a window to subscribe before any event is broadcast.

Why

  • Concurrent re-subscriptions on triggerer restart race the first poll — late joiners miss early events.
  • A small configurable delay lets the cohort assemble before polling begins, without changing default behavior.

What

  • New [triggerer] shared_stream_cohort_grace_period config (float seconds, default 0.0 = no delay, backward-compatible).
  • SharedStreamManager._poll() sleeps for the grace period before opening the stream when the value is > 0.

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: [Claude] following the guidelines


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@Lee-W Lee-W changed the title Add shared_stream_cohort_grace_period to reduce missed events on trig… Add shared_stream_cohort_grace_period to reduce missed events on triggerer restart Jun 23, 2026
@Lee-W Lee-W force-pushed the shared-stream-grace branch 4 times, most recently from 01d1b8e to 34f7d24 Compare June 23, 2026 10:44
@Lee-W Lee-W marked this pull request as ready for review June 23, 2026 10:46
@Lee-W Lee-W added the backport-to-v3-3-test Backport to v3-3-test label Jun 23, 2026
@Lee-W Lee-W requested a review from jason810496 June 23, 2026 10:47
@Lee-W

Lee-W commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

cc @FrankYang0529

…gerer restart

On triggerer restart, triggers sharing the same key re-subscribe
concurrently. Without a grace period the first to arrive creates a fresh
group and polling starts immediately; triggers that re-subscribe later
miss events committed before they join.

Setting [triggerer] shared_stream_cohort_grace_period to a positive
value delays the start of polling after a group is created, giving the
initial cohort a window to subscribe before any event is broadcast.
Default is 0.0 (no delay, backward-compatible).
@Lee-W Lee-W force-pushed the shared-stream-grace branch from 34f7d24 to e1bd344 Compare June 23, 2026 10:51
@Lee-W Lee-W merged commit 3d2a635 into apache:main Jun 24, 2026
77 checks passed
@Lee-W Lee-W deleted the shared-stream-grace branch June 24, 2026 05:46
@github-actions github-actions Bot added this to the Airflow 3.3.1 milestone Jun 24, 2026
@github-actions

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.1 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

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-3-test

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 PR Link

github-actions Bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Jun 24, 2026
…ents on triggerer restart (apache#68888)

(cherry picked from commit 3d2a635)

Co-authored-by: Wei Lee <weilee.rx@gmail.com>
aws-airflow-bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Jun 24, 2026
…ents on triggerer restart (apache#68888)

(cherry picked from commit 3d2a635)

Co-authored-by: Wei Lee <weilee.rx@gmail.com>
Lee-W added a commit that referenced this pull request Jun 24, 2026
…ents on triggerer restart (#68888) (#68931)

Co-authored-by: Wei Lee <weilee.rx@gmail.com>
cetingokhan pushed a commit to cetingokhan/airflow that referenced this pull request Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants