Skip to content

[Drain] Support extensible element metadata propagation in ReduceFnRunner#38230

Open
stankiewicz wants to merge 2 commits intoapache:masterfrom
stankiewicz:drain_combiner
Open

[Drain] Support extensible element metadata propagation in ReduceFnRunner#38230
stankiewicz wants to merge 2 commits intoapache:masterfrom
stankiewicz:drain_combiner

Conversation

@stankiewicz
Copy link
Copy Markdown
Contributor

@stankiewicz stankiewicz commented Apr 17, 2026

Description

This PR refactors the metadata propagation logic in ReduceFnRunner to support extensible metadata.

Previously, metadata tracking (specifically causedByDrain) was not stored in state at all during execution in ReduceFnRunner, which caused metatada loss failures when firing timers or merging panes. This PR fixes that by introducing a unified state map for element metadata.

To make it easier to add future payloads (such as OpenTelemetry context maps or CDC insert/update markers) without modifying method signatures, this change groups targeted fields into a unified container and offloads combination rules to a clean aggregator class.

Key Changes

  • Runner Fix: Added stateful tracking using METADATA_TAG (persisting CombinedMetadata) in ReduceFnRunner, ensuring metadata is no longer lost during grouping.
  • Extensible Container: Created CombinedMetadata (guided by @AutoValue) that groups element metadata together.
  • Metadata Combiners: Encapsulated combination logic within CombinedMetadataCombiner.

Open question

  • is it breaking change?

Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@stankiewicz
Copy link
Copy Markdown
Contributor Author

R: @kennknowles

@github-actions
Copy link
Copy Markdown
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@stankiewicz stankiewicz changed the title [Refactor] Support extensible element metadata propagation in ReduceFnRunner [Drain] Support extensible element metadata propagation in ReduceFnRunner Apr 17, 2026
@apache apache deleted a comment from gemini-code-assist bot Apr 17, 2026
@kennknowles kennknowles self-requested a review April 20, 2026 14:08
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.

1 participant