-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[#29772][prism] Handle EventTime Timers. #29900
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #29900 +/- ##
==========================================
+ Coverage 38.24% 38.39% +0.14%
==========================================
Files 696 697 +1
Lines 101881 102293 +412
==========================================
+ Hits 38963 39274 +311
- Misses 61306 61391 +85
- Partials 1612 1628 +16
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Assigning reviewers. If you would like to opt out of this review, comment R: @jrmccluskey for label go. Available commands:
The PR bot will only process comments in the main thread (not review comments). |
And in the meantime, I'll validate the RC. |
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control |
Friendly Ping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I had trouble understanding the code changes of this PR.
Did you mean to assign this to me? |
@christ Sorry about that. Something went haywire with keyboard shortcuts while I was replying to a comment. It must have done the assignement then. TIL there are GH keyboard shortcuts for assignee-asigning.... |
No worries, just didn't want it lost in the ether. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for the review! |
Updates Prism to support EventTime Timers.
Fixes a bug in Go SDK timer handling unset watermark holds would have the wrong default hold. They should default to the firing time.
Timer implementation tracked in #29772.
Largely handles event time timers by treating them as data elements in the processing, with the goal of minimizing unique handling of timers vs data.
Timers with the same event time must always sort after data elements with the same event time, so they can be reasonably be consolidated when firing.
Since only a single timer can be set for a [window, user key, timerfamily, tag] tuple we track the last set EventTime + Hold. This avoids scanning the element queue for a key every time a timer is written at the expense that more timers are retained in memory (a "spend RAM to save CPU" trade off). This requires managing the remaining "pending elements" properly as well, as a timer may be written, but it may not affect size of the pending queue.
WatermarkHolds are tracked on a per Hold basis. Each stage maintains a heap of their holds, and a map of how many timers are using that hold. When the count goes to 0, we remove the hold from the map, and the heap. This approach avoids tracking holds on a per timer basis, which would mean a much larger hold heap.
Aside: A general improvement that could be made to the Element Manager would be to "intern" the user key bytes, tags, and various other strings when persisting the data. This would avoid retaining several copies of each set of bytes in memory between stages (this is a "spend CPU to save RAM" trade off). There's also likely opportunity to clean up "leaked" tails of large byte buffers when a key prefix is being held (a similar CPU for RAM tradeoff).
Deferred to a later PR, related to EventTime timers:
Both are likely to be handled in the process of cleaning up prism for the Java and Python Validates Runner tests.
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
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, commentfixes #<ISSUE NUMBER>
instead.CHANGES.md
with noteworthy changes.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)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.