Skip to content

[Dataflow Streaming] [Multi Key] Flush streaming sinks at key boundaries and bundle completion - #39961

Open
arunpandianp wants to merge 4 commits into
apache:masterfrom
arunpandianp:flushWindmillSink
Open

[Dataflow Streaming] [Multi Key] Flush streaming sinks at key boundaries and bundle completion#39961
arunpandianp wants to merge 4 commits into
apache:masterfrom
arunpandianp:flushWindmillSink

Conversation

@arunpandianp

Copy link
Copy Markdown
Contributor

No description provided.

…ies and bundle completion

When multi-key bundling is enabled in Dataflow Streaming Engine,
outputs (productions) emitted during a key's processElement lifecycle
must be attributed to that specific key's WorkItemCommitRequest, while
outputs emitted during DoFn finishBundle must be attributed to the
bundle-level MultiKeyWorkItemCommitRequest.

This change:
1. Adds finishKey(@nullable Object key) to the SinkWriter interface
   and implements it across streaming sinks (WindmillSink, PubsubSink,
   PubsubDynamicSink) and non-streaming sinks.
2. In WindmillSink, PubsubSink, and PubsubDynamicSink:
   - When multi-key bundles are enabled: flushes to the active key's commit builder
     in finishKey; flushes remaining finishBundle outputs to bundle-level
     outputs (bundleOutputMessages / bundlePubsubMessages) in close().
   - When multi-key bundles are disabled: finishKey does not flush; close() flushes
     all outputs directly into the single key's commit request.
   - Updates abort() to cleanly discard buffered messages and reset
     internal streams without flushing.
3. In StreamingModeExecutionContext and StreamingWorkScheduler, tracks
   bundleOutputMessages and bundlePubsubMessages and attaches them to
   MultiKeyWorkItemCommitRequest.
@arunpandianp
arunpandianp marked this pull request as ready for review September 3, 2026 12:27
@arunpandianp

Copy link
Copy Markdown
Contributor Author

R: @scwhittle

@github-actions

github-actions Bot commented Sep 3, 2026

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

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