Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BEAM-10760] Optimize state cleanup for global window in portable Flink runner #12733

Merged
merged 1 commit into from Sep 2, 2020

Conversation

tweise
Copy link
Contributor

@tweise tweise commented Aug 31, 2020

Cleanup timers per key lead to potentially unbounded state/checkpoint size growth with a global window in streaming mode.

Instead of timers, we can use the final watermark as the barrier to perform state cleanup.


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

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • 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.

Post-Commit Tests Status (on master branch)

Lang SDK Dataflow Flink Samza Spark Twister2
Go Build Status --- Build Status --- Build Status ---
Java Build Status Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status
Build Status
Build Status
Build Status
Python Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
--- Build Status ---
XLang Build Status --- Build Status --- Build Status ---

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website Whitespace
Non-portable Build Status Build Status
Build Status
Build Status
Build Status
Build Status Build Status Build Status
Portable --- Build Status --- --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

@tweise tweise requested a review from mxm August 31, 2020 02:12
@tweise tweise marked this pull request as draft August 31, 2020 02:12
@tweise
Copy link
Contributor Author

tweise commented Aug 31, 2020

This change appears to work as expected, based on e2e test.

I have not worked on the unit tests yet (couple will fail).

Copy link
Contributor

@mxm mxm left a comment

Choose a reason for hiding this comment

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

Thanks @tweise. Looks good to me. Let's add a test to ExecutableStageDoFnOperatorTest, then this looks ready to be merged.

…nk runner

Cleanup timers per key lead to potentially unbounded state/checkpoint size growth with a global window in streaming mode.
Instead of timers, we can use the final watermark as the barrier to perform state cleanup.
@tweise tweise marked this pull request as ready for review September 1, 2020 20:49
@tweise
Copy link
Contributor Author

tweise commented Sep 1, 2020

@mxm PTAL

@tweise
Copy link
Contributor Author

tweise commented Sep 1, 2020

Unrelated error in Portable_Python ("Run Portable_Python PreCommit")

13:57:33 Execution failed for task ':sdks:python:container:py2:docker'.
13:57:33 > Process 'command 'docker'' finished with non-zero exit value 1

@rakeshcusat
Copy link
Contributor

👍

@mxm
Copy link
Contributor

mxm commented Sep 2, 2020

Run Portable_Python PreCommit

@je-ik
Copy link
Contributor

je-ik commented Sep 2, 2020

This PR fixes the issue for portable runner only, am I right? Can we do the same for non-portable runner?

Copy link
Contributor

@mxm mxm left a comment

Choose a reason for hiding this comment

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

Good point @je-ik. I've just drafted a general solution which I will follow up with shortly.

Comment on lines +596 to +600
// Check if the final watermark was triggered to perform state cleanup for global window
if (potentialOutputWatermark > BoundedWindow.TIMESTAMP_MAX_VALUE.getMillis()
&& currentOutputWatermark <= BoundedWindow.TIMESTAMP_MAX_VALUE.getMillis()) {
cleanupGlobalWindowState();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic should be moved to DoFnOperator#emitWatermark. It can then also be simplified.

@mxm mxm merged commit e010b15 into apache:master Sep 2, 2020
@mxm
Copy link
Contributor

mxm commented Sep 2, 2020

Followed up on this via #12759.

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.

None yet

4 participants