[
https://issues.apache.org/jira/browse/BEAM-7520?focusedWorklogId=294923&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-294923
]
ASF GitHub Bot logged work on BEAM-7520:
----------------------------------------
Author: ASF GitHub Bot
Created on: 14/Aug/19 18:40
Start Date: 14/Aug/19 18:40
Worklog Time Spent: 10m
Work Description: je-ik commented on pull request #9190: [BEAM-7520] Fix
timer firing order in DirectRunner
URL: https://github.com/apache/beam/pull/9190#discussion_r314025524
##########
File path:
runners/direct-java/src/main/java/org/apache/beam/runners/direct/WatermarkCallbackExecutor.java
##########
@@ -116,14 +119,30 @@ public void callOnWindowExpiration(
* Schedule all pending callbacks that must have produced output by the time
of the provided
* watermark.
*/
- public void fireForWatermark(AppliedPTransform<?, ?, ?> step, Instant
watermark) {
+ public void fireForWatermark(AppliedPTransform<?, ?, ?> step, Instant
watermark)
+ throws InterruptedException {
PriorityQueue<WatermarkCallback> callbackQueue = callbacks.get(step);
if (callbackQueue == null) {
return;
}
synchronized (callbackQueue) {
+ List<Runnable> toFire = new ArrayList<>();
while (!callbackQueue.isEmpty() &&
callbackQueue.peek().shouldFire(watermark)) {
- executor.execute(callbackQueue.poll().getCallback());
+ toFire.add(callbackQueue.poll().getCallback());
+ }
+ if (!toFire.isEmpty()) {
+ CountDownLatch latch = new CountDownLatch(toFire.size());
Review comment:
If I understand it correctly, then this in unfortunately currently not
possible, because the `executor` is not `ExecutorService`, but simply
`Executor`, which returns `void`, instead of `Future`. I cannot simply change
it to `ExecutorService`, because `EvaluationContext` passes there
`MoreExecutors.directExecutor()`, which is not `ExecutorService`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 294923)
Time Spent: 4h 20m (was: 4h 10m)
> DirectRunner timers are not strictly time ordered
> -------------------------------------------------
>
> Key: BEAM-7520
> URL: https://issues.apache.org/jira/browse/BEAM-7520
> Project: Beam
> Issue Type: Bug
> Components: runner-direct
> Affects Versions: 2.13.0
> Reporter: Jan Lukavský
> Assignee: Jan Lukavský
> Priority: Major
> Time Spent: 4h 20m
> Remaining Estimate: 0h
>
> Let's suppose we have the following situation:
> - statful ParDo with two timers - timerA and timerB
> - timerA is set for window.maxTimestamp() + 1
> - timerB is set anywhere between <windowStart, windowEnd), let's denote that
> timerB.timestamp
> - input watermark moves to BoundedWindow.TIMESTAMP_MAX_VALUE
> Then the order of timers is as follows (correct):
> - timerB
> - timerA
> But, if timerB sets another timer (say for timerB.timestamp + 1), then the
> order of timers will be:
> - timerB (timerB.timestamp)
> - timerA (BoundedWindow.TIMESTAMP_MAX_VALUE)
> - timerB (timerB.timestamp + 1)
> Which is not ordered by timestamp. The reason for this is that when the input
> watermark update is evaluated, the WatermarkManager,extractFiredTimers() will
> produce both timerA and timerB. That would be correct, but when timerB sets
> another timer, that breaks this.
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)