Skip to content

[Prism] Handle pending adjustment for processing time bundle correctly - #36384

Merged
shunping merged 1 commit into
apache:masterfrom
shunping:fix-prism-test
Oct 3, 2025
Merged

[Prism] Handle pending adjustment for processing time bundle correctly#36384
shunping merged 1 commit into
apache:masterfrom
shunping:fix-prism-test

Conversation

@shunping

@shunping shunping commented Oct 3, 2025

Copy link
Copy Markdown
Collaborator

Re-enable test: org.apache.beam.sdk.testing.TestStreamTest.testEarlyPanesOfWindow in prism.

This test uses accumulating mode in window strategy and the previous failure is due to not handling pendingAdjustment from buildTriggeredBundle (pointed out in the comment below). The fix is to plumb the pendingAdjustment out and correctly address it.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @shunping, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request implements a crucial fix within the Prism runner's element management system to correctly handle pending element adjustments during the creation of processing time bundles. This ensures that the system accurately tracks the number of elements awaiting processing, resolving issues where processing time triggers could lead to incorrect or duplicate element processing, thereby improving the correctness and reliability of data processing in Prism.

Highlights

  • Correct Pending Element Accounting: Introduced a pendingAdjustment mechanism to accurately account for elements that become pending when processing time bundles are created, particularly for aggregation stages.
  • Fix for Double-Firing Triggers: Addresses an issue where processing time triggers could cause elements to be processed multiple times, as evidenced by a temporarily disabled test case in the Java build.
  • Refactored Processing Time Bundle Logic: Modified several function signatures and internal logic within elementmanager.go to propagate and utilize the pendingAdjustment value, ensuring proper state management.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

state.Pane = computeNextTriggeredPane(state.Pane, endOfWindowReached)

// We're going to process this trigger!
elems, _ := ss.buildTriggeredBundle(em, string(e.keyBytes), e.window)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pendingAdjustment from buildTriggerBundle was discarded previously, which leads to the issue when handling processing time bundle in accumulating mode.

@shunping

shunping commented Oct 3, 2025

Copy link
Copy Markdown
Collaborator Author

cc'ed @lostluck

@github-actions

github-actions Bot commented Oct 3, 2025

Copy link
Copy Markdown
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

'org.apache.beam.sdk.metrics.MetricsTest$CommittedMetricTests.testCommittedGaugeMetrics',

// negative WaitGroup counter when failing bundle
// Instead of 42, Prism got 84, which suggests two early panes of 42 are fired.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what's happening in the "testAfterProcessingTimeContinuationTriggerUsingState" after this change?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I think the previous negative WaitGroup counter masked the true error in this test.

The interesting thing is that it has a sister test at

public void testAfterProcessingTimeContinuationTriggerEarly() throws Exception {
, which uses TestStream rather than stateful DoFn to generate the upstream data. That test passes.

@shunping

shunping commented Oct 3, 2025

Copy link
Copy Markdown
Collaborator Author

The failed test in Python Coverage seems to a flake.

@shunping
shunping merged commit 5485467 into apache:master Oct 3, 2025
25 of 27 checks passed
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.

2 participants