Uh oh!
There was an error while loading. Please reload this page.
[BEAM-12931] Allow for DoFn#getAllowedTimestampSkew() when checking the output timestamp - #15540
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
lukecwik
commented
Sep 21, 2021
Is there an associated JIRA? |
reuvenlax
commented
Sep 21, 2021
I think you have to update the similar check in FnApiDoFnRunner |
laraschmidt
commented
Sep 22, 2021
Added checks in FnApiDoFnRunner which was not checking for skew on timers and not checking timestamps at all for normal emit. PTAL and make sure it makes sense and I can prob add some tests in FnApiRunner. PTAL @reuvenlax@lukecwik Thanks! |
abbc86d to
a88948bCompare
lukecwik
left a comment
There was a problem hiding this comment.
Won't this allow for infinite skew since if have a timer at X and skew of -1 then the first time the timer is processed you can output at time X-1 and when it gets scheduled again you can now output at X-2 since the the new timers timestamp is X-1?
The changes to the FnApiDoFnRunner to check timestamp output validity makes sense.
There was a problem hiding this comment.
You can handle the proper bounds via:
Instant lowerBound;
try {
lowerBound = elementInputTimestamp.minus(fn.getAllowedTimestampSkew());
catch (ArithmeticException e) {
lowerBound = BoundedWindow.TIMESTAMP_MIN_VALUE;
}
if (outputTimestamp.isBefore(lowerBound)) {
...
}
Finally it would make sense to check the upper bound as well of BoundedWindow.TIMESTAMP_MAX_VALUE
There was a problem hiding this comment.
Can you not use TimerMap as it limits the number of runners this can run on and use individual timers?
There was a problem hiding this comment.
The elements need to share a timer then but I suppose the same logic will hit whenever we set the output timestamp. I removed the output of elements though since this would be harder. Wasn't really needed anyway.
There was a problem hiding this comment.
Need to tag with UsesTimersInParDo.class and/or UsesTimerMap.class.
There was a problem hiding this comment.
Done. Assuming just the validates runner tests need this because I don't see it elsewhere in the file. Let me know if not.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
laraschmidt
commented
Sep 30, 2021
So my understanding of the reason for these checks is to stop people from doing the wrong thing without realizing it. We don't even take any different action based on this variable. It seems okay to apply this to each specific output timestamp and let you skew more if you chain timers in this fashion. On a more practical note, there's reasons why you might want a timer to output an earlier element if you've properly set up watermark holds. There's currently no way to do that so we need some allowance. It would probably be better if we could constrain skew from the first output timestamp but I don't think that's available in the later timers, right? If you disagree with the approach, I can bring this up on the email thread for others to chime in in case they are not checking here. |
laraschmidt
commented
Sep 30, 2021
PTAL, @lukecwik@reuvenlax |
bf7d2c3 to
7cd3818Compare
je-ik
left a comment
There was a problem hiding this comment.
+1
Do we have a follow-up for un-deprececating the method?
lukecwik
commented
Oct 6, 2021
I think users will be surprised that their data will be dropped as late once they pass the watermark skew bound if they output past it. The existing logic had guards for this explicitly since it would be surprising for users so I do believe it is important enough to discuss whether there is another approach to solve this or we are ok with this happening. |
laraschmidt
commented
Oct 6, 2021
We chatted a bit about this offline. There's actually no guarantee that the watermark is held back when using DoFn#getAllowedTimestampSkew. The allowedTimestampSkew just removes the check that we have to avoid accidentally dropping late data. See the javadoc [1] and relevant reply from Jan [2]. [1] https://beam.apache.org/releases/javadoc/2.5.0/org/apache/beam/sdk/transforms/DoFn.html#getAllowedTimestampSkew-- |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
fa5c8c8 to
ba23c23Comparelaraschmidt
commented
Oct 27, 2021
PTAL @lukecwik |
lukecwik
left a comment
There was a problem hiding this comment.
This is looking great, need to fix up the OnWindowExpiration case and add a ValidatesRunner test for it.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Codecov Report
@@ Coverage Diff @@## master #15540 +/- ##
===========================================
+ Coverage 46.10% 83.53% +37.42%
===========================================
Files 196 445 +249 Lines 19498 61210 +41712 ===========================================
+ Hits 8990 51131 +42141 - Misses 9538 10079 +541 + Partials 970 0 -970 Continue to review full report at Codecov.
|
laraschmidt
commented
Nov 10, 2021
@lukecwik PTAL, still need to check that everything runs internally but otherwise should be good. |
lukecwik
left a comment
There was a problem hiding this comment.
Looks great and I really like the simplification in the testing.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
bafa6ce to
5a95bf6Comparelukecwik
commented
Nov 11, 2021
Run Java PreCommit |
b373e0a to
3249a0cCompare8954610 to
b3192dcCompare
A DoFn may emit elements with a timestamp up to DoFn#getAllowedTimestampSkew() before the current element's timestamp. This change implements this change for timer's as well. Now a timer may have an output timestamp up to DoFn#getAllowedTimestampSkew() before the current element's timestamp. Before this change a timer's output timestamp could not be before the current output element.
Additional Context: https://lists.apache.org/thread.html/r7554658114ddde86c5d82e1c39fe7e1ef587fe926b8e406d1130d501%40%3Cdev.beam.apache.org%3E
@reuvenlax
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username).[BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replaceBEAM-XXXwith the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.CHANGES.mdwith noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
ValidatesRunnercompliance status (on master branch)Examples testing status on various runners
Post-Commit SDK/Transform Integration Tests Status (on master branch)
Pre-Commit Tests Status (on master branch)
See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI.